AppleScript Runner Problems

I have an AppleScript that interacts with the user to get some information. Right now, in a program that I’m working on, I have to run the AppleScript from a shell script. The funny problem that I’m getting right now is that the applescript doesn’t run correctly after rebooting my computer. But, when I reinstall it, it starts working again. What happens is, it opens the first display dialog up with the correct text, but incorrect buttons, title, etc. Only the message itself is intact. Then, when I click OK, the whole applescript crashes (well, it closes, and nothing shows up in the console).

Originally, I ran the program by calling a dummy applescript with osascript to open the real applescript with applescript runner to get around the no user interaction limitation on osascript. Doing this, I got the behavior above. After this, I decided to try something else. I compiled the main applescript as an application bundle, then ran it from the shell script using “open /path/to/application.app” This got around using osascript with the dummy applescript completely. But, I got even stranger behavior. Although now the applescript did function correctly, it seemed as though two instances of it were being called, one with AppleScript Runner, and one from the applet executable contained in the application (according to Activity Monitor, at least). A display dialog would open up the same way it did above, with incorrect buttons and title but correct message, then after a second or two another dialog box, with the same message as the first one, would open up, but this time with correct buttons and everything. The correct version is run by the applet executable (located at AppName.app/Contents/MacOS/applet), and the incorrect one is run by AppleScript Runner. I am able to interact with the second dialog box just fine, and it runs the program correctly, but that pesky little other dialog box (with incorrect buttons and title) still sits around until I click ok or cancel, at which point it closes and nothing happens. I also tried integrating "do shell script “killall ‘AppleScript Runner’” at the beginning of the main applescript program, which seems to work, but that original dialog still opens for a second or two, then disappears, and this is not only annoying, but killing a process like that is not good for the system. Also, when using this fix, if the user has something running in AppleScript Runner, that will exit as well. Last, I’ve tried the program on 2 other computers, and the same issue still occurs, so I don’t think it’s just something wrong with my system (Mac Mini on 10.5.7).

I am completely baffled by this problem, and have tried everything I can think of to fix it (checking console, recompiling script, changing perms with chmod/chown, etc.) and so far nothing has worked. Any help is appreciated. Thanks!

Can you post your code? I’m afraid we can’t answer questions like yours without the original source material to refer to.