cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Component for save data files

uscqfjcg
1-Newbie

Component for save data files

hello.
I'm using Mcad14 for modifying groups of text files. For reading data I use the component which allow to change dynamically the file name of the input. Once the modifications in the data are made, the writing of the new file can't be done with WRITEPRN because it introduce many strange characters and change the structure of the original file. So I must use the data output component with the "Formatted Text" option, but the only way I found for giving a name to the file to be saved is opening the properties dialog of the component for any single file that is processed. This is time consuming and don't allow to automatically apply the program to a group of related files. There is any alternative to this procedure?
thanks in advance.
jcg.


5 REPLIES 5
RichardJ
19-Tanzanite
(To:uscqfjcg)

It can be done using a scripted component. If this doesn't do what you want I would need to see an example of the data.

Richard

Thank you; your function do exactly what I need. I
put it in to my worksheet and create a group of data
files with file names different for each one,
automatically generated. Great!! Editing the script
of your function I change the "Delimiter" from
"vbTab" to the space character, that is more
friendly with the program (Gaussian, a program for
doing Computational Chemistry calculations) that
will use these data files. Nevertheless, the data
files saved with that function use "," as decimal
separator, how can I change it to "." the decimal
point?
And one more question, can I have a list of files
that are in a directory (in the current one or in
any other folder) from inside a Mathcad worksheet?
Thank you again,
jcg
RichardJ
19-Tanzanite
(To:uscqfjcg)

On 4/6/2010 8:34:13 AM, uscqfjcg wrote:
>Thank you; your function do
>exactly what I need. I
>put it in to my worksheet and
>create a group of data
>files with file names
>different for each one,
>automatically generated.
>Great!! Editing the script
>of your function I change the
>"Delimiter" from
>"vbTab" to the space
>character, that is more
>friendly with the program
>(Gaussian, a program for
>doing Computational Chemistry
>calculations) that
>will use these data files.
>Nevertheless, the data
>files saved with that function
>use "," as decimal
>separator, how can I change it
>to "." the decimal
>point?

vbScript uses your regional settings for formatting.

Insert the following line in the script before the file is written:

CurrentLocale = SetLocale("en-us")

After the file is written insert the line

SetLocale(CurrentLocale)

You could do away with the CurrentLocale variable if you specifically set the locale back to Spain after writing the file:

SetLocale("es-es")

But I don't recommend it. If you give the script to anyone in another country you will mess up their regional settings! Also bear in mind that if the script crashes in the middle it could leave your regional settings changed.

>And one more question, can I
>have a list of files
>that are in a directory (in
>the current one or in
>any other folder) from inside
>a Mathcad worksheet?
>Thank you again,

Yes, with another scripted component.

Richard




I solved the first problem by using a small program that checks the data matrix and converts to strings of characters all numbers found (these numbers, in mathcad format, have "." as decimal separator). Now, using this array, the file saved with your function have no "," as decimal separator.

Sorry; I have seen your last message when I posted mine, with the solution to the decimal separator issue without script programming.
I have downloaded your GET FILE LIST(3).MCD file and works fine.
Thank you Richard for your help in this.
Regards,
jcg
Top Tags