Q: How to use the "click menu item" script command on a menu item for an app running under a different user?
Hey everyone, quick question.....
I'm trying to run this script:
tell application "System Events"
tell process "iTunes"
click menu item "Start Station" of menu "Song" of menu bar item "Song" of menu bar 1
end tell
end tell
The idea behind this is to start a station from the selected song currently playing. i know, not difficult to do manually, but I want to be able to do so without having to call the iTunes app to front. Now, this script works for my own iTunes app, but i have a second instance of iTunes running from the second user on my home computer (user2), with its own separate library and account and all. the script i have works fine for the instance of iTunes running under my user account, but i can't figure out how to specify which instance of iTunes I'd like the script to work on.
i should note as an FYI that i use--
do shell script "login -f user2 /Applications/iTunes.app/Contents/MacOS/iTunes >&-2>&- &" with administrator privileges
--to open my second instance of iTunes as user2
is there a way to change "tell process 'iTunes'" to something like "tell process 'unix ID'" and have the unix ID for each respective instance of iTunes?
lemme know if I'm not making sense.... Thanks in advance to anyone who can help
MacBook Pro with Retina display, OS X El Capitan (10.11.5), null
Posted on May 29, 2016 8:30 PM