Re: Safari, make new document only if none open ?
Re: Safari, make new document only if none open ?
- Subject: Re: Safari, make new document only if none open ?
- From: Jon Pugh <email@hidden>
- Date: Sun, 6 Sep 2009 08:28:41 -0700
At 10:19 AM -0500 9/6/09, Dale Saukerson wrote:
>I want to create a script to do the following:
>1-Open safari if not open
>2-Bring it to front
>3-Open new browser window if none already open
>4-Set window bounds to suite my needs on a 23 inch LCD
>
>I have 1,2 and 4 figured out.
>
>How do I accomplish # 3 ?
property bestBounds : {1, 22, 1181, 1198}
on showURL(u)
tell application "Safari"
make new document at end of documents with properties {URL:u}
set bounds of window 1 to bestBounds
end tell
end showURL
I have a script called "Morning Reading" which opens a bunch of windows, so I don't check for an existing window, I just open a bunch of them and stack them up with a series of showURL calls.
If you want to check, use something like this:
tell app "Safari"
if not (document 1 exists) then
make new document at end of documents with properties {URL:u}
end
end
Good luck.
Jon
_______________________________________________
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