I am trying to make a basic shortcut for windowsHome + Shift + w. If word is open, I would like to set Word as the active window and maximize Word; else, if word isn't open, I would like to open a specified word document. This script works fine running once but can't run multiple times without restarting the script. I tried adding #Persistent and a never-ending while loop but this still doesn't work. What I am doing wrong? Thank you for your help in advance! I will definitely rate you up if you help me out.
#Persistent
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
#+w::
while 1
{
IfWinExist *.docx - Microsoft Word
{
WinActivate
WinMaximize
}
else
{
Run, C:\Users\myHome\Desktop\311.docx
}
}
return