Close %ChromeURL% Browser Tab

Is there an easy KM way to do this e.g. a KM Action?

Close %ChromeURL% Browser Tab

Thanks.

I don't believe there's a native KM action for this, but since the %ChromeURL% tab is also the currently active one, this simple AppleScript in an Execute an AppleScript action should do the trick:

tell application "Google Chrome"
	tell front window
		close active tab
	end tell
end tell
2 Likes

Thanks.

I also got this to work:

03

Mine didn't work without the "Activate Chrome" Action first for some reason?

Yes, as you've discovered, the keystroke action doesn't always work on apps in the background. Of course bringing the app to the front and simulating a menu command, either by keystroke or the Select or Show a Menu Item action (which I would recommend over the keystroke, personally) is always an option, but if you want to be able to reliably close the current tab in the background, scripting is the only recourse.

1 Like