4

I would like to be able to open a new Chrome window from LaunchBar, which means I have to express the action as an AppleScript or as a shell script / executable program. I tried automator, but it doesn't really work.

So - is it possible? I tried using applescript but things like "make new window at front" don't work...

  • To be clear - the question was asked when Chrome's support for AppleScript was weaker. Now it's easy to do. – Michał Bendowski May 13 '11 at 13:40
11
tell application "/Applications/Google Chrome.app"
    make new window
    activate
end tell
  • You can actually use just 'application "Google Chrome"'. – Michał Bendowski May 13 '11 at 13:39
  • I had first used 'application "Google Chrome"', but that would activate the Parallels/Windows version of Google Chrome. Specifying the full path was the easiest solution of the ones I found. – kipkoan May 17 '11 at 18:08
  • Your answer always saves me everytime I reformat my Mac. =p Thanks again. – sivabudh May 13 '12 at 9:44
1

This AppleScript kind-of works, but it may not open in your current space. :(

I used to open a new Terminal window with a similar version with shortcut keys mapped by FastScripts.

tell application "Chromium" to activate

tell application "System Events"
 tell process "Chromium"
  click menu item "새 창" of menu "파일" of menu bar 1
 end tell
end tell

You should substitute "새 창" and "파일" above with your language's menu labels, and "Chromimum" with "Chrome" if you're not using a snapshot like me.

0

At present the AppleScript support in Chrome is very limited (beyond the standard GUI scripting native to Mac OS X) but is expected to improve in Milestone 5. (Release date unsure) See http://code.google.com/p/chromium/issues/detail?id=27468 for more details.

So at present there is no way to reliably create a new window if Chrome is already running. If it's not running it's easy to use:

tell application "Chrome"
    activate
end tell

or

open /Applications/Chrome.app

Of note running:

open /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome "URL HERE"&

is a great way to get multiple instances of the application running making clobbering your preferences and caches really easy. I don't suggest using this.

-1
tell application "Google Chrome"
    make new window
    open location "your url"
end tell

this is what I have done to open facebook messenger to create a small application in a way for fb messenger

  • This answer does not appear to add anything that the other answers haven't already said. – Burgi Mar 28 '16 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.