Threading and Applescript Studio

Hi All,
So I have a large Applescript Studio project that has really evolved and has thus started to require some threading. In my application I have a Table View that will run through many functions and print the results. I figured how to do “On Idle” and this works ok, however I have two main issues…

  • I still can only press buttons and see the response about 2-3 seconds later, this is probably because what occurs on idle is still pretty big.
  • I have random hands once and a while, perhaps something is causing the application to never go idle about half way down my table view.

Does anyone have any tips to address these two issues? I really don’t like the lag of idle, is there a better solution?

Thanks for the help!


I’m not an expert in this area by any means, but I also maintain a large Studio Project that might be one of the largest in existence. Over the years, I’ve managed to avoid such issues largely because my application often offloads tasks to the shell or Cocoa Methods which in essence creates another task and because by nature it doesn’t need to queue tasks and is fairly linear. However, someone I know, who worked at Apple for many years once told me that AppleScript is LIFO (Last In First Out) meaning that as you tell AppleScript to do things, it tends to do the last thing you told it to do first - which has obvious issues. The only way around this, I hear, to have an scheduler built into your application - where you send things to the scheduler handler before they are actually “done” - I think there may be a few examples on this site, actually.


according to this post:

Thanks for clearing that up. I guess the person who told me that was a bit out of date. At any rate, if your app does a lot of tasks (creates events) at the same time, it still might be a good idea to have a handler to prioritize them before actually executing them. If anyone knows any good examples, please direct us to them.

Thanks for the clarification.

I too would also love to see some example on this. Using “on idle” just isn’t cutting it anymore.