I need to check for the presence of VLC before actually using it. I don’t want the user to have to find it if it is not present. The following works, but read on…
tell application "Finder" to set vlcname to name of application file id "org.videolan.vlc"
set vob to "/Volumes/SpareHead2/DVD Library/Transport Streams/PAL.ts"
tell application vlcname
using terms from application "VLC"
activate
open POSIX file vob as alias
fullscreen
end using terms from
end tell
This works, but if this happens to be inside any other tell statement, it fails, and attempts to pass the activate, open and fullscreen events to the other application. This seems to contradict expected behavior. For example, this fails:
tell application "Finder" to set vlcname to name of application file id "org.videolan.vlc"
set vob to "/Volumes/SpareHead2/DVD Library/Transport Streams/PAL.ts"
tell application "System Events"
--various statements that talk to System Events
tell application vlcname
using terms from application "VLC"
activate
open POSIX file vob as alias
fullscreen
end using terms from
end tell
end tell
Are nested tell statements taboo? This fails with a:
“System Events got an error: application "VLC.app" doesn’t understand the fullscreen message.” (and the activate and open commands are passed to System Events.)
Also, I would have thought that a tell by path would be preferable:
tell application "Finder" to set vlcname to application file id "org.videolan.vlc"
But that doesn’t fly at all and results in a:
“Can’t get application (application file "VLC.app" of folder "Applications" of startup disk of application "Finder") of «script».”
Can anyone suggest what I am doing wrong, or a better way to do this? I am essentially using the example from the sourcebook…