Dual Monitor Startup Script

Okay, check this out. Here is some code to pass parameters from command line switch to client tags. Then use the client tags in ignition. In Version 7.4 and beyond the startup parameters are mapped to client tags in the root directory directly. Then using the startup script below, the command line parameters open the window (also a parameter – DW) in a specific position.

By changing the target in the shortcut to include the parameters, you may launch the same project however have it open to 2 different screens on independent location (or monitors)

Example

Shortcut #1
	[code]C:\Windows\SysWOW64\javaws.exe http://localhost:8088/main/system/launch/client/Test_App.jnlp?DW=Window1&X=0&Y=0&H=1080&W=1920[/code]

	This opens on monitor 1 to “Window 1”

Shortcut#2
	[code]C:\Windows\SysWOW64\javaws.exe http://localhost:8088/main/system/launch/client/Test_App.jnlp?DW=Window3&X=1921&Y=0&H=1080&W=1920[/code]

	This shortcut opens to monitor 2 to “Window 3”

This would allow us to create 2 shortcuts in the start menu to the same project, launching 2 separate clients (both to the same project) and allow us to dictate their position.

[code]from javax.swing import SwingUtilities,JFrame
from java.awt import GraphicsEnvironment,Rectangle

Default = system.tag.read("[Client]DW")
X=system.tag.read("[Client]X")
Y=system.tag.read("[Client]Y")
H=system.tag.read("[Client]H")
W=system.tag.read("[Client]W")

if Default.value != ‘’:
window = system.nav.openWindow(Default.value)
frame = SwingUtilities.getAncestorOfClass(JFrame, window)
frame.setBounds(X.value,Y.value,H.value,W.value)
[/code]

1 Like

Thanks for sharing that! That will help out a lot of people.