Skip to content

Instantly share code, notes, and snippets.

@knu
Last active June 21, 2022 03:18
Show Gist options
  • Save knu/59d446bacb6f78daa6e70cf049047b0c to your computer and use it in GitHub Desktop.
Save knu/59d446bacb6f78daa6e70cf049047b0c to your computer and use it in GitHub Desktop.
Open a Google Chrome window in a specified profile
if application "Google Chrome" is not running then
tell application "Google Chrome" to activate
end if
tell application "System Events" to tell process "Google Chrome"
set frontmost to true
click (menu item 1 where its name contains "****") of (menu 1 where its name is "プロファイル" or its name is "Profiles") of menu bar 1
end tell
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --profile-directory="$(jq -r --arg name "****" '.profile.info_cache | to_entries[] | select(.value.name == $name) | .key' ~/Library/Application\ Support/Google/Chrome/Local\ State)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment