Thank you for your effort and (successful) help!
That was the key: What is returned from the AppleScript is trappable like that!

Best, tim


On 24 Mar 2018, at 5:36 pm, dipnlik <dipnlik@gmail.com> wrote:

You're running a bash script, and osascript returns the list, so you
can attribute the script return value to a variable and use it however
you want.  I did this simple test:

#!/usr/bin/env bash
sleep 5
result=$(/usr/bin/osascript -e etc etc etc...)
echo $result

Saved this script, then executed it and quickly cmd tabbed to a finder
window and cmd a.  The script printed the list of selected files to
the terminal as expected.

I'm not a PHP developer but Google says you can use shell_exec() to
run your osascript and save its return to a variable.

Hope that helps.

--
:: dip


On Tue, Mar 13, 2018 at 11:15 AM, Tim Bates <timothy.c.bates@gmail.com> wrote:
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'

_______________________________________________
textmate mailing list
textmate@lists.macromates.com
http://lists.macromates.com/listinfo/textmate

_______________________________________________
textmate mailing list
textmate@lists.macromates.com
http://lists.macromates.com/listinfo/textmate