# Check what screen a client is open on

**URL:** <https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970>\
**Category:** Ignition\
**Tags:** vision, ignition79\
**Created:** [July 22, 2020, 11:22pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970 "2020-07-22T23:22:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 22, 2020, 11:22pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/1 "2020-07-22T23:22:29Z")

</div>

v7.9.14

How would I check what screen a client is open on? E.g. I have 2 TV screens connected to Ignition and have two separate clients open (not two desktops, as these don’t work with the Windows scaling I have configured :/), and I want to know if the client i’m looking at is on screen 1 or screen 2.

Also, how do I get a reference to the FPMIApp?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [July 23, 2020, 3:37am UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/2 "2020-07-23T03:37:12Z")

</div>

In 8.x you’d use [system.gui.getScreenIndex](https://docs.inductiveautomation.com/display/DOC80/system.gui.getScreenIndex). In 7.9 I expect you’ll need to dig into Java something like examples [here](https://stackoverflow.com/questions/2234476/how-to-detect-the-current-display-with-java/23612702).

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 23, 2020, 12:28pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/4 "2020-07-23T12:28:20Z")

</div>

[https://docs.inductiveautomation.com/display/DOC79/system.gui.getScreens](https://docs.inductiveautomation.com/display/DOC79/system.gui.getScreens)  
??  
We use this to determine if we load the full side navigation or a popup window.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 23, 2020, 12:53pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/5 "2020-07-23T12:53:34Z")

</div>

> [@MMaynard](#):
>
> [system.gui.getScreens - Ignition User Manual 7.9 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC79/system.gui.getScreens)  
> ??

That function gets the screens available, but doesn't tell you what screen an open client is already on.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 23, 2020, 1:22pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/6 "2020-07-23T13:22:16Z")

</div>

That is what getCurrentDesktop is for.  
Run that on the clients, write it to a memory tag and then you will have the references.  
Then you can check for the values and do whatever you need to do.

[https://docs.inductiveautomation.com/display/DOC79/system.gui.getCurrentDesktop](https://docs.inductiveautomation.com/display/DOC79/system.gui.getCurrentDesktop)

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 23, 2020, 1:30pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/7 "2020-07-23T13:30:52Z")

</div>

Maybe I’m missing something, but I still don’t see how I can get the current screen (as in the monitor) that the client/desktop is on from that? `system.gui.getCurrentDesktop` just returns a handle as a string of the current client desktop, with which you can get a reference to `system.gui.*` functions relative to the handle.  
There is a function `system.gui.setScreenIndex`, but I need `system.gui.getScreenIndex` (as witman pointed out is available in 8).  
I want to open a particular page on client startup based on the monitor/screen it’s on.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 23, 2020, 1:34pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/8 "2020-07-23T13:34:38Z")

</div>

[https://docs.inductiveautomation.com/display/DOC79/system.gui.getScreens](https://docs.inductiveautomation.com/display/DOC79/system.gui.getScreens)

??

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 23, 2020, 1:35pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/9 "2020-07-23T13:35:55Z")

</div>

That gets a list of all monitors that are available on the PC…  
??

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 23, 2020, 1:40pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/10 "2020-07-23T13:40:47Z")

</div>

Correct, and the screen index of each corresponds to the screen index in the system.  
When you open the display properties in Windows, click the Identify button and it shows 1,2,3 etc on each screen. You can then tell the client to open whatever window or desktop on whatever screen index you want.

I’m not sure what actual value you are looking to get, you can’t get any system level stuff like serial numbers of the screens without doing some outside power scripting.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 23, 2020, 1:43pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/11 "2020-07-23T13:43:14Z")

</div>

I think you’re misunderstanding what I have. I already have a client running on the screen I want it on, the problem is that I have two clients, one running on either or 2 screens. I want to know which client is running on screen 2 so that I can launch the right screens. I set the screen for it to launch on within the client’s shortcut switches

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 23, 2020, 1:51pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/12 "2020-07-23T13:51:42Z")

</div>

> [@witman](#):
>
> I expect you’ll need to dig into Java something like examples [here](https://stackoverflow.com/questions/2234476/how-to-detect-the-current-display-with-java/23612702).

I actually tried this already as @paul-griffith posted something similar using that library a while back, but all it ever states is that it's on screen 0, despite moving it to other monitors ☹

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 23, 2020, 1:55pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/13 "2020-07-23T13:55:27Z")

</div>

When you open the client, name the screen with a handle.  
Then you can use that desktop “name” in the navigation.  
We launch other instances from the main client onto other monitors.  
Maybe that is the issue? We have a few locations that actually launch up to 8 instances on separate monitors all driven off of one computer.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 23, 2020, 2:05pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/14 "2020-07-23T14:05:15Z")

</div>

Hmm, to set the handle I would need to set it via the Windows shortcut startup parameters, however I don’t see the handle being possible to pass in ([Native Client Launchers - Ignition User Manual 7.9 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC79/Native+Client+Launchers))  
I can’t set this from the startup script (otherwise there would be no use for this post 🙂 )

I initially was starting this second screen using `system.gui.openDesktop()`, however with the TV setup we have onsite, I couldn’t get both screens to display as fullscreen, and I spent a while trying to work it out. Windows scaling had to be set to 175% on one TV and 100% on the other, but even testing them both at 100% I couldn’t get them both fullscreen either - one would go fullscreen and the other would be at some stupid zoom but the client itself would be clipped to about 3/4 of the TV screen… The only way I could get it working was to launch independent clients, and even then I still have to coerce the second client to go fullscreen by manually nudging the client… It’s a PITA!

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [July 23, 2020, 2:50pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/15 "2020-07-23T14:50:11Z")

