End of variable created with ReadFile

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
tony_smith
Pro Scripter
Posts: 70
Joined: Wed May 14, 2003 8:25 pm
Location: Vancouver BC Canada

End of variable created with ReadFile

Post by tony_smith » Thu Feb 24, 2005 5:29 pm

I am using ReadFile and Position to cut and paste parts of a file into another file.

I have been unable to find a way to stop the search at the end of the variable. The Position command wraps around to the beginning, rather than stopping at the end. I can find the end of the variable using the Length command, but the source file (Variable) contains several nested loops of data (It is straight ASCII) so it is difficult to establish an end point.

Is there an equivalent to ##EOF## for ReadFile?

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

Post by support » Thu Feb 24, 2005 5:50 pm

Why not add your own marker using:

Let>EOF=~END~
ReadFile>filename,variable
Let>variable=%variable%%EOF%

Now you just wait until you find your EOF marker. You could of course use any character or combination of characters, preferably ones you know aren't in the file already.
MJT Net Support
[email protected]

User avatar
tony_smith
Pro Scripter
Posts: 70
Joined: Wed May 14, 2003 8:25 pm
Location: Vancouver BC Canada

Post by tony_smith » Fri Feb 25, 2005 10:20 pm

How obvious! :oops:

Works fine

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