The volumes returns a linefeed-delimited list. You need to make a repeat structure that, with each loop, takes a line from the list and puts it, together with "/My File.txt" into a variable. You can use this variable with the open command.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
on mouseUp
repeat for each line theVolume in the volumes
put theVolume & "/Test.txt" into tfile
if there is a file tfile then
answer "Found"
end if
end mouseUp
But it doesn't work.
Again, if I try to make that file by this script -
repeat for each line myLine in myList
-- do everything between repeat and end repeat
-- many times
end repeat
Do your scripts work, if you close the repeat loops correctly?
Best regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Hi Mark,
Thanks for your reply and sorry to say I forgot to write "end repeat" in this forum but it was in my script and having it, I couldn't check that file using the second code and couldn't make that file using the third code.
Hi everybody,
Its a ling time nobody takes a response for my problem. I repeated my problem again - I want to check a text file in all of my volumes. To do this, I've made a script for a btn -
on mouseUp
repeat for each line theVolume in the volumes
put theVolume & "/Test.txt" into tfile
if there is a file tfile then
answer "Found"
end if
end repeat
end mouseUp
But having the text file in some of my volumes, it doesnt show the message. Why ????????????
did you actually look at the value of the volumes?
In the messagebox:
put the volumes
What do you get there? Are all your drives listed in there? Are you logged in with permissions to write to / read from all drives?
Your script looks just fine to me. If it does not answer it is either, because the file is not there (you could check that with an else statement after your answer command) or because an error occured (check the result instead of it. If the result is not empty, something went wrong) and see what you got there.
Hi malte,
Thanks for your reply. After getting your reply, I made another btn with a new stack and then put my script into it. It works nicely. I think my old stack had one or more problems.