Follow these instructions to create an AppleScript App that can be used to open URLs, e.g. from Choosy.
- Open Script Editor (in
/Applications/Utilities
). - Write a script with an
on open location
handler (seeexample.applescript
). - Save the script as an application (select "Application" from the file format dropdown in the save dialog in Script Editor).
- Edit the application's
Info.plist
file to add aCFBundleURLTypes
section, indicating it can handle HTTP URLs (seeInfo.plist
). If the app is at~/Applications/MyApp.app
then theInfo.plist
will be at~/Applications/MyApp.app/Contents/Info.plist
. - Test your application from the command line using
open -a ~/Applications/MyApp.app http://www.example.com
- Update the AppleScript to do something useful with the URL (the
do shell script
command might be useful if you want to avoid writing more AppleScript). - ?
- Profit.
For anyone wanting to open in private window you could achieve it by changing script from example to
This trick is taken from https://apple.stackexchange.com/questions/222114/is-it-possible-to-open-a-private-browser-window-in-safari-using-terminal-app
Caveats
delay
adjustment for slower systemsTODO