• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Safari, make new document only if none open ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Safari, make new document only if none open ? (From: Dale Saukerson <email@hidden>)

  • Prev by Date: Re: date/Snow Leopard changed
  • Next by Date: Re: date/Snow Leopard changed
  • Previous by thread: Safari, make new document only if none open ?
  • Next by thread: Re: Safari, make new document only if none open ?
  • Index(es):
    • Date
    • Thread