Quicktime Annotation help

I have a script that takes an .mp3 file and down samples it to a new .acc file. The problem I am having is getting the mp3 info such as Title, Album, Artist etc. copied over to the new file. I have tried to use Apple’s annotation drop scripts as examples, but I just can’t get it to work. I can read the annotation information from the first file but just can’t get the info saved to the second. Here is a snippet of the code I am trying to get to work:

property annot_title : "«none»"
property annot_album : "«none»"
property annot_artist : "«none»"
property annot_comment : "«none»"

--on open myFiles
tell application "QuickTime Player"
       launch --bypass promo movie
	activate
	--	repeat with myFile in myFiles
	set myFile to "Mini HD:Users:JoBi:Desktop:New File.mov"
	open (myFile) -- as alias)
	
	set myFile2 to "Mini HD:Users:JoBi:Desktop:Origional File.mp3"
	open (myFile2) -- as alias)
	
      --This appears to work saving these four attributes into the following four variables
	set annot_title to full text of annotation "Full Name" of movie 1
	set annot_album to full text of annotation "Album" of movie 1
	set annot_artist to full text of annotation "Artist" of movie 1
	set annot_comment to full text of annotation "Comment" of movie 1
	
       --This is the part the has an error.  I think it is because "Full Name" doesn't exist yet but not sure how to fix this
	tell movie 2
		set the full text of annotation "Full Name" to annot_title
		set the full text of annotation "Album" to annot_album
		set the full text of annotation "Artist" to annot_artist
		set the full text of annotation "Comment" to annot_comment
	end tell
	
	close movie 1 saving yes
       close movie 2
end tell

Appreciate any and all help.
-Jonathan

Hi Jonathan,

It seems like your script should work. If an annotation doesn’t exist, then a new one is created just by setting the full text of the new annotation. One thing I do is work with one movie at a time. Maybe you can try that. Open the original, get the annotations’ text, and close it. Then open the second movie. Instead of using the movie index, I use ‘front movie’:

tell front movie
stop
rewind
set full text of annotation “Album” to whatever
end tell

Or maybe it’s a bug in your OS. I don’t know if you posted your OS and QuickTime version.

Hope you get it working.

gl,

You can use this to view a file’s current annotations and annot. contents:


set thefile to choose file
tell application "QuickTime Player"
	open thefile
	set Counter to 1
	set MovieAnnotionsData to {}
	
	repeat with ThisAnnotation in (name of annotations of movie 1)
		
		set ThisMovAnn to {item Counter of (name of annotations of movie 1), item Counter of (full text of annotations of movie 1)}
		copy ThisMovAnn to the end of MovieAnnotionsData
		set Counter to 2
		
	end repeat
end tell

get MovieAnnotionsData

MovieAnnotionsData is a list of lists. {{annot. name, annot. contents},{annot. name, annot. contents}} etc. This way you can view the name and contents together.

I could not create a new annotation “name” as kel suggested, only add and modify Apple’s default list:
{“Album”, “Artist”, “Author”, “Comment”, “Copyright”, “Creation Date”, “Description”, “Director”, “Disclaimer”, “Full Name”, “Host Computer”, “Information”, “Make”, “Model”, “Original Format”, “Original Source”, “Performers”, “Producer”, “Product”, “Software”, “Special Playback Requirements”, “Warning”, “Writer”}

I was able to add annotations and annotation text, but not save. I think saving requires QTPro because the “Set Full Name Annotation” droplet requires Pro.

property annotations_list : {"Album", "Artist", "Author", "Comment", "Copyright", "Creation Date", "Description", "Director", "Disclaimer", "Full Name", "Host Computer", "Information", "Make", "Model", "Original Format", "Original Source", "Performers", "Producer", "Product", "Software", "Special Playback Requirements", "Warning", "Writer"}

tell application "QuickTime Player"
	set theAnnotation to (choose from list annotations_list)
	tell movie 1
		try
			set this_name to the full text of annotation theAnnotation
		on error -- no full name annotation exists
			set this_name to ""
		end try
		display dialog "Enter the data for annotation " & theAnnotation default answer ""
		set the full text of annotation (theAnnotation as string) to the text returned of the result
	end tell
	--close movie 1 saving yes
	
end tell

Keep the file open and check the annotations with the first script to verify modification. Again, I could change and modify at will, but could not save.
SC

Hi,

Sitcom wrote:

I could not create a new annotation “name” as kel suggested

I didn’t write anything like that. You been drinking? :slight_smile:

You can’t save if you don’t have QT Pro, but you can export. I don’t think you can export mp3 though. I looked again at your script and it should work other than the saving if you don’t have QT Pro.

gl,

Well, something like that. I did recently switch to a stronger blend, :smiley:

SC

Sitcom & Kel,

Thanks for the info, but I am still having problems with applescript errors. First I am using QT Pro 7.0.1 and OS 10.4.2.
The file I am working on is an ACC sound file with a .mov extension. There are no annotations in the file.

When I use Sitcom’s example code, it only works if I go into properties and manually add an annotation. Otherwise if there isn’t an annotation this apple script error is returned:
AppleScript Error
QuickTime Player got an error:
NSReceiverEvaluationScriptError: 4

So if I select Full Name (there isn’t one yet), type in the name, the above error is raised. I tried this witht the origional .mp3 file, which has four of the annotations listed. If I select an existing annotation it changes it, but if I select one that doesn’t exist it raises the above error.

It appears that I need to create the annotation first before I can change it, how do I do this?

Appreciate the help.
-Jonathan

Okay, searching through the apple discussion groups I found that

  1. Quicktime 7.0 and Tiger has problems with annotations and
  2. Supposedly a fix will be available in 10.4.3.

Can find this at http://discussions.info.apple.com/webx?128@891.iljhaUWtZhP.3@.68b17e7b

Also to work around this, I need to make a new annoation with a comment link this:

make new annotation with properties {name:“Comment”, full text:“This is a comment.”}

Cheers,
Jonathan