#IfWinActiv don´t work

Get help with using AutoHotkey and its commands and hotkeys
asdads
Posts: 13
Joined: 07 Feb 2018, 09:45

#IfWinActiv don´t work

18 Apr 2018, 08:15

Hello!,

I have a simple Script that not work!

Code: Select all

CoordMode, Pixel, mouse
#SingleInstance, force

F::
if (#IfWinActive, ahk_exe chrome.exe) {
	MsgBox, its on!
} else {
	MsgBox, its not on!
}
return
Its always say "its not on" i dont know how to fix it, thx :D
gregster
Posts: 2946
Joined: 30 Sep 2013, 06:48

Re: #IfWinActiv don´t work

18 Apr 2018, 08:41

I recommend looking deeper into the help file.. try to find out the differences between your and my version...

Code: Select all

f::
if WinActive("ahk_exe chrome.exe") {
	MsgBox, its on!
} else {
	MsgBox, its not on!
}
return
hunter99
Posts: 126
Joined: 20 Jan 2014, 17:57

Re: #IfWinActiv don´t work

18 Apr 2018, 09:00

Hi asdads, try this.
I only have Mozilla, so change the class to your browser.

#IfWinActive, ahk_class MozillaWindowClass
F::MsgBox, its on!
#IfWinNotActive, ahk_class MozillaWindowClass
F::MsgBox, its not on!

Read again the docs on how "#" creates context-sensitive hotkeys.

hunter99

EDIT:
These may be what you really want.

F::
IfWinActive, ahk_class MozillaWindowClass
MsgBox, its on!
IfWinNotActive, ahk_class MozillaWindowClass
MsgBox, its not on!
return

or

F::
IfWinActive, ahk_class MozillaWindowClass
{
MsgBox, its on!
return
}
MsgBox, its not on!
return
asdads
Posts: 13
Joined: 07 Feb 2018, 09:45

Re: #IfWinActiv don´t work

20 Apr 2018, 03:37

gregster wrote:I recommend looking deeper into the help file.. try to find out the differences between your and my version...

Code: Select all

f::
if WinActive("ahk_exe chrome.exe") {
	MsgBox, its on!
} else {
	MsgBox, its not on!
}
return
Thank you thats worked <3

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], boiler, chngrcn, foguetes, Google [Bot], MannyKSoSo, songdg and 214 guests