# Scripting from Other Window

**URL:** <https://forum.inductiveautomation.com/t/scripting-from-other-window/56334>\
**Category:** Ignition\
**Tags:** vision, scripting\
**Created:** [February 19, 2022, 4:52pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334 "2022-02-19T16:52:27Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohamad\_Yahya\_Samsud](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mohamad\_Yahya\_Samsud](https://forum.inductiveautomation.com/u/Mohamad_Yahya_Samsud)\
**Post date:** [February 19, 2022, 4:52pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/1 "2022-02-19T16:52:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 19, 2022, 5:01pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/2 "2022-02-19T17:01:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mohamad\_Yahya\_Samsud](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mohamad\_Yahya\_Samsud](https://forum.inductiveautomation.com/u/Mohamad_Yahya_Samsud)\
**Post date:** [February 19, 2022, 5:14pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/3 "2022-02-19T17:14:49Z")

</div>

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](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/2/32af717e06173745e6c03549452f6d1b446a2cff.jpeg)  
 ![2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/f/cfb8d0a8feea1c9541ad8604e9a0bbfecbd81930.jpeg)  
 ![3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/f/7f1c90a4d28d509202e230bd6b7c7b50930b8e1f.jpeg)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 19, 2022, 5:17pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/4 "2022-02-19T17:17:32Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mohamad\_Yahya\_Samsud](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mohamad\_Yahya\_Samsud](https://forum.inductiveautomation.com/u/Mohamad_Yahya_Samsud)\
**Post date:** [February 19, 2022, 5:19pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/5 "2022-02-19T17:19:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 19, 2022, 5:19pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/6 "2022-02-19T17:19:49Z")

</div>

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

Or maybe I’m not understanding the issue…

---

<div class="post-metadata">

**Author:** ![Mohamad\_Yahya\_Samsud](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mohamad\_Yahya\_Samsud](https://forum.inductiveautomation.com/u/Mohamad_Yahya_Samsud)\
**Post date:** [February 19, 2022, 5:25pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/7 "2022-02-19T17:25:33Z")

</div>

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](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/7/17395a7e0500047c05d7087e7f1c8f16b610d8be.jpeg)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 19, 2022, 5:37pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/8 "2022-02-19T17:37:29Z")

</div>

What version of Ignition?

---

<div class="post-metadata">

**Author:** ![Mohamad\_Yahya\_Samsud](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mohamad\_Yahya\_Samsud](https://forum.inductiveautomation.com/u/Mohamad_Yahya_Samsud)\
**Post date:** [February 19, 2022, 5:38pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/9 "2022-02-19T17:38:32Z")

</div>

I used ignition 8.1.14

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 19, 2022, 5:41pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/10 "2022-02-19T17:41:08Z")

</div>

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](https://docs.inductiveautomation.com/display/DOC81/system.tag.writeBlocking)  
To read a tag in 8.1.14 look at this: [system.tag.readBlocking - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.tag.readBlocking)

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

---

<div class="post-metadata">

**Author:** ![Mohamad\_Yahya\_Samsud](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mohamad\_Yahya\_Samsud](https://forum.inductiveautomation.com/u/Mohamad_Yahya_Samsud)\
**Post date:** [February 19, 2022, 5:46pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/11 "2022-02-19T17:46:48Z")

</div>

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")

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 19, 2022, 5:49pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/12 "2022-02-19T17:49:11Z")

</div>

> [@Mohamad\_Yahya\_Samsud](#):
>
> 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

```auto
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

---

<div class="post-metadata">

**Author:** ![Mohamad\_Yahya\_Samsud](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mohamad\_Yahya\_Samsud](https://forum.inductiveautomation.com/u/Mohamad_Yahya_Samsud)\
**Post date:** [February 19, 2022, 5:55pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/13 "2022-02-19T17:55:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 19, 2022, 6:01pm UTC](https://forum.inductiveautomation.com/t/scripting-from-other-window/56334/14 "2022-02-19T18:01:59Z")

</div>

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