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.
nofile error
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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?
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!
Bob
A humble man and PROUD of it!
It would also be sensible to check for the existance of the file before starting the read with IfFileExists.
MJT Net Support
[email protected]
[email protected]
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.
Thanks for the tip of the file exist check. I'll add that in.
I appreciate the help from both of you.