Don't know how to do this please help.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
WantedMan_

Don't know how to do this please help.

Post by WantedMan_ » Fri Dec 03, 2004 5:03 pm

lets say that I have a txt file that has this in it 335.98, 2621.98, 96.1529, 21.9061 now obviously they are seperated by a comma. I need a script to read the line (which I know how to do) but then I need to be able to seperate the numbers into variables.. ie.. AmountOfMoney=335.98 so I can call %AmountOfMoney% elsewhere and that variable would =335.98

thanks..

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Dec 03, 2004 5:25 pm

Use ReadLn to get the line from the file and Separate to split the line into separate variables.


ReadLn>filename,linenumber,line
Let>delim=,
Separate>line,delim,fields


You now have fields_1, fields_2, fields_3 etc containing each portion.

You probably want this in a loop to read each line one by one? In which case something like this:


Let>delim=,
Let>k=1
Label>start
ReadLn>filename,k,line
If>line=##EOF##,finish
Separate>line,delim,fields
bla bla
Let>k=k+1
Goto>start
Label>finish


See example in help file upon which this is based.
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts