Open a URL in Chrome Canary as incognito I am currently using this Automator AppleScript to create a service to open a URL using Chrome Canary in incognito mode

on run {input}
    set theURL to input
    if application "Google Chrome Canary" is running then
        tell application "Google Chrome Canary" to make new window with properties {mode:"incognito"}
    else
        do shell script "open -a /Applications/Google\\ Chrome\\ Canary.app --args {URL:theURL} --incognito"
    end if

    tell application "Google Chrome Canary" to activate
end run


Google Chrome Canary will launch with a new window, but the URL does not load. What am I missing?

Thank you.
I do not have Google Chrome Canary installed but I do have Google Chrome installed and because you've not shown how on run {input} is actually receiving its input, what I'm presenting is being done in AppleScript Editor however you should be able to translate it to your use with Google Chrome Canary in Automator.

The following AppleScript code examples do what it is you're trying to do albeit in Google Chrome not Google Chrome Canary however change instances of Google Chrome to Google Chrome Canary as applicable and it should work as the examples do work as tested.

This first example uses the do shell script command in the else block:

set theURL to "http://apple.stackexchange.com/questions/270413/open-a-url-in-chrome-canary-as-incognito"

if application "Google Chrome" is running then
    tell application "Google Chrome"
        activate
        make new window with properties {mode:"incognito"}
        open location theURL
    end tell
else
    do shell script "open -a 'Google Chrome' --args --incognito " &amp; quoted form of theURL
end if

tell application "Google Chrome" to activate


Note: When used in a Run AppleScript action in Automator you may not need to use quoted form of with theURL, so the last part of the do shell script command will in that case just be: &amp; theURL



This second example forgoes the use of the do shell script command in the else block:

set theURL to "http://apple.stackexchange.com/questions/270413/open-a-url-in-chrome-canary-as-incognito"

if application "Google Chrome" is running then
    tell application "Google Chrome"
        activate
        make new window with properties {mode:"incognito"}
        open location theURL
    end tell
else
    tell application "Google Chrome"
        activate
        -- close window 1   # Uncomment this line if you want the normal window that opens first to be closed.
        make new window with properties {mode:"incognito"}
        open location theURL
    end tell
end if