I have a simple autohotkey code, but I cannot figure out how to make all 3 conditions met before doing the rules in the first bracket.
My code functions like, if any one condition is met, it will proceed. But I want to all 3 conditions met before proceeding.
The conditions should be:
- the title of the window must be September-Sales.
- the window must be Microsoft Word
- process winword.exe
Start: IfWinExist, September-Sales ; (Title of the Microsoft Word Window) if WinExist("ahk_class OpusApp") ; class if WinExist("ahk_exe WINWORD.EXE") ; process { WinActivate SendInput, {Tab} SendInput, {Invoice Category} SendInput, {Enter} } else msgbox, Call the Encoder and give the O.R. Number. Return End 12 Answers
The Autohotkey documentation on IfWinExist / IfWinNotExist / WinExist provides an example of multiple conditions.
if WinExist("ahk_class Notepad") or WinExist("ahk_class" . ClassName)
For your purposes, you would want the following code
if WinExist("September-Sales") and WinExist("ahk_class OpusApp") and WinExist("ahk_exe WINWORD.EXE") { ... } 6You are ending your statements too early with the ';' operator.
if WinExist("ahk_exe WINWORD.EXE") && WinExist("ahk_class OpusApp") { WinActivate SendInput, {Tab} SendInput, {Invoice Category} SendInput, {Enter} } else { msgbox, Call the Encoder and give the O.R. Number. } Return