Hi,
I’m trying to pass the process id as a parameter to an applescript. Passing the argument works, returning its value too but working with it doesn’t. Here’s what I mean:
on run argv
set vlcPID to item 1 of argv
tell application "System Events"
set VLC_VGA to application processes whose unix id is vlcPID
repeat with proc in VLC_VGA
set the frontmost of proc to true
keystroke "p" using {command down}
end repeat
end tell
return "started playing VLC instance: " & vlcPID
end run
My goal is to use it in a shell script. Right now I’m simply testing it on command line terminal with the following command:
osascript /Users/devuser/Development/AppleScript/playVLCAppViaPID.scpt 598
The terminal echos back correctly “started playing VLC instance 598” but doesn’t seem to recognize the vlcPID for the line “set VLC_VGA to application processes whose unix id is vlcPID”
What am I doing wrong here?
Model: MacBook Pro
AppleScript: 2.1.2
Browser: Safari 534.30
Operating System: Mac OS X (10.6)