automating a task
Dave Cragg
dcragg at lacscentre.co.uk
Mon Apr 12 19:53:22 EDT 2004
At 1:26 pm -0700 12/4/04, Brian E. Warshawsky wrote:
>I've tried:
>repeat forever
>get the time
>if the short system time is 12:00 AM then
>libURLDownloadToFile "ftp://username@password@mysite.com/testing.txt",
>TFlog.txt
>else end if
>
>I've also tried:
>
>repeat forever
>wait 5000 seconds
>libURLDownloadToFile "ftp://username@password@mysite.com/testing.txt",
>TFlog.txt
>
>and:
>if the short system time is 12:00 AM then
>libURLDownloadToFile "ftp://username@password@mysite.com/testing.txt",
>TFlog.txt
>else repeat until the short system time is 12:00 AM
There should be a colon between user name and password in the url:
"ftp://username:password@mysite.com/testing.txt"
I don't think you want to use a "repeat forever" structure for this
kind of thing as nothing else will run in your application. A "send
<message> in <time>" will probably work better. If the download has
to take place approximately every 24 hours, then something like this
might do:
on onceADayDownload
put the seconds into tStart
put url "ftp://username:password@mysite.com/testing.txt" into url
("binfile:" & "tFlog.txt")
send "onceADayDownload" to me in tStart + 24*60*60 seconds
end onceADayDownload
Or to make sure the download takes place between 2:00 and 3:00 a.m.,
send every 30 minutes and check the time.
local lvDoneAlready
on onceADayDownload
put the seconds into tTime
convert tTime to dateItems
if item 4 of tTime is 2 and not lvDoneAlready then
put url "ftp://username:password@mysite.com/testing.txt" into
url ("binfile:" & "tFlog.txt")
## check the result here and log errors if necessary
put true into lvDoneAlready
else
put false into lvDoneAlready
end if
send "onceADayDownload" to me in 30*60 seconds
end onceADayDownload
Cheers
Dave
More information about the use-livecode
mailing list