• 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: OSAScriptController's stopScript action
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OSAScriptController's stopScript action


  • Subject: Re: OSAScriptController's stopScript action
  • From: has <email@hidden>
  • Date: Wed, 17 Dec 2014 14:59:47 +0000

sqwarqDev wrote:

> Once again, apologies for cross posting, but again this is partly an AppleScript question and partly a Cocoa question. To wit:
>
> Is there any way to programmatically stop a script once it's running without using OSAScriptController's 'stopScript' IBAction?
See OSASetActiveProc() in the Retired Documents library:

https://developer.apple.com/legacy/library/documentation/Carbon/Reference/Open_Scripti_Architecture/index.html#//apple_ref/c/func/OSASetActiveProc

The AppleScript language component [1] periodically calls the active proc callback while a script is running, partly to allow the host process an opportunity to perform other work on the same thread (this stuff was designed for Sys7, remember) and partly to allow execution to be externally halted. The default callback tells the component to halt if a Cmd-period keystroke is entered, but you can use OSASetActiveProc to supply your own custom callback if you wish (also see OSAActiveProcPtr and OSAActiveProcUPP).
Needless to say, OSAKit's OSALanguage, OSALanguageInstance, and
OSAScript classes are a dead loss for a lot of non-trivial OSA
functionality: they either expose it badly or not at all. There is a
-languageInstance method that will give you access to the underlying
OSAComponentInstance, and from there you can use the old Carbon OSA API
to do the rest. Though given that ComponentInstance, FSRef, and other
Carbon ADTs are deprecated, it's difficult to work with these legacy
APIs without being forced into using deprecated APIs as well. It's all a
big horrible gray area that Apple has no interest in either clarifying
or replacing, so caveat emptor. [1]

As to OSAScriptView and OSAScriptController, I've not used them myself but I remember Shane telling me a while back that they were also crap and had ended up writing his own classes from scratch.
Regards,

has

[1] Personally I wish Apple would grow a pair and just deprecate OSA entirely, Carbon and Cocoa APIs alike. It's hideously arcane, archaic, hopeless in sandboxes, nobody outside of Mark Aldritt and the Satimage devs even understands OSA any more, and they're useless for any language that wasn't built from the ground-up for OSA - i.e. any language other than AppleScript. Then third-party developers and users would have a clue where we stood, and Apple might be motivated to create a new language component architecture that isn't a fat useless sack of white elephant crap. But they clearly don't care either way so I suspect they'll just let it rot away on its own, and then that will be that.
_______________________________________________
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: OSAScriptController's stopScript action
      • From: sqwarqDev <email@hidden>
  • Prev by Date: Re: OSAScriptController's stopScript action
  • Next by Date: Re: OSAScriptController's stopScript action
  • Previous by thread: Re: OSAScriptController's stopScript action
  • Next by thread: Re: OSAScriptController's stopScript action
  • Index(es):
    • Date
    • Thread