Jump to content

Detect a pop-up window


BALA
 Share

Recommended Posts

Well I'm looking fro a way to detect a random window that pops up. So I wouldn't know the title.

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

then:

CODE

If WinActive("ur program's title")<>"true" then

;w/e u need to do

endif

Don't know how you got that quote (my computer is lagging intensely at the moment) but your code requires me to know the title, I don't know the title is the problem. Really i I need a command that will tell me the title of a window that pops up.

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

Don't know how you got that quote (my computer is lagging intensely at the moment) but your code requires me to know the title, I don't know the title is the problem. Really i I need a command that will tell me the title of a window that pops up.

so ur script is going to be a background process?...

[sup]Psibernetic[/sup]My Creations:X-HideSecuracy

Link to comment
Share on other sites

because then u could set the WinActive to monitor whichever app u need to keep pop ups away from with the code I gave u... if $Whatever_u_need_active isn't active then (w/e u need it to do)

Ah, I see now. Sorry, didn't understand what "w/e" meant. Thanks

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

Lol-!- I mean Hahaha

Yeah, I once got stuck saying 'wtf' for 3 months straight, anyways thanks for the help, it really was a lifesaver.

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

  • Moderators

Might see where this takes you :

Global $aAllVisWin = ''
AdlibEnable('_GetPopUp', 100)

While 1
    Sleep(10000)
WEnd

Func _GetPopUp()
    AdlibDisable()
    If Not $aAllVisWin Then
        Local $aWL = WinList()
        For $iCC = 1 To UBound($aWL) - 1
            If $aWL[$iCC][0] <> '' And _
                BitAND(WinGetState($aWL[$iCC][0]), 2) Then _
                $aAllVisWin &= $aWL[$iCC][0] & Chr(1)
        Next
    Else
        Local $sTitle = WinGetTitle('')
        If $sTitle <> '' And _
            Not StringInStr(Chr(1) & $aAllVisWin, Chr(1) & $sTitle & Chr(1)) Then
            MsgBox(64, 'Info', 'Extra Window:' & @CRLF & $sTitle)
        EndIf
    EndIf
    AdlibEnable('_GetPopUp', 100)
    Return ''
EndFunc

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Might see where this takes you :

Global $aAllVisWin = ''
AdlibEnable('_GetPopUp', 100)

While 1
    Sleep(10000)
WEnd

Func _GetPopUp()
    AdlibDisable()
    If Not $aAllVisWin Then
        Local $aWL = WinList()
        For $iCC = 1 To UBound($aWL) - 1
            If $aWL[$iCC][0] <> '' And _
                BitAND(WinGetState($aWL[$iCC][0]), 2) Then _
                $aAllVisWin &= $aWL[$iCC][0] & Chr(1)
        Next
    Else
        Local $sTitle = WinGetTitle('')
        If $sTitle <> '' And _
            Not StringInStr(Chr(1) & $aAllVisWin, Chr(1) & $sTitle & Chr(1)) Then
            MsgBox(64, 'Info', 'Extra Window:' & @CRLF & $sTitle)
        EndIf
    EndIf
    AdlibEnable('_GetPopUp', 100)
    Return ''
EndFunc
Awesome, thanks too.
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

  • Moderators

Awesome, thanks too.

This could get quite annoying...

Anyway, you might think about giving an option to kill it / Add it etc...

Global $aAllVisWin = '', $sWins2Kill
AdlibEnable('_GetPopUp', 10)

While 1
    Sleep(10000)
WEnd

Func _GetPopUp()
    AdlibDisable()
    If Not $aAllVisWin Then
        Local $aWL = WinList()
        For $iCC = 1 To UBound($aWL) - 1
            If $aWL[$iCC][0] <> '' And _
                BitAND(WinGetState($aWL[$iCC][0]), 2) Then _
                $aAllVisWin &= $aWL[$iCC][0] & Chr(1)
        Next
    Else
        Local $sTitle = WinGetTitle('')
        If $sTitle <> '' And _
            Not StringInStr(Chr(1) & $aAllVisWin, Chr(1) & $sTitle & Chr(1)) Then
            If StringInStr(Chr(1) & $sWins2Kill, Chr(1) & $sTitle & Chr(1)) Then
                WinKill($sTitle)
            ElseIf MsgBox(262144 + 68, 'New Window Detected!', 'Window not recognized:' & @CRLF & @CRLF & _
                'Window Name:  --> "' & $sTitle & '"' & @CRLF & @CRLF & _
                'Would you like to kill it?') = 6 Then
                $sWins2Kill &= $sTitle & Chr(1)
                WinKill($sTitle)
            Else
                $aAllVisWin &= $sTitle & Chr(1)
            EndIf
        EndIf
    EndIf
    AdlibEnable('_GetPopUp', 10)
    Return ''
EndFunc

Edit:

Revised it a bit more (didn't make it an option, you can do that).

Now if you kill the window, it's added to the do not allow list, so you won't keep getting the message box.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...