Open/Close the current programm with one key

Discussion, questions and support.
Post Reply
Moniri
Posts: 2
Joined: Dec 19th, ’20, 22:32

Post by Moniri » Dec 19th, ’20, 22:36

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!
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » 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
Moniri
Posts: 2
Joined: Dec 19th, ’20, 22:32

Post by Moniri » Dec 20th, ’20, 23:25

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!
Post Reply