<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br style="font-size: 16px;" class=""><div style="font-size: 16px;">Thank you for your effort and (successful) help!</div><div style="font-size: 16px;">That was the key: What is returned from the AppleScript is trappable like that!</div><div style="font-size: 16px;"><br class=""></div><div style="font-size: 16px;">Best, tim</div><div style="font-size: 16px;"><br class=""></div><div style="font-size: 16px;"><br class=""><blockquote type="cite" class=""><div class="">On 24 Mar 2018, at 5:36 pm, dipnlik <<a href="mailto:dipnlik@gmail.com" class="">dipnlik@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">You're running a bash script, and osascript returns the list, so you<br class="">can attribute the script return value to a variable and use it however<br class="">you want.  I did this simple test:<br class=""><br class="">#!/usr/bin/env bash<br class="">sleep 5<br class="">result=$(/usr/bin/osascript -e etc etc etc...)<br class="">echo $result<br class=""><br class="">Saved this script, then executed it and quickly cmd tabbed to a finder<br class="">window and cmd a.  The script printed the list of selected files to<br class="">the terminal as expected.<br class=""><br class="">I'm not a PHP developer but Google says you can use shell_exec() to<br class="">run your osascript and save its return to a variable.<br class=""><br class="">Hope that helps.<br class=""><br class="">--<br class="">:: dip<br class=""><br class=""><br class="">On Tue, Mar 13, 2018 at 11:15 AM, Tim Bates <<a href="mailto:timothy.c.bates@gmail.com" class="">timothy.c.bates@gmail.com</a>> wrote:<br class=""><blockquote type="cite" class="">Hi,<br class="">I have a command (copied below) which grabs the paths of the selected items in the Finder, and inserts them into a textmate doc.<br class=""><br class="">I'd like to do some post-processing of the result (replace e.g. replace "/Users/.*/" with "~", and strip trailing return character.<br class=""><br class="">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?<br class=""><br class="">Thanks!<br class=""><br class=""><br class="">#!/usr/bin/env bash<br class="">osascript -e 'tell application "Finder"<br class=""> set theFiles to selection<br class=""> set theList to ""<br class=""> repeat with f in theFiles<br class="">    set theList to theList & "\"" & POSIX path of (f as alias) & "\","<br class=""> end repeat<br class=""> return theList<br class="">end tell'<br class=""><br class="">_______________________________________________<br class="">textmate mailing list<br class=""><a href="mailto:textmate@lists.macromates.com" class="">textmate@lists.macromates.com</a><br class="">http://lists.macromates.com/listinfo/textmate<br class=""></blockquote><br class="">_______________________________________________<br class="">textmate mailing list<br class=""><a href="mailto:textmate@lists.macromates.com" class="">textmate@lists.macromates.com</a><br class="">http://lists.macromates.com/listinfo/textmate<br class=""></div></div></blockquote></div><br class=""></body></html>