# Minimize window button

**URL:** <https://forum.inductiveautomation.com/t/minimize-window-button/98847>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [November 20, 2024, 9:35am UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847 "2024-11-20T09:35:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mads\_Lyngsie](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@Mads\_Lyngsie](https://forum.inductiveautomation.com/u/Mads_Lyngsie)\
**Post date:** [November 20, 2024, 9:35am UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/1 "2024-11-20T09:35:15Z")

</div>

Hello Everyone

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?

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [November 20, 2024, 11:48am UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/2 "2024-11-20T11:48:14Z")

</div>

Hello, you may try add an event onActionPerformed to your button with:

#### Example Using Jython (`subprocess`):

```python
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Ç

```python
# 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"
}

```

2nd: Jython Script to Call PowerShell:

```python
import subprocess

try:
    # Path to the PowerShell script
    script_path = "C:\\path\\to\\MinimizePerspective.ps1"

    # Execute PowerShell
    command = ["powershell", "-ExecutionPolicy", "Bypass", "-File", script_path]
    subprocess.Popen(command)
except Exception as e:
    system.perspective.print("Error minimizing Perspective Workstation: " + str(e))

```

I haven´t try any of this methods. You may check if they work.

---

<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:** [November 20, 2024, 12:09pm UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/3 "2024-11-20T12:09:43Z")

</div>

> [@Alejandro\_Alaco](#):
>
> you can call an **external script** to

You cannot. That is a Vision capability.

> [@Mads\_Lyngsie](#):
>
> Perspective workstation is running in Fullscreen / kiosk mode.

The whole point of kiosk mode is to forbid access to the desktop.

Don't run in kiosk mode.

---

<div class="post-metadata">

**Author:** ![Mads\_Lyngsie](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@Mads\_Lyngsie](https://forum.inductiveautomation.com/u/Mads_Lyngsie)\
**Post date:** [November 20, 2024, 12:49pm UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/4 "2024-11-20T12:49:14Z")

</div>

We are trying to preserve space by running in kiosk / Fullscreen mode to avoid scaling our views.

If the client wants to minimize and we would prefer not to run in window mode is there any other options?

@ pturmel What mode would u recommend? is there only window mode else?

---

<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:** [November 20, 2024, 12:59pm UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/5 "2024-11-20T12:59:42Z")

</div>

Try using this function on a button (perhaps in a dock):

[system.perspective.workstation.toWindowed()](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-workstation/system-perspective-workstation-toWindowed)

Note that there is a peer function for going back to kiosk mode.

---

<div class="post-metadata">

**Author:** ![Mads\_Lyngsie](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@Mads\_Lyngsie](https://forum.inductiveautomation.com/u/Mads_Lyngsie)\
**Post date:** [November 20, 2024, 1:09pm UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/6 "2024-11-20T13:09:20Z")

</div>

My client doesn't like the way it switches they would prefer if it was 1 button press to minimize and we ran in Fullscreen and not window

But it does seem like a impossible task, i appreciate the help

---

<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:** [November 20, 2024, 1:11pm UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/7 "2024-11-20T13:11:52Z")

</div>

> [@Mads\_Lyngsie](#):
>
> impossible task

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](https://ideas.inductiveautomation.com/), as it probably isn't a big task to add to Workstation.

---

<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:** [November 20, 2024, 2:30pm UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/8 "2024-11-20T14:30:07Z")

</div>

> [@Alejandro\_Alaco](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 20, 2024, 2:34pm UTC](https://forum.inductiveautomation.com/t/minimize-window-button/98847/9 "2024-11-20T14:34:15Z")

</div>

> [@bkarabinchak.psi](#):
>
> This smells of ChatGPT. Don't put user questions from here into there ...

Alejandro has been asked several times not to do that.
