Open URL in Same Tab - Google Chrome

Can’t seem to get Chrome to open a URL without opening a new tab.
I installed an extension that works if opening a bookmark from within
the app but when I send the url via AppleScript it always
opens in a new tab.

tell application "Chrome"
open location "foobar.com"
end tell

Anyone know of a fix?

Many thanks,

Carl

Hey Carl,

This is happening, because you’re using open location. Open location is part of the internet suite of the StandardAdditions.osax and not part of Chrome’s AppleScript terminology.

It’s doing exactly what it’s meant to do.

To manage the active tab in Chrome you have to talk to it “ something like this:


set theURL to "https://www.google.com"

tell application "Google Chrome"
	tell front window
		set URL of active tab to theURL
	end tell
end tell


Chris


{ MacBookPro6,1 · 2.66 GHz Intel Core i7 · 8GB RAM · OSX 10.11.2 }
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Nailed it. Thanks a bunch!

Carl