forced run minimized, possible?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
tatagi
Posts: 181
Joined: 23 Aug 2018, 11:17

forced run minimized, possible?

Post by tatagi » 25 Mar 2023, 19:50

some of my program doesn't allow for run as minimized. for example, the PDF viewer "SumatraPDF" always run in the foreground.

Code: Select all

^!t::Run, "C:\Users\JohnDoe\AppData\Local\SumatraPDF\SumatraPDF.exe", , Min
this never works.

I tried to see if changing the settings in the shortcut's properties dialog(from normal window to minimized on the run dropdown menu) would make a difference, still no luck.

Winwait & Winminimize trick is not preferred because for a few hundreds of millisecond the window is kept on foreground which conflicts with my other script.

any workaround that gets me the desired result?

User avatar
mikeyww
Posts: 26611
Joined: 09 Sep 2014, 18:38

Re: forced run minimized, possible?

Post by mikeyww » 25 Mar 2023, 21:04

Code: Select all

#Requires AutoHotkey v1.1.33
app := "d:\utils\sumatraPDF\SumatraPDF.exe"

^!t::
WinSet AlwaysOnTop, On, % active := "ahk_id" WinActive("A")
Run % app
WinWait % "ahk_exe" app
WinMinimize
WinSet AlwaysOnTop, Off, % active
SoundBeep 1500
Return

Post Reply

Return to “Ask for Help (v1)”