Calling an external application through scripting

Here is an overview of what I am trying to do. I have a standard transaction group that executes off a trigger. So when the trigger tag in the PLC goes high, i have a triggered expression item that has an expression behind it. That expression looks like this…
runScript(app.RunApp.CallApplication())

Obviously I also have a Script module under app.RunApp that looks like this
def CallApplication():
import system
system.execute(calc.exe)

When I run the group, I get an evaluation error in my expression item. I just want to run a windows application when a bit in the PLC gets turned on Im guessign its in my script, probably the system.execute statement. Does anyone know what I am missing? Is there an easier way to do this?

I think an easier way to do this would be to put your code into a client tag change event script (these are found under Configuration / Event Scripts (Client) in the Project Browser).

When you select Tag Change, you can then choose which SQLTag you want to trigger your script - this will have to be a SQLTag tied to your PLC trigger bit. You script should then look something like this:if newValue.value == 1: system.util.execute(["calc.exe"])The first line makes sure the script only triggers when the trigger bit goes high, otherwise it will trigger both when it goes high and low.

Note that you have to do this on the client as you are wanting something to happen on the screen - this won’t work if you try to do it on the server using a Gateway script. If you only want this to happen on certain clients, you will have to check for the client name (perhaps by using the System/Client/Network/Hostname SQLTag) in your script.