Applescript and QuickTime
Yesterday when I would execute an applescript with:
tell application "QuickTime Player"
it would open the OS X version of QuickTime.
For some reason today, (I don't remember changing any settings) this call tries to start classic and tries to launch the OS 9 version of QuickTime. It seems that they are named the same. How can you distinguish the two?
Thanks in advance.
tell application "QuickTime Player"
it would open the OS X version of QuickTime.
For some reason today, (I don't remember changing any settings) this call tries to start classic and tries to launch the OS 9 version of QuickTime. It seems that they are named the same. How can you distinguish the two?
Thanks in advance.
Comments
Originally posted by macrules101
Yesterday when I would execute an applescript with:
tell application "QuickTime Player"
it would open the OS X version of QuickTime.
For some reason today, (I don't remember changing any settings) this call tries to start classic and tries to launch the OS 9 version of QuickTime. It seems that they are named the same. How can you distinguish the two?
Thanks in advance.
tell application "Finder"
set QTP_path to application file id "com.apple.QuickTime Player" as Unicode text
open QTP_path
end tell
-------------------------
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]
Thanks
Originally posted by macrules101
This code works to open up the program, but how would i send commands to QuickTime now?
Thanks
Just use the variable QTP_path, which is now a reference to the OS X QuickTime Player.app, the same way you were originally going to use the string "QuickTime Player". Here is a sample that I just did to test it out; just put the same commands that you were going to put in the "Tell App "QuickTime Player"" in this Tell block instead of the trivial ones I used:
Open this script in a new Script Editor window.
tell application "Finder" to set QTP_path to application file id "com.apple.QuickTime Player" as Unicode text
tell application QTP_path
activate
name of front window
end tell
-------------------------
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]
When I run this, I get the result
"Untitled 1"
In the Results window. This is indeed the name of the front window, so it works.
See that link that says "Open this script in a new Script Editor window."? Click that to automatically copy the script into Script Editor on your computer.
the dictionary is sooooooooooooooooooooooooooooooooo useless
For instance, this code does not work:
tell application "Finder" to set QTP_path to application file id "com.apple.QuickTime Player" as Unicode text
tell application QTP_path
\tactivate
\tset {the_height, the_width} to dimensions of movie 1
end tell
Is what is happening making sense?
thanks
Originally posted by slughead
where do you learn all this applescript stuff?
the dictionary is sooooooooooooooooooooooooooooooooo useless
Boy ain't THAT the truth! The whole chapter 19 of AppleScript in a Nutshell is about how the dictionary sucks.
MacScripter.net is your savior. Actually, I'm going to post this problem over there - I thought the workaround for the script opening the Classic app would work, but he's right, it does not address the commands to QT Player.
Originally posted by macrules101
This does launch the app, however, I don't think it allows you to call anything specific to QuickTime player. It seems that it does not realize that it should use the QTPlayer dictionary.
For instance, this code does not work:
tell application "Finder" to set QTP_path to application file id "com.apple.QuickTime Player" as Unicode text
tell application QTP_path
\tactivate
\tset {the_height, the_width} to dimensions of movie 1
end tell
Is what is happening making sense?
thanks
You're right. I just tried both ways and you have to say "Tell app "QuickTime Player"" for the "movie" term to be recognized.
As above, I'll post this on MacScripter.net. I don't have Classic installed, but I saw this as a workaround - obviously it is only a partial workaround.
http://bbs.applescript.net/viewtopic.php?p=37774#37774
Posted: Fri Mar 25, 2005 2:54 pm Post subject: using terms from\t
Hi,
Surround the tell block with 'using terms from' so that at compile time it knows what app to take the dictionary terms from. Here's an example:
set the_movie to choose file
tell application "Finder"
set QT_path to (application file id "TVOD") as string
end tell
using terms from application "QuickTime Player"
tell application QT_path
launch -- opens QT without the initial blank movie
activate
open the_movie
tell front movie
stop
rewind
end tell
end tell
end using terms from
gl,
_________________
Kel