Re: Open Safari and Script
Re: Open Safari and Script
- Subject: Re: Open Safari and Script
- From: "Nigel Garvey" <email@hidden>
- Date: Sat, 29 Dec 2007 11:34:55 +0000
John Koch wrote on Fri, 28 Dec 2007 22:28:31 -0800:
>Wow don't count your chickens before they hatch....This email below
>looked like it would be right but it gives me an error
>
>
>tell application "Script Editor"
> activate
> make new document
>end tell
>
>tell application "Safari"
> if (count of windows) is greater than 0 then close windows
> tell (make new document) to set URL to "http://www.macscripter.net/"
>end tell
With Safari 2 in Tiger, at least, the result of making a new document is
the reference 'document "Untitled" of application "Safari"' -- that is,
the document is referenced by name. I have Safari configured to open a
certain HTML file in each new document, so that the document name
immediately changes twice to "Loading Home Page" and then "Home Page".
This makes the originally returned reference useless in the rest of the
line. It seems more reliable to use an index reference instead:
tell application "Safari"
if (count of windows) is greater than 0 then close windows
make new document
set URL of document 1 to "http://www.macscripter.net/"
end tell
NG
_______________________________________________
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