• 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: Find whether Safari is active or not
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find whether Safari is active or not


  • Subject: Re: Find whether Safari is active or not
  • From: Joe <email@hidden>
  • Date: Thu, 16 Jul 2009 09:03:37 -0700

At 5:11 AM -0600 7/16/09, Sutapalli Satyanarayana wrote:
>I am struck with simple script.
>I am opening Safari on Leapord using script as following:
>
>tell application "Safari"
>activate
>--open some url
>end tell
>
>Its working fine. But the problem is that if Safari is already opened and showing some webpage, its over writing in same window/tab of Safari.
>What I want is that if Safari is already running, I want to create a new tab and open url in that. If Safari is not running, I just want to launch it and open the URL in first window (not in a new tab).

Something along this line should work.

tell application "Safari"
 if exists window 1 then
  make new tab at end of tabs of window 1 with properties {URL:theURL}
 else
  open location theURL
 end if
end tell

HTH
Joe
 _______________________________________________
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: 
 >What AppleScript Can Do For Me? (From: James Bensley <email@hidden>)
 >Re: What AppleScript Can Do For Me? (From: Philip Aker <email@hidden>)
 >Find whether Safari is active or not (From: "Sutapalli Satyanarayana" <email@hidden>)

  • Prev by Date: Re: What AppleScript Can Do For Me?
  • Next by Date: Re: open for access file
  • Previous by thread: Re: Find whether Safari is active or not
  • Next by thread: Re: What AppleScript Can Do For Me?
  • Index(es):
    • Date
    • Thread