# Refresh Vision Client from script

**URL:** <https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956>\
**Category:** Ignition\
**Created:** [April 27, 2022, 8:54pm UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956 "2022-04-27T20:54:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [April 27, 2022, 8:54pm UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956/1 "2022-04-27T20:54:48Z")

</div>

Can I create a script to refresh the client based on a tag or property change?

This may not be the conventional way to do things, however on my system we have a Vision project for each Operation Station. The projects use docked windows to show relevant part information based on the components required at each station.

This can lead to gaps in the display. I have tried using expression binding in the Docked Index property to change the Index number of the window based on the part requirements. I can see the value change in my designer based on the expression however the client window only refreshes if the screen is touched.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 27, 2022, 9:09pm UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956/2 "2022-04-27T21:09:08Z")

</div>

I’ve only seen that sort of behavior from screen-savers and power savers. Check your power profile in your OS.

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [April 28, 2022, 1:46am UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956/3 "2022-04-28T01:46:17Z")

</div>

Power settings are all set to never sleep, never idle, never shut off. All power settings are set to highest performance now. Still having the same behavior.

The OS is windows 10.

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [May 5, 2022, 6:42pm UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956/4 "2022-05-05T18:42:28Z")

</div>

Still having the issue. Is there a way to simulate a mouse client on the client to cause the screen to refresh?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [May 5, 2022, 6:58pm UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956/5 "2022-05-05T18:58:52Z")

</div>

There is the java robot which lets your programatically move the mouse or type on the keyboard etc.

Only works with vision so you are in luck.

```auto
import java.awt.Robot

ROBOT_DELAY_MS = 1000

rob = java.awt.Robot()
rob.delay(ROBOT_DELAY_MS)

x=100
y=100
rob.mouseMove(x, y)

```

Maybe run this in a client timer script - check if client inactivity is over a certain amount, and if so, move to some randomly generated x/y coordinate. Check for inactivity because otherwise you may just move the mouse while a person is using it.

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [May 5, 2022, 8:14pm UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956/6 "2022-05-05T20:14:33Z")

</div>

Thank you for this, I applied it to a client event tag change, using the tags that I am looking at in my expression for the dock position. It appears to have worked. I will have to keep an eye on it and try it out in a few more areas.

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [May 6, 2022, 12:17am UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956/7 "2022-05-06T00:17:17Z")

</div>

This did not work. I could see my mouse moving when testing the client on my computer however to actually get the screen to refresh I would have to scroll the page. So I tried this:

```auto
from java.awt import Robot
from java.awt.event import KeyEvent

ROBOT_DELAY_MS = 500

rob = java.awt.Robot()
rob.delay(ROBOT_DELAY_MS)

rob.keyPress(KeyEvent.VK_PAGE_DOWN)
rob.delay(ROBOT_DELAY_MS)
rob.keyRelease(KeyEvent.VK_PAGE_DOWN)
rob.delay(ROBOT_DELAY_MS)
rob.keyPress(KeyEvent.VK_PAGE_UP)
rob.delay(ROBOT_DELAY_MS)
rob.keyRelease(KeyEvent.VK_PAGE_UP)

```

This works in the script console. But does not work on my client. They client computers are touchscreens. I’m now trying to find a function for scrolling a touchscreen down then back up.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 6, 2022, 6:16am UTC](https://forum.inductiveautomation.com/t/refresh-vision-client-from-script/58956/8 "2022-05-06T06:16:46Z")

</div>

I really think you should dig deeper in the OS for a screen power saving options. Those require actual OS-level user interaction, or a remote action that ties in at the OS level. `Robot` wouldn’t.

As a test, add VNC to a sample and see if that can make the screen wake up.
