nofile error

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
river10
Newbie
Posts: 5
Joined: Tue Oct 28, 2003 4:03 pm

nofile error

Post by river10 » Mon Dec 08, 2003 12:35 am

Hello,

I'm creating a script that involves reading a file. The odd thing is that sometimes the file will work, and then when I rerun it, it will give me an error in the message that says "##NOFILE##" and continuously loop without giving me any chance to close it. It takes over the entire system and the only way to get access is to restart the computer.

I went through it line by line in the debugger and it works fine in there.

Here is the code:

Let>k=1
Label>start
ReadLn>c:\downloads\macrotemp\test.txt,k,line
If>%line%=##EOF##,finish
Let>display=Hello World! %line%
Message>%display%
Let>k=k+1
Goto>start
Label>finish


The file does exist and I have been able to get the same script to read from it. not sure why i sometimes doesn't read it and locks up the computer.

thanks.

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 » Mon Dec 08, 2003 2:58 am

Wondering if you might be fighting a race condition?

Suppose you change Message> to MessageModal>. Do you get missing file message then?

Perhaps add a Wait>1 after incrementing the k-counter, before jumping back to start?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by support » Mon Dec 08, 2003 9:44 am

It would also be sensible to check for the existance of the file before starting the read with IfFileExists.
MJT Net Support
[email protected]

river10
Newbie
Posts: 5
Joined: Tue Oct 28, 2003 4:03 pm

Post by river10 » Mon Dec 08, 2003 5:32 pm

I've gotten the script to work now. I went to the bottom and just pressed delete to make sure there were not blank characters. I didn't see any there with "Show Hidden Characters", but i just clicked delete anyway to move the cursor to the last character and now it seems to be working fine.

Thanks for the tip of the file exist check. I'll add that in.

I appreciate the help from both of you.

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