This screenshot of shortcuts (ShCut) is an automatic translation of a (working) automator app including a short AppleScript to recover original items of aliases from a folder and copying them in another folder.
But not working in shortcuts - the original items are not copied as file but as a txt file ! containing the path of the file. Help ! I spent lot of time to find a solution. But impossible to transform a (POSIX) path in a file in ShCut.
I have also test a very simple AppleScript where the input is return as is w/o transformation. By analysing type of the output, Applescript don’t return input but a list of texts containing path ?
Thanks for your ideas
Best regards
Michel
- no shot of the automator (not permit 2)
Try this code passing Folder without the Get Contents of Folder and Save File actions:
on run {input, parameters}
tell application "Finder"
repeat with f in (get every file of folder input)
copy file (original item of f as alias) to folder (POSIX file "/Users/imichel/Documents/Working_Auto_bk")
end repeat
end tell
end run
Thanks for your idea where the copy loop is in the applescript.
As often, as soon as the question was asked, the solution came…
Here is an integration that works with a very small script accompanied by the actions and variables offered by ShortCuts. The loop inside folder’s content with Save actions is in Shortcuts actions flow.
Best regards
M.
on run {input, parameters}
-- 230820
-- input is a one element list of the repeat item !!!
tell application "Finder"
set anItem to item 1 of input
if anItem's kind is "Alias" then
set output to (original item of anItem as alias)
else
set output to anItem
end if
end tell
return output
end run