Search code examples
applescriptalfred

Opening a new Safari window with Alfred AppleScript opens 2 windows


When I run this script from Alfred (using the text "nsafari", and Safari is quit (not in the dock), two Safari windows will pop up. When I run it from the Script Editor, it will sometimes open up two windows, but sometimes not. (This also happens with my new Safari window script as well).

if application "Safari" is running then
    tell application "Safari"
        make new document
        activate
    end tell
else
    tell application "Safari" to activate
end if

Why does it open two windows only from Afred? And how do I make it only create one?


Solution

  • I don't know why, but after two years, the problem I reported above does not seem to happen any more...

    (and yes this is not a very satisfying answer)