I like to open custom URLs, such as "myscheme://a/b/c" from my AppleScript code.

This is not about opening http URLs in a web browser. This is about getting the same result as when you create an .inetloc file in the Finder and then open that file in the Finder, or invoking this code in a macOS app written in ObjC:

[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: @"myscheme://a/b/c"]];
  • With standard/normal AppleScript, open location "Opens a URL with the appropriate program.", other then that, maybe you'll have yo use Cocoa-AppleScript. – user3439894 Aug 1 '17 at 20:38
  • Uh, indeed, open location seems to do the trick. I had searched quite a bit but could not find out about it. Care to turn that into an answer so that I can accept it? And perhaps explain where that's documented? – Thomas Tempelmann Aug 2 '17 at 21:57

If myscheme is properly registered in the Launch Services Database to open a particular application, then you can use the open location command, which: "Opens a URL with the appropriate program."

Use as in the following examples:

set theURL to "myscheme://a/b/c"

open location theURL

Or directly:

open location "myscheme://a/b/c"

Have a look at the AppleScript Language Guide and more specifically, the open location command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .