My client wants a button to minimize the window in Perspective, they access Perspective workstation through a RDP with the connection bar of the RDP disabled. Perspective workstation is running in Fullscreen / kiosk mode.
We would like to create a button that minimizes the Perspective window.
We imagine this can be done with a script on a button? or is there a build in command for this?
Hello, you may try add an event onActionPerformed to your button with:
Example Using Jython (subprocess):
import subprocess
try:
# PowerShell command to minimize all windows (you can target Perspective specifically if needed)
command = [
"powershell",
"-Command",
"(New-Object -ComObject Shell.Application).MinimizeAll()"
]
# Execute the PowerShell script
subprocess.Popen(command)
except Exception as e:
system.perspective.print("Error minimizing window: " + str(e))
Since Perspective Workstation is a standalone application (not browser-based), you can call an external script to interact with the operating system and minimize the application window.
Another way would be:
1st: PowerShell Script for Minimizing a Specific WindowÇ
# PowerShell script to minimize a window by title
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class User32 {
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
}
"@
$windowTitle = "Perspective Workstation" # Adjust to the title of your Perspective window
$hwnd = [User32]::FindWindow($null, $windowTitle)
if ($hwnd -ne [IntPtr]::Zero) {
[User32]::ShowWindow($hwnd, 6) # Minimize the window (6 = SW_MINIMIZE)
} else {
Write-Output "Window not found"
}
Correct. There is no single function to go from kiosk mode to minimized. Sorry. Perhaps this should be put up on IA's Feature Request portal, as it probably isn't a big task to add to Workstation.
This smells of ChatGPT. Don't put user questions from here into there - it really does not have a good understanding of the Ignition (especially perspective) architecture or jython.