Re: Safari - downloading an image
Re: Safari - downloading an image
- Subject: Re: Safari - downloading an image
- From: "Gary (Lists)" <email@hidden>
- Date: Mon, 22 Aug 2005 06:17:42 -0400
"Christopher Stone" wrote:
> Hey Folks,
>
> In Internet Explorer we used to be able to use the 'OpenURL' event with a
> file specifier to script the downloading of various items.
>
> Presently I see no means of making Safari do the same thing or to simply
> initiate a download of a specific image/file to the downloads folder.
>
> Am I missing something?
>
> Is there perhaps a Javascript to do this?
>
> I could always shell out to curl or wget, but it'd be much more elegant
> if I could get Safari to do it.
Working backward...
I think people tend to use the word "elegant" when writing about programming
when they often mean "easier"...which often isn't.
"Elegance" in the sense of an algorithm (equation, program, process) usually
means "simplest" or "most direct", or a combination of those qualities and
some other known-when-seen "oh, yeah!" factor.
In fact, to suggest that you even need Safari, inside an AppleScript, to do
a download is anti-elegance, by definition. Safari (or any browser) is a
totally specious introduction into the process for programmatically
downloading a file.
To suggest JavaScript as being "more elegant" than 'curl' (whose only
purpose in life is downloading things, give or take) seems an equally
in-elegant choice.
How about this for my stab at sans shell elegance, using only AppleScript
(but made inelegant because I've tried to avoid line wrapping in the
email...this could be one line):
-- 3-Lines-That-Could-Be-1
-- OSX.3.9
set theURL to "http://applemods.sourceforge.net/images/at_man.gif"
set out_ to (path to desktop as string) & "test.gif"
tell app "URL Access Scripting" to download theURL to out_
If you want real elegance, use 'curl'...it's __much__ faster!
--
Gary
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden