Re: Wget response
Re: Wget response
- Subject: Re: Wget response
- From: Axel Luttgens <email@hidden>
- Date: Fri, 28 Sep 2007 16:19:33 +0200
On 28/09/07 14:44, Jay Louvion wrote:
How can I get a server¹s response when I use a ³do shell² in Applesctipt
using the wget command and that the result, in the Terminal, looks a bit
like this:
[...]
HTTP request sent, awaiting response... 200 OK
Length: 2,297 [text/xml]
100%[====================================>] 2,297 --.--K/s
14:37:35 (12.10 MB/s) - `shopdesc?shop=12205' saved [2297/2297]
A file is saved to the root of the computer if this works, but the do
shell
in the Script Editor just returns ³² whatever the outcome.
Is there a way to simply know if it worked or not ?
Hello Jay,
It's a long time ago I haven't put my hands on wget anymore.
I guess it should return with a non zero error code in case of failure,
in which case "do shell script" will error itself with that error code;
a job for "try... on error... end try" thus.
You may want to have a look at:
<http://developer.apple.com/technotes/tn2002/tn2065.html>
for more info about how "do shell script" behaves in case of error.
Now, it is possible that some failures occur and yet have wget return
cleanly, without an error condition; this depends entirely on how wget
is written.
If this is true, you would then want not only to make use of the try...
on error... end try" construct, but also to perform some parsing of the
string returned by "do shell script" (which is just wathever wget writes
on stdout).
And, if you allow...
Why don't you use curl, which comes standard with Mac OS X since Panther
(and perhaps Jaguar)? Unless I'm wrong, it could prove more friendly, by
a suitable choice of options, to "do shell script".
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden