Jump to content

WinActive & ProcessExists


 Share

Recommended Posts

I'm trying to set an if case so that if the window of an exe is the active window, then... [insert code here].

Basically something like this, but of course, this doesn't work:

If WinActive("firefox.exe") Then
MsgBox(0, "", "Firefox is active.")
EndIf
Obviously the title of many programs, like firefox, changes. Thus you see my problem.

Yes, I know I could set WinActive to wait for a match any substring in the title, in this case "Mozilla Firefox," but I need this to work with programs that don't necessarily have an identifier like "Notepad" or "Mozilla Firefox" attached to the end of their titles.

Any ideas? Thanks.

Link to comment
Share on other sites

I'm trying to set an if case so that if the window of an exe is the active window, then... [insert code here].

Basically something like this, but of course, this doesn't work:

If WinActive("firefox.exe") Then
MsgBox(0, "", "Firefox is active.")
EndIf
Obviously the title of many programs, like firefox, changes. Thus you see my problem.

Yes, I know I could set WinActive to wait for a match any substring in the title, in this case "Mozilla Firefox," but I need this to work with programs that don't necessarily have an identifier like "Notepad" or "Mozilla Firefox" attached to the end of their titles.

Any ideas? Thanks.

Opt('WintitleMatchmode',2)oÝ÷ Ù©e£¢ºZ®Øf­r§ÚÂ)Ý£b¶W¬£*.r¥vƲjëh×6
Opt('WintitleMatchmode',2)
While 1
    If WinActive("- Mozilla Firefox") Then
        MsgBox(0, "", "Firefox is active.")
    EndIf
WEnd
Edited by Paulie
Link to comment
Share on other sites

Opt('WintitleMatchmode',2)oÝ÷ Ù©e£¢ºZ®Øf­r§ÚÂ)Ý£b¶W¬£*.r¥vƲjëh×6
Opt('WintitleMatchmode',2)
While 1
    If WinActive("- Mozilla Firefox") Then
        MsgBox(0, "", "Firefox is active.")
    EndIf
WEnd
Yes I know I can do that, which is what I meant by "Yes, I know I could set WinActive to wait for a match any substring in the title..."

I'm using this method for now. I guess I should probably make a request for WinActive to also be by .exe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...