Problem calling system.gui from app script

I have a gateway script which calls an app script.

The app script works fine UNTIL I try to put this code in it:

system.gui.messageBox(“Test”)

In the wrapper log it says

File "<TagChangeScript:swipeCard_Test/AP1Read>", line 18, in <module> INFO | jvm 1 | 2013/10/15 13:18:58 | File "<module:app.swipeCard>", line 6, in newRead INFO | jvm 1 | 2013/10/15 13:18:58 | AttributeError: 'com.inductiveautomation.ignition.common.script.Scr' object has no attribute 'gui'

Even though I have the “Import System” at the top of the script plus many other system requests in the same app script
i.e system.cb.runPrepUpdate etc

The original aim (4 hours ago) was to have the app script refresh a table on the open window which finally led me to where I am now :frowning:

Hi Brett,

Gateway scripts run on the Ignition Gateway server — they do not run in clients, so there are no GUI functions.

You should put your code in Client Scripts or event scripts.

Thanks nmudge.

Since the same code in the same app ‘folder’ location works when called by a button is it right to say that an app script runs in the same location that the script is that called it?

I get Gateway and Client scripts but am unsure how the app scripts function.
I would like to fully understand this because the Ignition manual uses a gui example for how to write an app and says you have to import system - which to a Noob like me says if you import system you have full access to all scripting functions.

Yes, the app functions run where they are called. app functions called in client scripts and event handlers will run in a client. app functions called in a Gateway Script run in the gateway.

Hello, I’m having the same issue calling any scripts with “system.gui.” from any of my event scripts.
I’m currently running on Ignition Gateway Platform 8.1.10 with Perspective Module 2.1.10.

It will not work on any of my Perspective Components Inputs or icons when configured in “Configure Events…” of any “Organize Actions”. I’ve followed all the examples given in the Ignition manual and videos on Inductive University and they all came with the same error:

Even with a simple script such as “system.gui.messageBox(“Hello World!”)” I’ll get this error message:

"Error running action ‘dom.onClick’ on Work House@D/root/Icon_0: AttributeError:
‘com.inductiveautomation.ignition.coom.script.Imm’ object has no attribute ‘gui’ "

Thank you for your help

Same problem, same answer - you can’t run system.gui scripts from anything that is in the gateway scope, which includes Perspective. They are for use in the Vision client.

If you’re trying to open a popup from Perspective then check out system.perspective.openPopup. It sounds like you may be reading the wrong section of the user manual and following the wrong videos if you’re using Perspective.

4 Likes