Maximize (set active) or minimize TC with a unique keyboard shortcut

English support forum

Moderators: Hacker, petermad, Stefan2, white

DjobyDjoba
Junior Member
Junior Member
Posts: 52
Joined: 2006-10-23, 09:46 UTC

Re: A shortcut to toogle between activate (restore) TC <-> minimize it.

Post by *DjobyDjoba »

NotNull wrote: 2020-11-29, 20:34 UTC Method 2: AHK

- Replace WIN+N with your actual keyboard shortcut (I have a different keyboard layout
- Replace WinMaximize with WinActivate to restore the previous sindow size

Code: Select all

#SingleInstance FORCE

#n::
{
	IfWinActive ahk_class TTOTAL_CMD
	{
		WinMinimize ahk_class TTOTAL_CMD
		return
	}
	IfWinNotActive ahk_class TTOTAL_CMD
	{
		WinMaximize ahk_class TTOTAL_CMD
		return
	}
}
return

Doesn't work well with WinMaximize: maximize TC, then click on another window (application) on the taskbar -> often we can't go back to TC.
Seems to work well with WinActivate instead :)
NotNull
Senior Member
Senior Member
Posts: 298
Joined: 2019-11-25, 20:43 UTC
Location: NL

Re: A shortcut to toogle between activate (restore) TC <-> minimize it.

Post by *NotNull »

DjobyDjoba wrote: 2020-11-30, 11:55 UTC Doesn't work well with WinMaximize: maximize TC, then click on another window (application) on the taskbar -> often we can't go back to TC.
My bad! Last-minute I changed WinActivate to WinMaximize when I saw maximize in your post.
WinMaximize will maximize the window, but doesn't necessarily bring it to the front.
For that, you need WinMaximize + WinActivate

Here is an all-in-one version that starts TC when not loaded yet:
(replace the "c:\path to" with the actual path to TC )

Code: Select all

#SingleInstance FORCE

#n::
{
	WinGet, $TC_ID, ID, ahk_class TTOTAL_CMD
	
	If ($TC_ID = "") 
	{
		run "C:\path to\TOTALCMD64.EXE"
		return
	}

	IfWinActive ahk_id %$TC_ID%
	{
		WinMinimize ahk_id %$TC_ID%
		return
	}

	IfWinNotActive ahk_id $TC_ID
	{
		WinMaximize ahk_id %$TC_ID%
		WinActivate ahk_id %$TC_ID%
		return
	}
}
return
DjobyDjoba
Junior Member
Junior Member
Posts: 52
Joined: 2006-10-23, 09:46 UTC

Re: A shortcut to toogle between activate (restore) TC <-> minimize it.

Post by *DjobyDjoba »

NotNull wrote:an all-in-one version that starts TC when not loaded yet:
Thanks. Yes, I have too added this to the script (with IfWinNotExist, but it is all the same).

In fact I preferred to remove the WinMaximize line, so with only the WinActivate line TC is brought back to the front with its previous size (as you mentionned).
Post Reply