I seem to have come across some very odd behaviour and can't work out how to fix it - or even find a useful workaround.
I am trying to get the contents of a file via FTP, yet strangely I can make it work only if I launch an entirely irrelevant dialog box before the put command (I found this by accident while debugging).
So, running with the first card when the stack opens, the following does not work (it produces no error but the field DataFromServer remains empty):
Code: Select all
on openCard
put "ftp://myUsername:myPassword@myIPAddress/myFilename.txt" into myURL
try
put URL myURL into field "DataFromServer"
catch error theError
answer "ERROR:" && theError
end try
end openCard
Code: Select all
on openCard
answer "Hello world!"
put "ftp://myUsername:myPassword@myIPAddress/myFilename.txt" into myURL
try
put URL myURL into field "DataFromServer"
catch error theError
answer "ERROR:" && theError
end try
end openCard
I've tried it with an HTTP URL, and the first version works fine.
In the development environment, I can also make the first version work by closing the stack (keeping it in memory) and reopening.
Any help would be most gratefully received!