Rich

Rich / active-finder

Last active 2 hours ago

Like 0

Get selected items in active Finder window

Rich revised this gist 2 hours ago · 7fdcc5f

1 file changed, 18 insertions

active-finder (file created)
@@ -0,0 +1,18 @@
1 + #!/usr/bin/osascript
2 + on convertListToString(theList, theDelimiter)
3 + set AppleScript's text item delimiters to theDelimiter
4 + set theString to theList as string
5 + set AppleScript's text item delimiters to ""
6 + return theString
7 + end convertListToString
8 +
9 + on run argv
10 + set output to {}
11 + tell application "Finder"
12 + set selectedItems to selection as alias list
13 + repeat with i from 1 to count of selectedItems
14 + set end of output to quoted form of POSIX path of item i of selectedItems as string
15 + end repeat
16 + end tell
17 + return convertListToString(output, "\n")
18 + end run