Thanks, Shane. That’s very interesting!
Straying slightly off-topic for the thread, is there any particular reason why you’ve used two invocations of “open”? One works perfectly well on my machine.
do shell script "cd /usr/share/locale ; ls -1 | open -fgb \"com.apple.textedit\""
-- Or, say:
do shell script "cd /usr/share/locale ; ls -1 | open -fga \"TextWrangler\""
-- Or even:
do shell script "ls -1 /usr/share/locale | open -fga \"TextWrangler\""
The only answer to that, is that I hadn’t come around to that yet, probably never would, as I took for granted that I couldn’t combine the switches!
I see that open -fga worked the same way, with TextEdit, the whole Idea was to just bring one window to the front. I don’t understand why that works, it isn’t supposed too! At least the -a switch didn’t work for me, when having two separate invocations of open.
The way you have done it, is of course much better.
Thanks
Edit
One caveat with this is the littering of the recent items list, personally, I’m inclined to open it in something else, or execute such commands in a Terminal window, that I then bring forward, to keep the recent items list pristine.
to shellOutput for aCommandstring
tell application "Terminal" to do script with command aCommandstring
do shell script "open -b \"com.apple.terminal\""
end shellOutput
shellOutput for "top "
This one still uses TextEdit, but only uses one slot in recent items:
to textEditResult for commandString
local tmpf
set tmpf to (POSIX path of (path to temporary items from user domain)) & "scratchpad.txt"
do shell script commandString & ">|" & quoted form of tmpf
tell application "TextEdit" to open tmpf
do shell script "open -b \"com.apple.textedit\""
end textEditResult
textEditResult for "cd /usr/share/locale ; ls -l |xxd"
But they are not one-liners anymore