strange application problem

I have an script I made. It runs fine in the script editor. I have a program that starts the script. But, it keeps getting an error. I saved the script as an app, and when I run the saved app it does great. I made a script that tells the app I saved to run. It will run, but at the end it says process does not exist. So, I inserted it into an ignoring/end ignoring thing. It will open the app, but it dissapears immediatly, and does nothing. Does anyone know what makes this behaviour?

works, but has error at the end saying process does not exist :


tell application "security1"
activate
end tell

opens, but closes immediatly


ignoring application responses
tell application "security1"
activate
end tell
end ignoring

this seemed to fix it:

 ignoring application responses
tell application "security1" to run
end ignoring
 

Does the security1 application quit itself? If so, take that out and quit from the calling script.

It’s not saved as stay-open. In batch processing mode an applet will handle a single run or open request and quit as soon as it’s done executing that code, and that’s about it. If you need fancier event handling you’ll need to save it as stay-open; that way it’ll start an event loop which keeps it running and handling events normally until it receives an explicit quit event (either from itself or a third-party) to terminate that event loop.