Economy-x-Talk - Sample Scripts
Download with AS 2
A slightly better download, it seems. If there is not internet connection, you quickly get the correct error message.
[MS]
on downLoad()
--This script is based on Apple's documentation¬
--included with URL Access Scripting as
--included in the AppleScript Guide Book.
--This stack is for non-commercial use only and¬
-- may be freely distributed for non-commercial purposes.
--set the variables before using the "tell" statement
set the item_name to variable "localFileName"
set this_URL to variable "theURL"
set the local_filepath to ¬
((path to desktop folder as text) ¬
& variable "localFileName")
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,
--which means that you have to check the name¬
-- of your own version.
download this_URL to file local_filepath ¬
replacing yes with progress and unpacking
end tell
end timeout
--now the error checking:
on error error_message number errNr
if errNr is -3205 then
--no connection
beep
tell application "URL Access scripting" to quit
display dialog ¬
("Please, make sure that you're on-line.") ¬
buttons {"OK"} default button 1
else
copy errNr as text to errTxt
beep
display dialog ("Error number: " & (errTxt) & ¬
return & return & ¬
error_message) buttons {"OK"} default button 1
end if
end try
--quit if not already done so
try
tell application "URL Access scripting" to quit
end try
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.