I'm using Google Chrome, and I've got two different "profiles" in the People section. The one that's activated has a checkmark in front of it. What I'm trying to do, is create a shortkey to toggle between these two profiles. For example, if profile 1 is activated, when I press the shortkey, it should activate profile 2. Vice versa, the same applies.
Triggering a menu bar item by name works, though then, it doesn't act as a toggle, but merely as an activator. I've also tried using an Apple Script, which in the end should work. I'm posting this question to see if anyone has a different / better idea.
Reader button in Safari for Touch Bar?
Based on this script from @yuuiko you should be able to achieve what you aim for
Awesome, thanks for the pointer @Caliguvara. This is the final AppleScript that I created to toggle between Google Chrome profiles:
tell application "System Events"
tell application process "Google Chrome"
set personalProfile to value of attribute "AXMenuItemMarkChar" of menu item "Personal" of menu "People" of menu bar item "People" of menu bar 1
if personalProfile is "✓" then
click menu item "Work" of menu "People" of menu bar item "People" of menu bar 1
click menu item "Personal" of menu "People" of menu bar item "People" of menu bar 1
return "An error occurred while trying to switch Chrome profiles."