Scripting from Other Window

Hi, I want to ask on how to scripting form other window. Which mean that I write a value in other window then call it in other window. An example I write a value in other window and call the value using button to read the value.

Is this value only for the client? Or is this a value that other clients will need to read?

If this is only for the same client, then you can use a client tag.

If this is a value that other clients will need to access, then you can use a regular tag.

1 Like

Actually I used pymodbus communication between ignition and my python script to communicated. Then the value that I wrote is in my modbus tags and I want the ignition read the value from the tags. The value “50” will be store in “state1” and the “UP” button will read the “state1” value.

1
2
3

it looks like you are there…

The red data indicates an issue.

If you click on the arrow next to the state1 tag what does the quality say for that tag?

1 Like

The red meant that I don’t connect with the hardware. Once I connected to the hardware it will be normal.

Ok if you have tags in the tag browser, then any window can communicate with it.

Or maybe I’m not understanding the issue…

1 Like

It’s alright.
This the script that I wrote in ignition for read the value. “line 6”. Did the way I wrote is correct?

4

What version of Ignition?

1 Like

I used ignition 8.1.14

OK then to write a tag in 8.1.14 take a look at this: system.tag.writeBlocking - Ignition User Manual 8.1 - Ignition Documentation
To read a tag in 8.1.14 look at this: system.tag.readBlocking - Ignition User Manual 8.1 - Ignition Documentation

Can you post your code with ``` before and after so that we can more easily read it?

Alright, I will try to write code using the ignition 8.1.14 way.
you meant like this:

event.source.background = system.gui.color(0,255,0)
system.tag.writeBlocking("[Edge]Indicator Panel/PWM-CBM_Module 1/module1_DriveUp", 1)
system.tag.readBlocking("[edge]Rozum/UnitId 0/state1-state12/state1")

Try this

event.source.background = system.gui.color(0,255,0)
system.tag.writeBlocking(["[Edge]Indicator Panel/PWM-CBM_Module 1/module1_DriveUp"],[1])
readValue = system.tag.readBlocking(["[edge]Rozum/UnitId 0/state1-state12/state1"])[0].value

The final value from the state1 tag would reside in the variable readValue

I followed your code and no error from ignition. But I don’t have the hardware to see the output. it’s possible execute without the hardware?

It should. You should see the tag change value. But a better test is to do it with hardware obviously.