Skip to content

Instantly share code, notes, and snippets.

@0xBADC0FFEE
Forked from mfilej/Info.plist
Last active May 20, 2020 20:47
Show Gist options
  • Select an option

  • Save 0xBADC0FFEE/19c57eac0b5cb66e0da5ed02e3ada81f to your computer and use it in GitHub Desktop.

Select an option

Save 0xBADC0FFEE/19c57eac0b5cb66e0da5ed02e3ada81f to your computer and use it in GitHub Desktop.

Revisions

  1. 0xBADC0FFEE revised this gist May 20, 2020. 2 changed files with 20 additions and 3 deletions.
    14 changes: 13 additions & 1 deletion _Instructions.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,13 @@
    http://hints.macworld.com/article.php?story=20091013114424722
    http://hints.macworld.com/article.php?story=20091013114424722

    As a prerequisite, you'll need to install the RCDefaultApp preference pane https://github.com/Lord-Kamina/SwiftDefaultApps

    Open AppleScript Editor and paste in content of _Script.scpt

    Save the document using file format Application, and select the Stay Open checkbox. Name it SafariURLHelper. I have an Applications folder in my home directory in which I saved it.
    Using the Finder, navigate to where you saved SafariURLHelper, then Control-click its icon and select Show Package Contents from the contextual menu.
    Inside the Contents folder, find Info.plist, and open it in a text editor.

    Add content of Info.plist to the bottom of the file, just before the closing </dict> and </plist> tags

    If you had already run the script without this improvement, quit it using "Activity Monitor.app". You can also update the saved Helper app in Script Editor without the need to edit the Info.plist again - our changes are preserved.
    9 changes: 7 additions & 2 deletions _Script.scpt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,11 @@
    on open location theURL
    tell application "System Events"
    if (count of windows of process "Safari") = 0 then tell application "Safari" to make new document
    if (count of windows of process "Safari") = 0 then
    tell application "Safari" to make new document
    tell application "Safari" to set the URL of the front document to theURL
    else
    tell application "Safari" to open location theURL
    end if
    end tell
    tell application "Safari" to open location theURL
    tell application "Safari" to activate
    end open location
  2. @mfilej mfilej created this gist Jan 16, 2012.
    16 changes: 16 additions & 0 deletions Info.plist
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    <key>CFBundleIdentifier</key>
    <string>com.apple.AppleScript.SafariURLHelper</string>
    <key>CFBundleURLTypes</key>
    <array>
    <dict>
    <key>CFBundleURLName</key>
    <string>SafariURLHelper</string>
    <key>CFBundleURLSchemes</key>
    <array>
    <string>http</string>
    <string>https</string>
    </array>
    </dict>
    </array>
    <key>NSUIElement</key>
    <true/>
    1 change: 1 addition & 0 deletions _Instructions.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    http://hints.macworld.com/article.php?story=20091013114424722
    6 changes: 6 additions & 0 deletions _Script.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    on open location theURL
    tell application "System Events"
    if (count of windows of process "Safari") = 0 then tell application "Safari" to make new document
    end tell
    tell application "Safari" to open location theURL
    end open location