• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unwanted output
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unwanted output


  • Subject: Re: Unwanted output
  • From: Christopher Stone <email@hidden>
  • Date: Wed, 24 Aug 2016 16:52:07 -0500

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
-------------------------------------------------------------------------------------------

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Unwanted output (From: debt <email@hidden>)
 >Re: Unwanted output (From: Steve Mills <email@hidden>)
 >Re: Unwanted output (From: debt <email@hidden>)

  • Prev by Date: Re: [SOLVED] Unwanted output
  • Next by Date: Anyone use Macterm
  • Previous by thread: Re: [SOLVED] Unwanted output
  • Next by thread: Re: Unwanted output
  • Index(es):
    • Date
    • Thread