something simple

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
IXIS

something simple

Post by IXIS » Tue Oct 05, 2004 4:32 pm

Hello,

I have something wrong that I know is so simple... anyone feel like helping out? I had this working last night, made a minor change, and now it's not working again. Here it goes though...

Readln>c:\test\hit_time.txt,1,time
Let>start=time-3
Let>end=time+3
Message>start time is %start% and end time is %end%

ok.. the script above needs to read a time stamp from a txt file, then subtract 3 to create a value for the variable "start", then add 3 to create a value for the variable "end". I keep getting the value back as "time-3" instead of 12:16

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

Post by support » Tue Oct 05, 2004 6:15 pm

Looks like you're not getting a value from the text file. In the editor open up the watch list and step through the script with debug to see what value time is set to. Or add the following line after the ReadLn line:

MessageModal>time

In any case you won't be able to add or subtract using Let if time is a string. If it is a valid date/time then you can use Add and Sub. Most likely it is a string and you will need to retrieve the hour and minute parts of the time and manipulate that way, or, preferably, use the VBScript time functions.
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Oct 05, 2004 8:57 pm

Dont's know format of what is in hit_time.txt, but have you tried this:
Readln>c:\test\hit_time.txt,1,time
Let>start=%time%-3
Let>end=%time%+3
Message>start time is %start% and end time is %end%
Also make sure you have removed all Trailing Spaces.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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