Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Key to toggle minimize/restore



  • Please log in to reply
16 replies to this topic
GEV
  • Members
  • 1364 posts
  • Last active:
  • Joined: 23 Oct 2013

Unfortunately, the solution to this problem is not easy. Not all programs can switch their window in a simple way.
Some programs are running in “exclusive mode” to gain exclusive access to the graphics hardware.They lose this status if they are minimized. If they are restored they are trying to regain that status and this costs quite a bit of time and CPU load.
Under these circumstances, a script has it hard to manipulate the window.
 



theparakete
  • Members
  • 18 posts
  • Last active:
  • Joined: 26 Feb 2014

If I understand correctly, this should do the trick:
 

Capslock & NumpadDiv::
	DetectHiddenWindows, Off	
	Process, Exist, Notepad++.exe
	status = %ErrorLevel% 
	if status = 0
	{
		Run Notepad++
	}
		IfWinNotExist ahk_class Notepad++
	{
		WinShow, ahk_class Notepad++
		WinActivate, ahk_class Notepad++
	}
	Else
		IfWinExist, ahk_class Notepad++
	{
		WinMinimize, ahk_class Notepad++
		WinHide, ahk_class Notepad++
	}
	Return

If not, I apologize.

Dunno if the code could be simpler or prettier but this is what I use.
One hotkey to run, minimize/hide and restore applications. In the above case, Notepad++.