• 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: NSAppleScript not in the main thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAppleScript not in the main thread


  • Subject: Re: NSAppleScript not in the main thread
  • From: Daniel Jalkut <email@hidden>
  • Date: Mon, 29 May 2006 13:24:34 -0400

As I recall, the problem is more extensive than just whether you can get AppleScript itself to be thread-safe. Since the user may invoke any scripting addition (including standard additions) via their script, you have to trust that the scripting additions are themselves all thread safe. This problem is similar to the QuickTime vs. QT Components issue. Things are only thread safe if you can limit exactly what gets used.

For instance, I think even the "display dialog" standard addition command leads to problems if used on a thread other than the main thread.

As far as I can tell there are two safe approaches to "multitasking AppleScript":

1. Always run scripts on a separate process.
2. Mess around with AppleScript/AppleEvents callbacks that give you time to continue running the event loop while a script is running.


In my experience #2 does not give an ideal user experience, while #1 does not give ideal performance.

Daniel

On May 22, 2006, at 2:02 AM, Nathan Day wrote:

All NSAppleScript instance seem to use the same ComponentInstance also the ComponentInstance may also be used by the main thread, to set up the application to be AppleScriptable perhaps. Each thread must have its own AppleScript ComponentInstance, in theory this you could have multiple thread each running there own AppleScript, but I have not been able to get this to work only one AppleScript in a seperate thread to the main thread. NDAppleScriptObject lets you do this, though you are probable better using my replace classes for NDAppleScriptObject, NDScriptData and its descendent class NDScriptHandler and NDScriptContext, I haven't made them available on my web site properly yet as I have not completed the documentation for them I also want to add some more feature and get the multi threading working properly, ie more than one thread running AppleScripts. You can download it here
<http://homepage.mac.com/nathan_day/.cv/nathan_day/Public/Source% 20Code/NDScript.dmg-binhex.hqx>


On Monday, May 22, 2006, at 01:25AM, Mike Abdullah <email@hidden> wrote:


<<Original Attached>>


Nathan Day
email@hidden
http://homepage.mac.com/nathan_day/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSAppleScript not in the main thread
      • From: Nathan Day <email@hidden>
References: 
 >NSAppleScript not in the main thread (From: Christoph Vogelbusch <email@hidden>)
 >Re: NSAppleScript not in the main thread (From: Nathan Day <email@hidden>)
 >Re: NSAppleScript not in the main thread (From: Mike Abdullah <email@hidden>)
 >Re: NSAppleScript not in the main thread (From: Nathan Day <email@hidden>)

  • Prev by Date: Re: Binding popup contents difficulties
  • Next by Date: RE: Installer Check to see if it's an Intel Mac
  • Previous by thread: Re: NSAppleScript not in the main thread
  • Next by thread: Re: NSAppleScript not in the main thread
  • Index(es):
    • Date
    • Thread