Multi-tasking?

Hi, I’m working on a menubar application (menulet), with the menu items hooked up to subroutines that look a bit like this…

on commandHere_(sender)
    try
        
    on error err number errNum
        display alert "An error was encountered: " & err & " Error number " & errNum & "."
    end try
end commandHere_

however, once I’ve pressed one menu item, the entire menu greys itself out until the command is over.

Also, if a command fails, freezes up or takes too long, the user has no way of quitting the application except for going to Activity Monitor and quitting there, because the “Quit” menu item is greyed out.

Is there any way of multi-tasking things??

Any help would be appreciated!

Model: MacBook Pro 2.53 GHz
AppleScript: 2.1.2
Browser: Firefox 4.0b6
Operating System: Mac OS X (10.6)

I’ve tried looking at http://www.macscripter.net/viewtopic.php?id=34563 and running things as background…

set tempScript to "run script " & script1
                do shell script "osascript " & quoted form of tempScript & " > /dev/null 2> /dev/null"

But I always get an error saying that it exited with a non-zero status. When it does work, it doesn’t run the script!

Any ideas or suggestions or thoughts?

Hi Magik,

Sorry my post didn’t work out for you as expected. But your command is a little different from mine. Also I haven’t tested it with ApplescriptObjC yet and will do that shorty. I also haven’t tested if a ApplescriptObjC application is fully scriptable like the old way.

Sorry I can’t help you with this today but I will find out shortly how multitasking will work with ApplescriptObjc. I think there should be a way of threading instead of forking like I did in my post.

Don’t worry! =)

That was a while back anyway! Since then, I sorta slightly gave up on backgrounding. It was part of my application… not too bad!