I'm trying to copy multiple files to the clipboard in macos like this:
./file2clip.applescript /User/Cool/Dekstop/test.txt /User/Cool/Dekstop/myfolder
I already can do this with only one file:
#!/usr/bin/osascript
on run args
set the clipboard to POSIX file (first item of args)
end
But it only works on one file...
I have tried this
on run args
set the clipboard to POSIX files args
end
But It didn't work.
And also this
on run args
set pathList to {}
repeat with arg in args
set end of pathList to POSIX file arg
end repeat
set the clipboard to pathList
end
But this also didn't work
Adding all the POSIX files to a string also doesn't work because the clipboard will have only text inside it so I can't paste all the files with ctrl
+ v
, I could only paste their names. Not what I want to achieve.
property files: ""
on run args
repeat with f in args
set files to files & POSIX file f & "\n"
end repeat
set the clipboard to files
end
Any ideas?