Orion Web Browser: Getting URL or Title via Applescript

I have just been trying the newly released Version 0.99.124-beta (WebKit 616.1.10) of Orion. I find it is now (or "by now" if I missed something before..?) possible to get the url and title for the current tab using Applescript, using something like these simple scripts. Put either one in an Execute Applescript action and choose what to do with the result using the result menu.

Get URL of Current Tab

tell application "Orion"
	set siteURL to URL of current tab of window 1
end tell

Get Title of Current Tab

tell application "Orion"
	set siteTitle to name of current tab of window 1
end tell

A simple combination of the above:

tell application "Orion"
	set siteTitle to name of current tab of window 1
	set siteURL to URL of current tab of window 1
end tell

return siteTitle & ": " & siteURL

Yes, those elements can be used in any way one chooses, in scripts and macros, and that's a neat combined format. I currently mostly use the format [Title](URL), to render markdown links, but I also often need the URL on its own.

If Orion is compatible with Chrome, then the FrontBrowserURL and FrontBrowserTitle tokens should work.

1 Like

FWIW this macro includes copying link and title from Orion (and other apps), creating 3 pasteboard items:

  • Plain text MD [label](url)
  • RTF for pasting a live labelled link into Text Editor, MS Word etc
  • Bike XML for pasting a live labelled link into Jesse Grosjean's Bike outliner.

The latest version (download with green Code button) is always at:

GitHub - RobTrew/copy-as-md-link: macOS Keyboard Maestro macro group – single keystroke to copy MD links from different applications.

PS as you know the difference between the WebKit and Chrome osascript interfaces turns on a single difference: currentTabactiveTab, so given a bundle id for the browser, we might write (in a JavaScript rather than AppleScript idiom of osascript), for example:

Expand disclosure triangle to view JS source
(() => {
    "use strict";

    // Rob Trew @2023

    const main = () =>
        either(x => x)(x => x)(

    // ------------------ BROWSER LINKS ------------------

    // browserLinkLR :: String -> Either String IO String
    const browserLinkLR = bundleID => {
        const w = Application(bundleID).windows.at(0);

        return w.exists()
            ? w.tabs.at(0).exists() ? (() => {
                    tab = w[
                        ? "currentTab"
                        : "activeTab"

                return Right(
            })() : Left(
                `No open tabs in front window of ${bundleID}`
            : Left(`No windows open in ${bundleID}`);

    // --------------------- GENERIC ---------------------

    // Left :: a -> Either a b
    const Left = x => ({
        type: "Either",
        Left: x

    // Right :: b -> Either a b
    const Right = x => ({
        type: "Either",
        Right: x

    // either :: (a -> c) -> (b -> c) -> Either a b -> c
    const either = fl =>
        // Application of the function fl to the
        // contents of any Left value in e, or
        // the application of fr to its Right value.
        fr => e => e.Left ? (
        ) : fr(e.Right);

    return main();

It is based on WebKit, so those tokens do not work.

Further to your post from May 2022 about what may be possible, I would expect the relevant parts of Orion's Applescript dictionary to now be a usably close match to Safari's, but I am not qualifed to say.

This reply is to pass on information and I am not badgering you to work on tokens. :wink:

Those tokens also work with Safari, they aren't Chrome-specific. So if they don't work with Orion then its AS implementation may not be as usably close as hoped.

Although I'm surprised, given your AS scripts in the OP.