Applescript Launching Program Help

Discussion in 'Mac Programming' started by Campbell.Martin, Oct 9, 2010.

  1. macrumors newbie

    Oct 9, 2010
    so im trying to write a script that will open a new window in safari, seems simple enough but if the app is closed then it opens 2 windows at the launch.
    is there a way to get round this?

    by the way this is what i have now which causes the double window problem, im pretty new to applescripts so any help will be great

    set inactive to false
    tell application "Safari"
    if inactive then activate
    if not inactive then make new document
    end tell
  2. macrumors 604

    Aug 9, 2009
    Ask Safari for all its open documents.
    Only open a window if the list is empty.
  3. thread starter macrumors newbie

    Oct 9, 2010
    how would i do that exactly?
    sorry, but im new to applescripts.

Share This Page