Sign in to follow this  
Followers 0
BALA

Detect a pop-up window

22 posts in this topic




How can you detect a pop-up window in AutoIt?

would winactive("title") work for you?


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

Share this post


Link to post
Share on other sites

By random, I mean random.

Any window that pops up on your screen.

then:

CODE

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

;w/e u need to do

endif


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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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)


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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

o wow ya sorry...my fault...damn aim has ruined my vocabulary

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
Share on other sites

I built a popup blocker into my browser by using adlibenable on a function that just killed iexplore.... but of course if that kills ALL it's windows... so it may not work in your case.

Share this post


Link to post
Share on other sites

Is it possible to block out ip's with autoit? For instance, you make a file with all the ad links/converted to IP's and just have it so that if that IP connects, it won't let it or close it immediately.

Share this post


Link to post
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
Sign in to follow this  
Followers 0