AppleScript to count pages of PDF documents via Skim

I found Skim to be the perfect replacement for Preview (ie, a fast app to review PDF documents with notes, etc.). And it also provides a decent AppleScript dictionary, so it’s also the perfect app to make one of those great time-savers. Follows sample code you can save as a droplet (and process a bunch of PDF files via drag & drop) or as a compiled script to be run from any script launcher:

open (get selection of application "Finder")

on open pdflst
	set cnt to 0
	repeat with i from 1 to count pdflst
		--> just in case comes from run handler...
		tell application "Finder" to set pdfFile to (pdflst's item i as alias)
		tell application "Skim"
			open pdfFile
			set cnt to cnt + (page count of (get info of document 1))
			close document 1 saving no
		end tell
	end repeat
	
	display dialog ("" & cnt & " pages for " & (count pdflst) & " documents...") with icon note
end open

I know it’s trivial code, but still you must spend some time to find a solution for your PDF-page-count needs, and this is a fast and free one.