Add function to print the files/directories selected in the Finder

This commit is contained in:
Joe Block 2015-12-05 09:25:16 -08:00
parent 146a2c2de4
commit 1e18712c97

View File

@ -10,6 +10,7 @@
- [App Icons](#app-icons)
- [Finder](#finder)
- [Get Path of Frontmost Finder Window](#get-path-of-frontmost-finder-window)
- [Print Files Selected in Finder](#print-files-selected-in-finder)
- [Set Current Directory's Finder View to Column View](#set-current-directorys-finder-view-to-column-view)
- [Set Current Directory's Finder View to Icon View](#set-current-directorys-finder-view-to-icon-view)
- [Set Current Directory's Finder View to List View](#set-current-directorys-finder-view-to-list-view)
@ -61,6 +62,23 @@ function finder_path {
}
```
### Print Files Selected in Finder
```bash
selected() {
osascript <<EOT
tell application "Finder"
set theFiles to selection
set theList to ""
repeat with aFile in theFiles
set theList to theList & POSIX path of (aFile as alias) & "\n"
end repeat
theList
end tell
EOT
}
```
### Set Current Directory's Finder View to Column View
```bash