RE: AppleScript and Safari
RE: AppleScript and Safari
- Subject: RE: AppleScript and Safari
- From: Doug McNutt <email@hidden>
- Date: Tue, 9 Nov 2004 17:15:11 -0700
At 14:50 -0500 11/9/04, Steve Suranie wrote:
>Hey Paul or other more intelligent than me folks:
>curl -O http://www.nytimes.com/services/xml/rss/nyt/Opinion.xml
>but when I put in an AS it doesn't work:
>do shell script "curl -O http://www.nytimes.com/services/xml/rss/nyt/Opinion.xml"
The -O (capital O) switch causes curl to place the file in the current working directory with the same name it has on the remote source. The problem is that Do Shell Script enters sh - really bash - with no setup of your login defaults. The cd command is needed.
You can get multiple commands in one call using the semicolon separator but it does get painful.
do shell script "cd $HOME/Documents ; curl -O http://www.nytimes.com/services/xml/rss/nyt/Opinion.xml" -- (no line breaks here)
You can also use the -o (small o) switch and give curl a full path for its output but you'll have to create the name yourself.
do shell script "curl -o $HOME/Documents/Opinion.xml http://www.nytimes.com/services/xml/rss/nyt/Opinion.xml" -- (or here either)
Multiple Do Shell Script commands in a single AppleScript will not remember what was done in an earlier call. <rant> They do in a BBEdit Worksheet and they did in MPW </rant>
What I usually do is to create a shell script with all the commands I need, start it with a shebang line pointing to tcsh, give it x permissions, and use the Do Shell script command to execute it. That way you get your .tcshrc script executed. You can also write diagnostics to a log file to help in debugging.
There is an app note on do shell script by C Nebel. Someone has the URL for it.
--
--> There are 10 kinds of people: those who understand binary, and those who don't <--
_______________________________________________
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