[TxMt] post-processing results of osascript to insert into document

Tim Bates timothy.c.bates at gmail.com
Tue Mar 13 14:15:55 UTC 2018


Hi,
I have a command (copied below) which grabs the paths of the selected items in the Finder, and inserts them into a textmate doc.

I'd like to do some post-processing of the result (replace e.g. replace "/Users/.*/" with "~", and strip trailing return character.

How does one take the resulting string from a script, and process it, say, in php or bash. or should I just work on post-processing theList in applescript?

Thanks!


#!/usr/bin/env bash
osascript -e 'tell application "Finder"
 set theFiles to selection
 set theList to ""
 repeat with f in theFiles
    set theList to theList & "\"" & POSIX path of (f as alias) & "\","
 end repeat
 return theList
end tell'


More information about the textmate mailing list