Sometimes its useful to know information about files… [Automator]
The code itself don’t do anything but it could be useful for debugging a workflow.
This example show 2 things.
- It will show ‘info for’ with single selection or multi selection of finder items.
- It will output a list from alias to POSIX path.
The code have been tested with this workflow in Automator.
[Get Selected Finder Items]
[Run AppleScript]
Copy the code to Run AppleScript Action
on run {input, parameters}
set theList to {}
-- Alias to POSIX path
repeat with i from 1 to (count input)
set (item i of input) to POSIX path of (item i of input)
copy item i of input to end of theList
end repeat
-- Get info for of the input.
set propertyList to {}
repeat with i from 1 to (count theList)
set theInfo to info for (item i of theList)
copy theInfo to end of propertyList
end repeat
-- [Alias to POSIX path list]
-- return theList
-- [Property of info for on all items]
-- return propertyList
set theNameList to {}
repeat with i from 1 to (count propertyList)
tell item i of propertyList
set theName to get its name
copy theName to end of theNameList
end tell
end repeat
-- Get the name of every input items
return theNameList
end run
The info for give us some clue… we could use name extension and ask how many PDF
files are in our selections from Finder.
The code below inside the run handler use ASOC
set theNameExtensionList to {}
repeat with i from 1 to (count propertyList)
tell item i of propertyList
set theName to get its name extension
copy theName to end of theNameExtensionList
end tell
end repeat
-- lets count every PDF of the selection and return a number
set theCountSet to current application's NSCountedSet's alloc()'s initWithArray:theNameExtensionList
theCountSet's countForObject:"pdf"