I've been messing around but can't figure this out. Is it even possible?
I want to automate a task where it will:
Open a specific Google Chrome profile.
Run a specific command from an extension.
I tried playing around with this script
set myURLs to {"https://www.google.com", ¬
"https://www.news.google.com", ¬
"https://apple.stackexchange.com"}
set myProfiles to {"Default", "Profile 1"}
repeat with aProfile in myProfiles
do shell script "open -na 'Google Chrome' --args --profile-directory=" & aProfile's quoted form
delay 1
tell application "Google Chrome"
activate
tell front window
set URL of active tab to first item of myURLs
delay 0.5
repeat with i from 2 to count of myURLs
make new tab at after (get active tab) with properties {URL:item i of myURLs}
delay 0.5
end repeat
set active tab index to 1
end tell
end tell
delay 1
end repeat
I can't seem to find a way though to make it just open a chrome profile.
any tips?
thank you
====
Update:
Anyone? I've been trying with this script:
tell application "Google Chrome"
activate
delay 0.3
end tell
tell application "System Events"
tell process "Google Chrome"
tell group "Extensions"
tell button "Layout Manager"
--click
perform action "A"
end tell
end tell
end tell
end tell
It gives me a script error (System Events got an error: Can’t get group "Extensions" of process "Google Chrome".)
"Layout Manager" is the extension name and "A" is the action I want to enable.
thanks
===
Still messing around but I can't even open the specific profile. I used:
activate application "Google Chrome"
tell application "System Events"
tell process "Google Chrome"
click menu item "Profile" of menu 1 of menu bar item "People" of menu bar 1
end tell
open location "http://example.com"
open location "http://anotherexample.com"
end tell
But it gives me: "System Events got an error: Can’t get menu bar item "People" of menu bar 1 of process "Google Chrome"."
Anyone?
===
Edit:
So I managed to run the Chrome profile. Still trying to run the extension function.
Extension name: Multi Layout Manager
With it you can save various browser setups (tabs, position, size) and apply them whenever you want. I want the script to click on the extension and then click on a setup (Setup A, Setup B, etc.) The extension is pinned.
I'm trying out this code I found but my knowledge is limited
tell application "Google Chrome"
activate
delay 0.3
end tell
tell application "System Events"
tell process "Google Chrome"
tell group "Extensions"
tell button "Multi Layout Manager"
click
--perform action "Setup A"
end tell
end tell
end tell
end tell
I get the following error message: "System Events got an error: Can’t get group "Extensions" of process "Google Chrome"."
It seems to me that I can't show it which button to click.
I'm still running HS (10.13.6) and Chrome Version 92.0.4515.159 (Official Build) (x86_64)
PS: When you respond, do I edit the main question or post an answer? Sorry, I'm new here.