How to chain multiple If win statments on same line Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
slyfox1186
Posts: 52
Joined: 28 Oct 2018, 23:56

How to chain multiple If win statments on same line

Post by slyfox1186 » 23 Mar 2023, 14:12

So v2 has me confused.

It use to be

Code: Select all

If !WinActive(win) && If WinExist(win)
    Stuff here
I tried

Code: Select all

If WinActive(win) && If not WinExist(win)
    Stuff here
That didn't work.

Any help?

neogna2
Posts: 586
Joined: 15 Sep 2016, 15:44

Re: How to chain multiple If win statments on same line  Topic is solved

Post by neogna2 » 23 Mar 2023, 14:21

Code: Select all

If !WinActive(win) && WinExist(win)
    MsgBox 123
That works in both v2 and v1.

User avatar
slyfox1186
Posts: 52
Joined: 28 Oct 2018, 23:56

Re: How to chain multiple If win statments on same line

Post by slyfox1186 » 26 Mar 2023, 11:28

I must have been really tired not to figure this out myself.... thank you.

LAPIII
Posts: 667
Joined: 01 Aug 2021, 06:01

Re: How to chain multiple If win statments on same line

Post by LAPIII » 11 Jun 2023, 12:58

These both work

Code: Select all

q::{
If WinExist("ahk_exe msedge.exe") && WinExist("ahk_exe Scite.exe")
Run("Notepad.exe")
}

Code: Select all

q::{
If WinExist("ahk_exe msedge.exe" && "ahk_exe Scite.exe")
Run("Notepad.exe")
}
And you can also replace the && with AND.

Post Reply

Return to “Ask for Help (v2)”