| Yoko http://forum.yoko.com.ua/ |
|
| Another question http://forum.yoko.com.ua/viewtopic.php?f=3&t=3953 |
Page 1 of 1 |
| Author: | Gautman [ 2005-05-09 00:07:43 ] |
| Post subject: | Another question |
I am working on this script to macro my carpentry skill. The script works but there remain a little problem : Code: sub main() When the script arrives at the end of the following code, it returns a parse error and stop. I absolutely don't know why. Does a file can't be opened twice in one script ? Code: If f.EOF() Then |
|
| Author: | Beyonder [ 2005-05-09 08:59:33 ] |
| Post subject: | |
Hmm... i can see repeat on beginning but i can see no until. File can be opened as much as you want, but every time you open it it must be closed before opened again. |
|
| Author: | Gautman [ 2005-05-09 15:12:53 ] |
| Post subject: | |
Oups, using repeat as a label wasn't a good idea But it doesn't work, I got an "runtime error, invalid file" when it come back at the "f.Open()" instruction... |
|
| Author: | Beyonder [ 2005-05-09 16:51:28 ] |
| Post subject: | |
Problem is that you should use abslute path to the file. Like "C:\Test.txt". |
|
| Author: | Gautman [ 2005-05-09 18:12:58 ] |
| Post subject: | |
I didn't explained the problem well... The script works prefectly one time, but when arrived at the end of file and coming back at the begining, its hangs on the f.open() instruction and send the "runtime error, invalid file". However, i'm sure that the f.close() instruction has been executed. I've tried to modify the path to an absolute or relative, it changed nothing. |
|
| Author: | Beyonder [ 2005-05-09 18:29:37 ] |
| Post subject: | |
Try this way: Code: var f I mean to put f=file('filename') definition into the loop. |
|
| Author: | Beyonder [ 2005-05-09 18:30:58 ] |
| Post subject: | |
And, btw, why do you read that file every loop? Cant you read it once into the array and then use it? I think it would be much easyer and give your hard drive a little more rest |
|
| Author: | Gautman [ 2005-05-10 02:20:28 ] |
| Post subject: | |
I want to loop because the file is kinda short and I want the script running 24/7/365 But your previous answer was right, It now works perfectly. Thanks for your help ! |
|
| Author: | Beyonder [ 2005-05-10 07:45:48 ] |
| Post subject: | |
I didnt mean about the looping, i meant about the reading from file. Cant you do it like this: Code: dim ArrX[100],ArrY[100] I think it would work maybe a little bit faster after that ;D. |
|
| Author: | Gautman [ 2005-05-10 15:04:02 ] |
| Post subject: | |
I never used arrays before, but I will try. Thanks |
|
| Page 1 of 1 | All times are UTC+02:00 |
| Powered by phpBB® Forum Software © phpBB Limited https://www.phpbb.com/ |
|