Reply to 'To .jpg or not'.
Reply to 'To .jpg or not'.
- Subject: Reply to 'To .jpg or not'.
- From: email@hidden
- Date: Fri, 19 Mar 2004 19:48:34 -0500
01. I am sure you meant 'theUrl' in the 'download URL heUrl to (the
File) replacing yes' Line.
02. Using the posted Code with 'theUrl' in the 'download ... yes'
Line, with / without '.jpg' appended to the '(((path to desktop
folder) ... test' Text always resulted with the 'Sorry, couldn't
download the webpage' Dialog Box Message here.
03. The Line 'download ... replacing yes' Line was replaced with
'download theUrl to file specification theFile replacing yes', as in
the Code presented below, which works whether or not '.jpg' is
appended to '(((path to desktop folder) ... test'. Also, I used a
Dilbert Sunday Comic as the Test URL Address.
----- Code starts here -----
tell application "Finder"
set theUrl to
"
http://www.dilbert.com/comics/dilbert/archive/images/dilbert2004031348584.jpg"
-- "
http://webaddress.jpg"
set theFile to (((path to desktop folder) as text) & "test:test.jpg")
end tell
tell application "URL Access Scripting"
with timeout of 60 seconds
try
download theUrl to file specification theFile replacing yes
display dialog "Download Successful" with icon note
on error
display dialog "Sorry, couldn't download the webpage" with icon 2
end try
end timeout
end tell
----- Code ends here -----
System: dual 500 MHz G4 PPC PM, 1 GB RAM, >200 GB internal Storage,
MacOS X 10.3.3 with System 9.2.2.
Please note:
The above Code was executed via 'Script Editor' in 'Classic' and then
after the Mac was rebooted into System 9.2.2. Each Time the Code
worked as expected.
At least here - without 'file specification' added to the 'download
theUrl ... yes' Line neither in Classic or System 9.2.2 was the URL
'.jpg' File downloaded.
If you decide to do the above Code in MacOS X then consider the following Code.
----- Code starts here -----
tell application "Finder"
set theUrl to
"
http://www.dilbert.com/comics/dilbert/archive/images/dilbert2004031348584.jpg"
set theFile to "~/Desktop/test/test.jpg"
end tell
with timeout of 60 seconds
try
do shell script ("curl -A/--user-agent " & theUrl & ">> " & theFile)
display dialog "Download Successful" with icon note
on error
display dialog "Sorry, couldn't download the webpage" with icon 2
end try
end timeout
----- Code ends here -----
--
SJWL
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.