Page 1 of 1

Open/Close the current programm with one key

Posted: Dec 19th, ’20, 22:36
by Moniri
Hello! Please help me, I can't find the solution to my problem. How to make Open/Collapse the window of a certain application (e.g. Microsoft Word) with one hotkey. Thank you very much!

Re: Open/Close the current programm with one key

Posted: Dec 20th, ’20, 10:50
by Tom
Try this (Type: Command):

Code: Select all

PName:="ahk_exe WINWORD.EXE"  ;find the process name using Window Information Tool

if(WinExist(PName))
    if(WinActive(PName))
        WinMinimize, %PName%
    else
        WinActivate, %PName%
else
    run, winword  ;full path to the program
return

Re: Open/Close the current programm with one key

Posted: Dec 20th, ’20, 23:25
by Moniri
Tom wrote: Dec 20th, ’20, 10:50 Try this (Type: Command):

Code: Select all

PName:="ahk_exe WINWORD.EXE"  ;find the process name using Window Information Tool

if(WinExist(PName))
    if(WinActive(PName))
        WinMinimize, %PName%
    else
        WinActivate, %PName%
else
    run, winword  ;full path to the program
return
Super, everything works! Thank you!