</div>

@nminchin would a script like [this](http://forum.inductiveautomation.com/t/max-window-size-in-different-monitors/32030/3) work to set the windows full screen for you? It works to maximize a window to full screen mode (a second desktop, not a separate client) on two different monitors with different scaling on Windows 10 for me.

I should note the position recall on return to windowed state does _not_ work well on the right monitor in a dual monitor setup with different scaling. It has the same issues as Designer windows that do weird stuff when switching between scaling on the monitors. But the swap to full screen mode works reliably filling the entire monitor on whichever monitor it is on.

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [July 24, 2020, 4:07pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/16 "2020-07-24T16:07:30Z")

</div>

> I initially was starting this second screen using `system.gui.openDesktop()` , however with the TV setup we have onsite, I couldn’t get both screens to display as fullscreen, and I spent a while trying to work it out. Windows scaling had to be set to 175% on one TV and 100% on the other, but even testing them both at 100% I couldn’t get them both fullscreen either - one would go fullscreen and the other would be at some stupid zoom but the client itself would be clipped to about 3/4 of the TV screen… The only way I could get it working was to launch independent clients, and even then I still have to coerce the second client to go fullscreen by manually nudging the client… It’s a PITA!

Sounds like you could justify a properly engineered and configured set of monitors. 😉  
Curious to see what the programming solution is to this mechanical problem.

---

<div class="post-metadata">

**Author:** ![harold.bruulsema](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@harold.bruulsema](https://forum.inductiveautomation.com/u/harold.bruulsema)\
**Post date:** [July 30, 2020, 3:01pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/17 "2020-07-30T15:01:22Z")

</div>

I use something that you could possibly use for this purpose:

- a Global (shared) script, that implements functions WindowOpened and WindowClosed, to write who opened/closed what window to the audit\_events table
- a script on the visionWindowOpened event (and a corresponding script on the visionWindowClosed event) on every window in the project.

I use this so I can track operator actions. I’m thinking you could query the most recent WindowOpened event in the audit\_events table, to see which window was most recently opened for the client of interest. I don’t know if this is the most effficient way to accomplish what I want, but it works for me.

**visionWindowOpened event:**

`shared.WindowScript.WindowOpened(system.gui.getParentWindow(event).name, '') 
`

**Global (shared) script (named “windowScript”)**

```auto
# these scripts by HAB are used to log all Operator Screen opens/closes to Audit_Events table
# called by event handler scripts on every screen - one script for ScreenOpen, one script for ScreenClosed 
def WindowOpened(WindowName, TagPath):
	Actor = system.tag.read("[System]Client/User/Username").value
	ActorHost = system.tag.read("[System]Client/Network/Hostname").value
	Action = 'OpenWindow'
	ActionTarget = WindowName
	ActionValue = TagPath
	from java.util import Date
	CurrTime = Date()
	StatusCode = 0
	OriginatingSystem = 'project='+system.tag.read("[System]Client/System/ProjectName").value
	OriginatingContext = 22 #value to enable searching for tag events
	try:
		system.db.runPrepUpdate("INSERT INTO audit_events " \
        	                    "(event_timestamp, actor, actor_host, action, action_target, " \
        	                    "action_value, status_code, originating_system, originating_context) " \
	                            "VALUES " \
	                            "(?, ?, ?, ?, ?, " \
	                            "?, ?, ?, ?)", 
 	                            [CurrTime, Actor, ActorHost, Action, ActionTarget,
	                            ActionValue, StatusCode, OriginatingSystem, OriginatingContext], 
	                            database='Ignition_SQL_App001') #must include database connection name
	except:
		pass 
```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 3, 2020, 4:30pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/18 "2020-08-03T16:30:26Z")

</div>

Been meaning to get back to this topic, but my daughter’s wedding has been keeping my household busy.

```python
# get the source of a component
component = event.source

# get Screen number that component is in.
screen = component.getGraphicsConfiguration().getDevice().getScreen()

print screen

```

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 4, 2020, 1:39am UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/19 "2020-08-04T01:39:27Z")

</div>

Lots of good solutions! However keep in mind that I’m looking to get the screen the client is open on, **before** any Windows are open (i.e. it’s just the blank grey client area). I guess I could open up a dummy window first to use some of these solutions, but if I can get the screen without having a Window open, then that’d be far more efficient

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 4, 2020, 5:52pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/20 "2020-08-04T17:52:54Z")

</div>

> [@nminchin](#):
>
> **before** any Windows are open

I'm not at my desk, so no extra screens, but this seems to work in a Client Startup Script.

```python
import java.awt

gd=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()

screen = gd.getScreen()
width = gd.getDisplayMode().getWidth()
height = gd.getDisplayMode().getHeight()

tagNames = ['[client]ScreenNum', '[client]ScreenWidth', '[client]ScreenHeight']
values = [screen, width, height]

system.tag.writeBlocking(tagNames, values)

```

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 4, 2020, 11:46pm UTC](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970/21 "2020-08-04T23:46:46Z")

</div>

> [@witman](#):
>
> In 7.9 I expect you’ll need to dig into Java something like examples [here](https://stackoverflow.com/questions/2234476/how-to-detect-the-current-display-with-java/23612702).

I did try using that and @witman mentioned looking at it as well, however the `gd.getScreen()` (or `gd.screen`) always displays 0, regardless of what screen it's actually on 😕

[Next page](https://forum.inductiveautomation.com/t/check-what-screen-a-client-is-open-on/36970.md?page=2)
