FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
08-18-2023 05:50 PM
I have two local scripts that I am using to interact with a dialog. The first(OpenGuardStatus.txt) is located in the root of the project and opens the dialog based on the value of two variables. The second(CloseGuardStatus.txt) is located inside the dialog and sets one of the aforementioned variables to 1 when the dialog is opened and 0 when the dialog is closed.
When I add either of the local scripts to the projects individually, they work as intended. However when they are both added, they only work a single time. After that the dialog no longer opens and I can't change the value of one of the variables.
For reference, I'm currently using two virtual variables but I will eventually migrate to PLC variables after I get this working. I have both of the variables tied to toggle buttons so I can set/observe value changes.
Any advice would be greatly appreciated.
Solved! Go to Solution.
08-22-2023 08:18 AM
Can you please attach a basic HMI that illustrates the issue?
Also a note: when switching to non-virtual items you cannot use "im.getValue()", you have to use "im.readDirect()" instead, because for non-virtual items "im.getValue()" will only return the last value that has been read. but if you don't have the item subscribed anywhere at the moment of your LocalScript's execution the value might be null our outdated. Only "im.readDirect()" will make a call to the server to get the current value.
08-22-2023 08:42 PM