I’m really new to applescript so please excuse my question, if this might be basic stuff…
I’m trying to send applescripts to different instances of VLC player. So far I managed to identify the instances by their PIDs and remote control control them by sending key codes or keystrokes, such as this:
tell application “System Events”
set pidList to the unix id of (processes whose name contains “VLC”)
tell (first process whose unix id is item 2 of pidList)
set frontmost to true
end tell
tell application “System Events” to tell (process 1 where frontmost is true)
key code (35) using command down
end tell
end tell
My questions: I don’t like the workaround of setting the frontmost to true and sending the following commands via finder simply because it’s time consuming and I don’t manage to start 3 instances e.g. in sync. But I couldn’t find a way to send scripts directly to the instances identified by their PIDs - (in the form of something like “tell (first process whose unix id is item2 of pidList to do something…”) the script always controls the instance that has been created first, but not the one where frontmost is true…
Isn’t there a solution to script control several VLC instances directly via a tell block? Thanks for any input, hints and help
Thanks for your input! Yes, there is a reason for VLC: when playing 5 instances, VLC is the less resource consuming player. QLab and Quicktime can’t manage to play these 5 videos in synch without using complete CPU power, whereas VLC uses about 30% with the same files… Unfortunately the “tell every document to play” does not work in VLC. There must be a way to do it, but I’m still desperately seeking…
That’s exactly my problem I really don’t know how to address these instances/windows. If I make them frontmost true, it works, but it’s impossible to start them simulaneously as there’s always a time lag until the next window starts. So I’m looking for a possibility to address them directly instead of setting them to frontmost… Any idea?
Thanks Fredrik, I see… however your script you sent only triggers the first VLC instance and not all of them… I wonder whether there’s really a solution to that. Maybe triggering by OSC/UDP or a network protocoll. I don’t know.