Jump to content

Change Email 'Use Gmail to Compose..' to use already open Gmail Tab


macdoe
 Share

Recommended Posts

We could use an AppleScript like this for Chrome. I modified this simple script: https://github.com/mobjack/MacChromeCalendarFocus

Still having a little trouble focusing the correct window. If anyone can help on that please let me know what's missing: 

tell application "Google Chrome"
	repeat with w in windows
		set i to 1
		repeat with t in tabs of w
			if URL of t starts with "https://inbox.google.com/" then
				set active tab index of w to i
				set index of w to 1
				tell application "Google Chrome" to activate
				tell application "System Events"
					keystroke "c"
				end tell
				return
			end if
			set i to i + 1
		end repeat
	end repeat
	open location "https://inbox.google.com/"
	tell application "System Events"
		keystroke "c"
	end tell
	
end tell

tell application "Google Chrome" to activate
Link to comment
Share on other sites

  • 3 months later...

Regarding window focus, I think you can usually just tell the window object to activate.

I'm not sure using an existing tab is sensible default behaviour.

If you have multiple Inbox tabs open, unwanted things could happen. Using a new tab/window ensures you don't muck up a user's window.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...