Ever wanted to show the info for properties of a file or folder in a text document (perhaps as a handy reference, while scripting - or for simple copy/paste operations)?
The trouble is that converting a list of properties to text is no trivial matter. Property labels are not easily extracted - and there’s the question of how to effectively parse the values of various different classes (such as text, dates, lists, real numbers, integers, alias files and booleans).
Nevertheless, it should be possible, right?
The following script was prompted by CalvinFold’s question: Output List of Properties and Values. The code is not exactly short, but I hope someone finds it useful. Just save it as an application - for use either as a droplet (to process single or multiple items), or as an applet (to choose and process an individual file).
property cStr : ", "
property cSub : ASCII character 1
to storeItems from r between {b, e}
	set text item delimiters to return
	set r to r as string
	set text item delimiters to cStr
	set s to r's text items
	set text item delimiters to cSub
	tell s to set s to beginning & ({""} & rest)
	set text item delimiters to e & return & b
	{(b & s's paragraphs & e)'s paragraphs, (b & r's paragraphs & e)'s paragraphs}
end storeItems
to storeLists from l
	set s to {}
	set r to {}
	repeat with i in l
		set text item delimiters to cSub
		set s's end to "{" & i & "}"
		set text item delimiters to cStr
		set r's end to "{" & i & "}"
	end repeat
	{s, r}
end storeLists
to getLists from i
	set s to {}
	set r to {}
	considering case
		repeat with t in i's strings
			if cStr is in t then set s's end to t's contents
		end repeat
	end considering
	if (count s) > 0 then set {s, r} to (storeItems from s between {"", ""})
	if (count i's dates) > 0 then tell (storeItems from i's dates between {"date \"", "\""})
		set s to s & item 1
		set r to r & item 2
	end tell
	if (count i's lists) > 0 then tell (storeLists from i's lists)
		set s to s & item 1
		set r to r & item 2
	end tell
	{s, r}
end getLists
on infoToList(i)
	set {s, r} to getLists from i
	try
		i of i
	on error i
	end try
	set text item delimiters to "{"
	set i to i's text from text item 2 to end
	set text item delimiters to "}"
	set i to i's text beginning thru text item -2
	set text item delimiters to cStr
	set i to i's text items
	set text item delimiters to cSub
	tell i to set i to beginning & ({""} & rest)
	repeat with n from 1 to count s
		set text item delimiters to s's item n
		set i to i's text items
		set text item delimiters to r's item n
		tell i to set i to beginning & ({""} & rest)
	end repeat
	set text item delimiters to cSub
	i's text items
end infoToList
on itemProperties(i)
	set i to infoToList(run script ("info for alias \"" & i & "\""))
	set text item delimiters to return
	tell i to set i to beginning & ({""} & rest)
end itemProperties
to open l
	repeat with i in l
		set i's contents to itemProperties(i)
	end repeat
	set text item delimiters to return & return
	tell l to set l to beginning & ({""} & rest)
	set text item delimiters to {""}
	set p to (path to temporary items as Unicode text) & "info for.txt"
	set f to open for access file p with write permission
	set eof f to 0
	write l to f
	close access f
	tell application "Finder" to open p
end open
open {choose file}

