Exiftool: Batch retrieve creator exif data from files

The script bellow retrieves creator exif data for every file in the selected folder or folders (and in its subfolders too), and writes the report to TXT file. It is not very fast, but at least it works and has progress bar indication:


property exiftoolPath : "/usr/local/bin/exiftool "

set theFolders to choose folder with multiple selections allowed
set txtFile to ((path to desktop folder) as text) & "FilesCreatorInfo.txt"
set theText to ""

set theAliases to {}
repeat with theFolder in theFolders
	with timeout of 600 seconds
		tell application "Finder"
			set theAliases to theAliases & ((every file of entire contents of theFolder) as alias list)
		end tell
	end timeout
end repeat

set itemCount to count of theAliases
set progress total steps to itemCount
repeat with i from 1 to itemCount
	set theAlias to item i of theAliases
	set progress description to "Item " & i & " of " & itemCount
	set thePath to POSIX path of theAlias
	set progress additional description to thePath
	try
		set creatorTool to do shell script exiftoolPath & "-CreatorTool " & quoted form of thePath
		set theText to theText & thePath & linefeed
		set thePath to quoted form of thePath
		if creatorTool is not "" then set theText to theText & creatorTool & linefeed
		set creator to do shell script exiftoolPath & "-Creator " & thePath
		if creator is not "" then set theText to theText & creator & linefeed
		set software to do shell script exiftoolPath & "-Software " & thePath
		if software is not "" then set theText to theText & software & linefeed
		set producer to do shell script exiftoolPath & "-Producer " & thePath
		if producer is not "" then set theText to theText & producer & linefeed
		set mimeType to do shell script exiftoolPath & "-MIMEType " & thePath
		set theText to theText & mimeType & linefeed & linefeed
	end try
	set progress completed steps to i
end repeat


try
	set file_ID to open for access txtFile with write permission
	-- Clear any existing content if the file already exists:
	set eof file_ID to 0
	-- Add the UTF-8 encoded text:
	write theText to file_ID as «class utf8»
	close access file_ID
end try