Economy-x-Talk - Sample Scripts
Download with URL Access
This script downloads a picture from the internet and has some error handling.
You'll have to change the url's in the script as appropriate. If you don't do this, you'll get some error messages.
You may have to remove the dash from the application name "URL Access-scripting", depending on your localised MacOS version.
on download()
set the item_name to "self.gif"
set the parent_directory to "http://huizen.dds.nl/~marksch/"
set this_URL to (the parent_directory & the item_name)
set the local_filepath to ((path to desktop folder as text) & the item_name)
set the timeout_amount to 1800 --30 seconds
try
with timeout of timeout_amount seconds
tell application "URL Access scripting"
--URL Access-Scripting might have a different name in
--any different language and on any different System.
download this_URL to file local_filepath ¬
replacing yes with progress and unpacking
end tell
end timeout
on error error_message number error_number
if the error_number is -3205 then
tell application "URL Access scripting" to quit
tell application "HyperCard" --(path to frontmost application as text)
display dialog ("Please, make sure that you're on-line.") buttons {"OK"} default button 1 giving up after 15
end tell
else if the error_number is not -128 then
tell application (path to frontmost application as text)
display dialog ("Error number: " & (error_number as text) & ¬
return & return & ¬
error_message) buttons {"OK"} default button 1 giving up after 15
end tell
end if
end try
if the error_number is not -3205 then tell application "URL Access scripting" to quit
end download
Keep this extensive resource of tutorials and samples on-line! Support RunRev.info!
| Yes, this script is useful. I make a donation and choose freely how much I want to donate on-line (PayPal). Click here if you want to make a donation in dollars. | This script has not (completely) solved my problem and I want Economy-x-Talk to take care of it. Let me contact you. |
Copyright©2002-2008 by Mark Schonewille, Nijmegen, the Netherlands. This web site is in no way affiliated with Runtime Revolution Ltd., but we do recommend the Revolution development platform.