Video Dimensions to Comments script help needed

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

MacDream

New member
Joined
May 11, 2006
Messages
7
Points
0
Hi everybody,

I want to include the "Video Dimensions" information in a visible column of my video collection.
Like this:


Even though it will be horrendous work to set one by one manually.
This looks like a task for an Apple Script for iTunes.

I would like to have one that makes this job for me.
An Apple Script that writes the "Video Dimensions" information automatically into the "Comments" space and if something else is previously there, that "Video Dimensions" would be added and placed at the beginning.
From here to there:

So:
Could somebody please tell me where to find it, if it's already been made? if not, how to write it, if there is a tutorial for neophytes somewhere out there? if not, how to modify one like "FileCreationToComment" script as it was made in the following thread "Need a script: "Last Listened Date" to "Text box" ? or the best, can be generously written and posted by one of the Black Belts that hang around here?

Thank a lot,
MacDream
 
Last edited:

S2_Mac

New member
Joined
Oct 24, 2006
Messages
4,876
Points
0
Location
About 3 feet in front of the monitor
There's got to be a better way of doing this....

iTunes' Applescript dictionary has no awareness of movie dimensions, so there's no quick way to get the info you want. And Image Events only reads still images, so it's of no help. That pretty much exhausts my meager knowledge;-)

(There's p'bly some hook in QuickTime that iTunes calls to get that info, but I've got no idea what it might be...maybe the folks at macscripting.net have a QT guru hanging around, or check with some QT groups....)

That said, this worked OK in the one simple test I gave it. It requires the QuickTime Player to open each movie file in a player window, then it grabs the dimensions, then it closes the player window/file; iTunes adds the dimensions to whatever info already exists in the track's Comments box.

This script is an accident waiting to happen -- drunk drivers do more error checking than this thing -- so treat it nicely (like, make sure you only select video files. Missing files will p'bly make it puke spectacular colors. Etc. ;-). Oh yeah -- don't have the iTunes display sorted by Comments!

Select a few files, activate the script, wait for a bit.
Code:
-- Movie Dimensions to Comments script
tell application "iTunes"
	set sel to the selection
	if sel is {} then display dialog "Please select something" buttons {"Cancel"}
	repeat with i from 1 to count of sel
		set the_track to item i of sel
		set the_alias to location of the_track as alias
		
		tell application "QuickTime Player"
			open the_alias
			set dims to dimensions of document 1 as list
			set width to item 1 of dims
			set height to item 2 of dims
			close document 1 saving no
		end tell
		
		set comments to comment of the_track
		set comment of the_track to (width & "x" & height & return & comments) as string
	end repeat
end tell
If you need info on how to save, use, or "install" the script, post again. (Sorry to be so brief; we had hurricane-force winds here on Wednesday, and I'm righteously pooped from spending what should have been a laid-back holiday doing serious clean-up ;-)
 

MacDream

New member
Joined
May 11, 2006
Messages
7
Points
0
Dear S2_Mac,

This is more than I expected.
Your knowledge isn't meager at all!

It works like charm.
I'll be careful to treat it as you recommended.

I also have to thanks the extension of your post. You have provided me with the information I need to understand and run this script. Furthermore, you have made time to write the script for me.

My little knowledge allowed me to compile it and install it. Thanks for your offer in this regard too.

I hope bad weather goes away over there soon.

For anyone else interested in this iTunes Script, can find it here: Movie Dimensions to Comments

WARNING:
  • Read S2_Mac reply above.
  • Use only with movie (video) files.
  • Make sure the file(s) is (are) not "Missing" and it's (they're) actually in your library.
  • Make sure your video list is sorted by anything but "Comments" before proceeding with the script. (Do not sort by comments)

Demo


P.S.: I'm looking for a better (for free) place to host this script.
Any suggestion?
Thanks.
 
Last edited:

harrytipper

New member
Joined
Jan 5, 2013
Messages
1
Points
0
Will this script work with iTunes 11? I can't seem to access the link you provided. Could you upload it again please?

Thanks!
 

MacDream

New member
Joined
May 11, 2006
Messages
7
Points
0
I'm not using iTunes 11 until I can.
I'm using iTunes 10.7 and the script still works find, but since QT change to 10, I had to make a little change in the script and (keep) iTunes 7 in my application folder.

You have to check your inbox for links and examples because this crap site wont allow me to post links or images.

Give it a try in iTunes 11 with a test movie.
Good luck!
 
Top