Sometime after learning the use of specialfolderpath("resources") and sysError, i have another question please.
Code: Select all
put 4 into CardNumber
repeat with irp = 1 to CardNumber
put specialfolderpath("resources") into PatFil
put "/car" & irp & ".txt" after PatFil
if there is NOT a file PatFil then
answer "Problem " & PatFil & " not present"
else
open file PatFil
if the sysError is not zero then
answer "Problem opening : " & PatFil & " : " & the sysError
else
put 0 into NbLigInFile
repeat until eof
read from file PatFil for 1 line
put it into temp
if temp is empty then
exit repeat
else
add 1 to NbLigInFile
end if
end repeat
answer PatFil & " " & NbLigInFile & " lignes"
end if
close file PatFil
end if
end repeat
Immediately after saving the code of the stack, the FIRST open of the file produces a 22 sysError.
All other opens of the loop ( 4 ) are ok ( sysError = 0 )
Then subsequent runs of the same code without saving it don't produce the error.
You then go to the code and introduce even a blank new line, save and the error shows up again !
I can workaround easily but need to know what i am missing, and the trick doesn't
the workaround i found is issuing
Code: Select all
answer WhateverYouWant
Any help welcome !