How use the url command in a loop ?
I want to get a lot of web page which an url like this : http://domain.com/page.php?ID=88
I just need to change the number of ID to get all pages.
But it's seem that the loop is too fast to get the info, even with a "load" command.
I try with this script :
on mouseup repeat with n=1 to 810 put "http://domain.com/page.php?ID="&n into turl load url turl put n&&the urlstatus of turl&cr after msg if the urlstatus of turl = "cached" then downloadcomplete end repeat end mouseup
on downloadcomplete -- do my stuff unload url turl end downloadcomplete
How do my stuff after the url is really cached ?
Instead of "load url" in this case, you could use "get url". This will ensure the script blocks until the url has been "got".
on mouseup repeat with n=1 to 810 put "http://domain.com/page.php?ID="&n into turl get url turl if the result is empty then ## do stuff with "it" here else ## handle error here end if end repeat end mouseup
"load url" is useful when you want to cache the url and access it later, or when you don't want your script to block while the data is downloaded. Neither seems to be the case here so "get url" is probably easier.
When using "load url", you need to use "with message" if you need to know when the url has finished loading. Something like this:
on mouseup repeat with n=1 to 810 put "http://domain.com/page.php?ID="&n into turl load url turl with message "downloadcomplete"
end repeat end mouseup
on downloadcomplete pUrl, pStatus if pStatus is "cached" then -- do my stuff else -- handle error end if unload url pUrl end downloadcomplete
Cheers Dave _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution