Getting the Height and Width of a pdf in a script

Is there a way to select a folder of PDF’s and have it open a text edit file or a dialog box and give the height and width of each file? Text file would be better, as then it will be easier to take the smaller pdf and out them in one folder and move the larger ones to another.

Thanks
babs

I think you’ll have to ask Spotlight for that information.


property zelist : {}
set {astid, AppleScript's text item delimiters} to {"", "="}

set xpto to "Apps: books:Programming:Cooking:Pizzas"


tell application "Finder"
	set zefiles to every document file of folder xpto
	repeat with f in zefiles
		tell me
			set pp to POSIX path of file (f as text)
			getdimensions(pp)
		end tell
		
	end repeat
end tell

set AppleScript's text item delimiters to astid

zelist as text  --< have fun!!

------------

on getdimensions(f)
	set s to do shell script "mdls -name kMDItemPageHeight -name kMDItemPageWidth " & quoted form of f
	if s contains "null" then return
	set s to every paragraph of s

	set s to (item 2 of text items of item 1 of s) & " *" & (item 2 of text items of item 2 of s) & "= " & f & "
"
	
	copy s to end of zelist
end getdimensions


Hello,

Thank you for this!

I did get an error, as I don’t have the same path as you, so I changed your line starting with “Apps” to my path,which would be "set xpto to “Users:bpress:Desktop:pdf test for fiery 1”
"
But still getting an error that it cannot find it?

Any thoughts of what I am doing wrong?

thanks
babs

:slight_smile: Sorry. This is not a finished product!

You still also need to do something about → zelist as text --< have fun!!

maybe the best for you is to add the line:

set the clipboard to zelist

just under zelist as text --< have fun!!

After running the script just go to your favorite text editor and Paste into a new document.

Your main disk before Users:…

Something like Macintosh HD:Users:…

Got it…
Thanks!!!
On the road all day tomorrow with work…will mess around with this on Friday when I am home working!
much appreciated!!!
babs