问题
I'm running the following applescript:
tell application "Finder"
set input to POSIX file "/Users/sam/Desktop/Resized"
set theFiles to (every file of folder input whose name does not contain "- Resized")
end tell
return theFiles
It's working as it should, though it's returning:
{document file "HighResCat.jpg" of folder "Resized" of folder "Desktop" of folder "sam" of folder "Users" of startup disk of application "Finder", document file "madonna.jpg" of folder "Resized" of folder "Desktop" of folder "sam" of folder "Users" of startup disk of application "Finder"}
where I need a POSIX path (/Users/sam/Desktop/Resized/HighResCat.jpg) to pass to automator
++++++++++++ EDIT
I've got it this far, but I can only pass one item of the list at a time when I need all of the items.
tell application "Finder"
set input to POSIX file "/Users/sam/Desktop/Resized"
set theFiles to (every file of folder input whose name does not contain "- Resized")
set input to item 1 of theFiles as string
end tell
return (POSIX file input)
I converted to a string and on return converted to POSIX
+++++++++EDIT2
This script worked inside automator:
on run {input, parameters}
set input to (input) as string
tell application "System Events" to set theFiles to POSIX path of (files of folder input whose name does not contain "- Resized")
set input to theFiles
return input
end run
thanks
回答1:
Try:
set input to "/Users/sam/Desktop/Resized"
tell application "System Events" to set theFiles to POSIX path of (files of folder input whose name does not contain "- Resized")
return theFiles
来源:https://stackoverflow.com/questions/17910790/applescript-finder-path-into-posix-path