Message sent when clicking on taskbar to minimze window

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
S0L
Posts: 21
Joined: 22 Jan 2014, 09:34

Message sent when clicking on taskbar to minimze window

17 May 2019, 12:57

Hi.

Have a problem with certain application regarding minimization to be exact application would only properly minimize when clicking on her icon on taskbar. Now my question is what message is sent to application window when clicking on taskbar and could I replicate it with send/post message?

Code: Select all

<!3:: ; <--- SuperMemo

if(!WinExist("ahk_class TElWind ahk_class  TApplication ahk_exe sm18.exe"))
	
ShellRun("C:\SuperMemo\sm18.exe")

else
{
	if(!WinActive("ahk_class TElWind ahk_class TApplication ahk_exe sm18.exe"))
		
		WinActivate,
	else
		WinMinimize,
}

return
Have this for code which works for other applications that am using but this application is pain.


Thanks for the time
vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Re: Message sent when clicking on taskbar to minimze window

17 May 2019, 13:32

Try adding ahk_exe sm18.exe after WinActivate and WinMinimize

I have seen those two commands failing when what they are supposed to minimize or active is not specified in them even tho they are supposed to execute that command to the last found window specified in a line above them

Also,I am not sure this actually work that way.
You can add a msgbox to appear to see if the function actually finds a window searched this way
"WinActive("ahk_class TElWind ahk_class TApplication ahk_exe sm18.exe")"
S0L
Posts: 21
Joined: 22 Jan 2014, 09:34

Re: Message sent when clicking on taskbar to minimze window

17 May 2019, 14:57

vsub wrote:
17 May 2019, 13:32
Try adding ahk_exe sm18.exe after WinActivate and WinMinimize

I have seen those two commands failing when what they are supposed to minimize or active is not specified in them even tho they are supposed to execute that command to the last found window specified in a line above them

Also,I am not sure this actually work that way.
You can add a msgbox to appear to see if the function actually finds a window searched this way
"WinActive("ahk_class TElWind ahk_class TApplication ahk_exe sm18.exe")"
Already tried your first suggestion, msgbox finds windows. The problem with this program is that its compromised of multiple smaller windows. I have found the "main" window class which minimizes all windows besides one. Only way to successfully minimize all of windows of this program is through taskbar mouse clicking on its icon.
vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Re: Message sent when clicking on taskbar to minimze window

17 May 2019, 16:31

How about this then
This minimizes all visible windows of this process

Code: Select all

SetWinDelay,0
SetBatchLines,0
WinGet,ID,List,ahk_exe sm18.exe
Loop, %ID%
{
ID := ID%A_Index%
WinMinimize,ahk_id %ID%
}
S0L
Posts: 21
Joined: 22 Jan 2014, 09:34

Re: Message sent when clicking on taskbar to minimze window

18 May 2019, 05:02

vsub wrote:
17 May 2019, 16:31
How about this then
This minimizes all visible windows of this process

Code: Select all

SetWinDelay,0
SetBatchLines,0
WinGet,ID,List,ahk_exe sm18.exe
Loop, %ID%
{
ID := ID%A_Index%
WinMinimize,ahk_id %ID%
}
thanks for input, minimizing works great but have two issues when implementing the fix.

Code: Select all

if(!WinExist("ahk_class TElWind ahk_class TApplication ahk_exe sm18.exe")) ; you can stack different identifiers, such as title, class, and exe
	
	ShellRun("C:\SuperMemo\sm18.exe")

else
{
	if(!WinActive("ahk_exe sm18.exe"))
	{
		SetWinDelay,0
		SetBatchLines,0
		WinGet,ID,List,ahk_exe sm18.exe
		Loop, %ID%
		{
			ID := ID%A_Index%
			WinActivate, ahk_id %ID%
			Sleep, 19999
		}
		
		
	}	
	else
		SetWinDelay,0
		SetBatchLines,0
		WinGet,ID,List,ahk_exe sm18.exe
		Loop, %ID%
	{
		ID := ID%A_Index%
		WinMinimize, ahk_id %ID%
	}
	
}

return
1. after WinActivate I have implemented sleep because it would instantly run second part of the script with else and winminimize

2. problem you can see in the picture this is what happens when trying to winactivate, there are other windows of the program "laying" close to the taskbar and not activating. It is like he can't or doesn't know which window to activate
2019-05-18_11-55-19.png
2019-05-18_11-55-19.png (85.07 KiB) Viewed 876 times

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: newbieforever, Rohwedder and 99 guests