kmDItem conflict with Quicktime?

Ok, I have a bit of a bizarre problem. I wrote a script which compares the width/height to see which is greater (to determine if it is a horizontal image or a vertical image).

I was going to do a screen recording thru QuickTime to show my results and the width and height variables return (null) when the script is run, but ONLY while QT is running as well.

Does anyone have any insight to why this is happening or be able to suggest another way of doing the same thing?

The code is below, although I don’t think that’s where my problem lies.

			set imgHeight to (do shell script "/usr/bin/mdls -name kMDItemPixelHeight " & (quoted form of theFile3) & "| /usr/bin/awk -F\" = \" '{print $2}'")
			set imgWidth to (do shell script "/usr/bin/mdls -name kMDItemPixelWidth " & (quoted form of theFile3) & "| /usr/bin/awk -F\" = \" '{print $2}'")

Hello.

I think you are in a dead lock situation.

The reason might be that spotlight haven’t got any data since the file that you are requesting data for is open. It may be that those properties aren’t (the metadata aren’t written to the spotlight database) set before you have closed the file again.

There’s several ways to get the width/height of an image. Image Events is easy. Try this…

set theImage to (path to desktop folder as text) & "birthday_balloons.JPG"
tell application "Image Events"
	set openImage to open file theImage
	set {theWidth, theHeight} to dimensions of openImage
	close openImage
end tell
return {theWidth, theHeight}