• 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: Script Editor in Sierra – Auto-Opens Open Dialog?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Editor in Sierra – Auto-Opens Open Dialog?


  • Subject: Re: Script Editor in Sierra – Auto-Opens Open Dialog?
  • From: Christopher Stone <email@hidden>
  • Date: Tue, 24 Jan 2017 00:33:20 -0600

On Jan 23, 2017, at 23:34, Takaaki Naganoya <email@hidden> wrote:
How about this?


Hey Takaaki,

That works, but I don't want to close any documents that are already open on the off-chance that something auto-opens after a crash, etc.

What I've settled on is this:

tell application id "com.apple.scripteditor2"
   if not running then
      launch
      make new document
   end if
   activate
end tell

However I've noticed something quite odd.

I'm replacing a simple Activate a Specific Application action in Keyboard Maestro.

Keyboard Maestro runs AppleScript with `osascript` (for reasons known only to Peter), and this means that running a compiled script or a text script should produce the same result - yes?

But if I run the script above as a text script in a Execute an AppleScript action the open dialog OPENS and the new document fails to open!

That doesn't happen when I run the compiled script direct from Script Debugger or from FastScripts...

Hmm...

So I tried running a compiled script from the Execute an AppleScript action, and it works as expected – no open-dialog.

Running this shell script from BBEdit or FastScripts also produces the misfire.

read -r -d '' myScript <<'EOF'
tell application id "com.apple.scripteditor2" -- Script Editor
   if not running then
      launch
      make new document
   end if
   activate
end tell
EOF

osascript -e "$myScript"

Weird.

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

  • Follow-Ups:
    • Re: Script Editor in Sierra – Auto-Opens Open Dialog?
      • From: Brian Christmas <email@hidden>
References: 
 >Script Editor in Sierra – Auto-Opens Open Dialog? (From: Christopher Stone <email@hidden>)
 >Re: Script Editor in Sierra – Auto-Opens Open Dialog? (From: Takaaki Naganoya <email@hidden>)

  • Prev by Date: Re: Script Editor in Sierra – Auto-Opens Open Dialog?
  • Next by Date: Satimage.osax Understands Tilde-Based Paths
  • Previous by thread: Re: Script Editor in Sierra – Auto-Opens Open Dialog?
  • Next by thread: Re: Script Editor in Sierra – Auto-Opens Open Dialog?
  • Index(es):
    • Date
    • Thread