How to use #IfWinActive with three programs or websites? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ahmed142
Posts: 19
Joined: 19 May 2022, 08:55

How to use #IfWinActive with three programs or websites?

Post by Ahmed142 » 26 Nov 2022, 16:55

Hello everyone,

I want to use the command #IfWinActive with three things instead of one thing, so for example I want to show MsgBox if one of three following things is activated:
1. Word
2. Excel
3. Google - Google Chrome

I use the following code but it doesn't work

Code: Select all

#IfWinActive Word || Excel || Google - Google Chrome
F4::
MsgBox, Hello
Return
#IfWinActive
I use AutoHotKey version 1.1.35.00
Last edited by Ahmed142 on 14 Sep 2023, 09:28, edited 1 time in total.

User avatar
mikeyww
Posts: 26856
Joined: 09 Sep 2014, 18:38

Re: How use #IfWinActive with three programs or websites?  Topic is solved

Post by mikeyww » 26 Nov 2022, 18:13

Code: Select all

#If WinActive("ahk_exe WINWORD.exe") || WinActive("ahk_exe EXCEL.exe") || WinActive("ahk_exe chrome.exe")
Alternatives: SetTitleMatchModeGroupAdd

Ahmed142
Posts: 19
Joined: 19 May 2022, 08:55

Re: How use #IfWinActive with three programs or websites?

Post by Ahmed142 » 26 Nov 2022, 18:37

Thank you so much mikeyww. I tried that code and it works.

Post Reply

Return to “Ask for Help (v1)”