3
votes

I simply wish to be able to toggle with a hotkey Minimize & Maximize on one certain full screen app that I always use. I want to use this for only one app, and not whichever app has focus.

I have read dozens of ways to do this online, none of which have worked.

I know there are a few commands that I could use:

WinMinimize, A
WinMaximize, A

But I am not sure how to string it all together. When looking for examples I came up with this somewhere:

^#n::
IfWinExist, ahk_class Notepad
{
WinGet,WinState,MinMax,ahk_class Notepad
If WinState = -1
   WinMaximize
else
   WinMinimize
}
; else
;   Run, Notepad
Return

However this only maximized my app, and not minimized it. Perhaps this was due to the fact app was a fullscreen app, i don't know.

2
You should describe what you've tried and how it didn't work for you. See How do I ask a good question?. Without your details, the best I can suggest is to use ActivateWindow, WinMaximize and WinMinimizeJim U
@JimU hi thanks. I have posted an example of the code that didtn work.Kalamalka Kid
The code for ^#n you posted works for me. I tested it in isolation by 1) right clicking the AutoHotKey icon on the task bar and choosing Edit This Script, 2) pasting your code into it, replacing the existing code, 3) right clicking the AutoHotKey icon again and choosing Reload This Script, 4) Starting notepad, 5) pressing Control+Win+N repeatedly - The notepad window maximized and minimized as intended. I had only one instance of Notepad running.Jim U
@JimU THanks for the tip. I understand how to reload and edit scripts.. So this being said, this might work fine for Notepad, but it does not work my full screen game. I mentioned this in the original post about the app being full screen.Kalamalka Kid

2 Answers

1
votes

I was able to retrieve some information from another website which helped me come to an answer which might be useful for other users. When used with AutoHotKey this script will work for full-screen apps by using the following code:

Joy12::
WinGetPos, X, Y, Width, Height, WindowName
if (X == -32000)
WinMaximize, WindowName
else if (X == 0 and Y == 0 and Width == 1920 and Height == 1080)
WinMinimize, Resident Evil 4
WinActivate, Program Manager
return

users may have to make small changes to the code, replacing Joy12 with whatever key they wish to use, and replacing WindowName with the name of window they wish to use. Users may also have to change the following values:

1920 and Height == 1080

to whatever their full screen resolution is.

-1
votes

I had the same requirement for Calculator, after a bit! of experimenting I came up with this:

;! is alt
!c:: ;calculator

IfWinExist Calculator
{  
  Gosub, process_calc
} else {
   run calc
}
return

process_Calc:
  WinGetPos, x, y,,,Calculator
  if (x = 0) {                ; Calculator is minimized to Taskbar
  WinMinimize Calculator      ;WinMinimize is needed to select Calculator(other Win.... didn't work).
  WinRestore Calculator
} else {
  WinMinimize Calculator      ; Alt-C now alternates between Minimize/Restore to/from Taskbar
}
return