On Aug 24, 2016, at 12:00, debt <email@hidden> wrote:
That may be, but I’d still like to keep it from being printed to the screen, if at all possible. Is there a way to suppress output like this?
[ Grrf! Should have been sent to the list... ] Hey Marc,
Note the return:
------------------------------------------------------------------------------------------- read -r -d '' applescriptCmdStr <<'EOF' set theFile to alias ((path to home folder as text) & "test_directory:text.txt") tell application "BBEdit" activate open theFile return end tell EOF
osascript -e "$applescriptCmdStr" -------------------------------------------------------------------------------------------
Alternatively you can redirect the output:
-------------------------------------------------------------------------------------------
read -r -d '' applescriptCmdStr <<'EOF' set theFile to alias ((path to home folder as text) & "test_directory:text.txt") tell application "BBEdit" activate open theFile end tell EOF
osascript -e "$applescriptCmdStr" > /dev/null 2>&1
-------------------------------------------------------------------------------------------
Side question: why does it print "text document 1” instead of the name of the file being explicitly opened?
Because that's what the developers decided to return.
For that matter you can open more than one item with the same name, so the document name is not an adequately unique identifier.
text document 1 loses its uniqueness as soon as another document is opened, but this is easily worked around:
------------------------------------------------------------------------------------------- set theFile to alias ((path to home folder as text) & "test_directory:text.txt")
tell application "BBEdit" set theDoc to open theFile set theDocID to ID of theDoc
tell document id theDocID its name its contents end tell
end tell -------------------------------------------------------------------------------------------
|