• 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: Open Safari in fullscreen and hide toolbar script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Open Safari in fullscreen and hide toolbar script


  • Subject: Re: Open Safari in fullscreen and hide toolbar script
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 01 Aug 2015 00:49:31 -0500

open location "http://www.google.com"
______________________________________________________________________

Open Location should not be used with Safari as part of a tell-block.  It's from the Standard Additions osax and is a way of routing a URL to the default application for its type.

Since we already know we're using Safari the canonical method of opening a URL in a new window is:

----------------------------------------------------------------
tell application "Safari"
  make new document with properties {URL:"http://www.google.com"}
end tell
----------------------------------------------------------------

For a little smoother experience I'd do something like this instead of closing all windows:

----------------------------------------------------------------
tell application "Safari"
  activate

  

  tell front window
    set URL of its document to "http://www.google.com"
    close (tabs whose index is not 1)
  end tell

  

  close (windows whose index is not 1)

  

end tell
----------------------------------------------------------------

--
Best Regards,
Chris

 _______________________________________________
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: 
 >Re: Open Safari in fullscreen and hide toolbar script (From: "Ball, Dan" <email@hidden>)
 >Re: Open Safari in fullscreen and hide toolbar script (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: Open Safari in fullscreen and hide toolbar script
  • Previous by thread: Re: Open Safari in fullscreen and hide toolbar script
  • Next by thread: Re: Open Safari in fullscreen and hide toolbar script
  • Index(es):
    • Date
    • Thread