On Wed, Apr 1, 2009 at 10:21 PM, Luca C. <luca.pazzere...@gmail.com> wrote:
> 2009/4/1 Michael Ash <michael....@gmail.com> > > > > > > No, don't do this. AppleScript is not safe to use outside the main > > thread. If you must run AppleScript asynchronously, either spawn a > > subprocess to run it or, better yet, don't use AS at all but send > > Apple Events in some other way, such as with ScriptingBridge. > > > I didn't realize the unsafety of NSAppleScript - so I have been quite > lucky, because my usage of applescript in non-main threads haven't caused > me > any problems. > > ScriptingBridge seems not to be thread safe, too. Adding a track to the > iTunes library using either applescript or SB will cause a block of the app > if iTunes has dialog windows opened. > > The solution could be writing a command line application, wich does all > the work you need, either using AS or SB. > Right now, I'm more confused than I was, hehe. My question is: Why would I care about thread safety? Assuming that everytime I communicate with iTunes I create a thread and have the communication happen from there, even if it's blocking and times out, it wouldn't affect my main application. I'm I missing anything here? How would be the command line application any different from this? _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com