Skip to main content
1-Visitor
April 5, 2010
Question

Component for save data files

  • April 5, 2010
  • 1 reply
  • 2893 views
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.


1 reply

19-Tanzanite
April 5, 2010
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
uscqfjcg1-VisitorAuthor
1-Visitor
April 6, 2010
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
19-Tanzanite
April 6, 2010
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