Re: curl equivalence
Re: curl equivalence
- Subject: Re: curl equivalence
- From: kai <email@hidden>
- Date: Thu, 27 Oct 2005 00:06:07 +0100
On 26 Oct 2005, at 05:16, John R. wrote:
Thanks for the response - comments below
on Wed, 26 Oct 2005 00:48:25 kai wrote
Doesn't this do about the same thing, John?
to getHTML from myURL
tell application "Safari" to tell document 1
set URL to myURL
repeat 40 times
if URL is myURL then return source
delay 0.5
end repeat
end tell
error "Oops - problem accessing internet..."
end GetHTML
getHTML from "http://www.apple.com/"
I thought so too at an early, naive stage in my journey, but...
(1) Websites often redirect to different URLs, and the resulting
URL can include unknowns like, say, a session ID#.
(2) If you poll the Safari's URL property too soon, it never starts
at all!
Fair enough. Apple's home page obviously doesn't exemplify
redirection too well. ;-)
Another relatively simple approach using Safari (with due deference
to the various comments already made on this subject) might be
something like:
----------
to getHTML from tgtURL
set pageLoading to false
tell application "Safari"
if not (exists document 1) then make new document
tell document 1
set URL to tgtURL
repeat 100 times
if pageLoading then
if name does not start with "Loading" then
return source
else
set pageLoading to name starts with "Loading"
end if
delay 0.2
end repeat
end tell
end tell
error "Failed to open page."
end getHTML
getHTML from "http://www.apple.com/"
----------
---
kai
_______________________________________________
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