Sign in to follow this  
Followers 0
bobheart

Close IE window but leave one ?

15 posts in this topic

How would you make a popup stopper ? Or can it be done ?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

might be easier to use a free one, but basically you can set autoit to loop and look for any window criteria you specify, and close those, but I would suggest Firefox. :D

http://www.mozilla.org/products/firefox/

Free browser that has a lot of nice features, (one being popup stoper.) Some others would suggest Opera.

while 1
if winexists("Buy crap from me","") then winclose("Buy crap from me","") 
if winexists("Buy now","") then winclose("Buy now","") 
sleep(1)
wend

...edit hmm, interesting approach Larry, I might try that.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

I use firefox , this is for the nieces computer I just built for them and it has IE on it .

I just want it to kill any Internet Explore window that opens after the first one is open and if they need more to open thet can just click on it to pause it .

Share this post


Link to post
Share on other sites

I use firefox , this is for the nieces computer I just built for them and it has IE on it .

I just want it to kill any Internet Explore window that opens after the first one is open and if they need more to open thet can just click on it to pause it .

I'd suggest the google toolbar in that case, simple and works well (as well as a handy way to google)

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

I am using "google toolbar" + "spy-bot search and destroy", then occasional Adaware.

Lar.

thank god for those tools, sometimes, when the spyware gets in deep, you need "hijack this" as well... spent four hours yesterday with a PC that was dying of the crap...

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

can't do are own then ?

Share this post


Link to post
Share on other sites

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
sleep(2000)
Opt("WinTitleMatchMode",2)
$hWnd =WinGetHandle("Microsoft Internet Explorer")
Opt("WinTitleMatchMode",4)
While 1
Opt("WinTitleMatchMode",2)
$x = WinGetHandle("Microsoft Internet Explorer")
Opt("WinTitleMatchMode",4)
    If $x<>$hWnd Then   winclose("handle="&$x)
    sleep(10)
    If NOT winexists("handle="&$hWnd) Then exit
Wend

Popup stopper from Larry code.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Wow that works good .. thank you ..

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

every time you click on a page, it has the chance to update the full title Larry, so if it was at the wrong milisecond, you might close it.

While WinExists($hWnd)

    WinSetTitle($hWnd,"",StringReplace(WinGetTitle($hWnd),"plorer","pl0rer"))

    Opt("WinTitleMatchMode",2); lets just say right now the web page updated title

    If WinExists("Microsoft Internet Explorer") Then

      WinClose("Microsoft Internet Explorer")

    EndIf

try WinSetTitle("Microsoft Internet Explorer","","bob") and click on a page, you will notice the full titlebar is back.

My version of your code works, but the popup would have to get focus, it wouldn't work well with backround ones.

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
sleep(2000)
Opt("WinTitleMatchMode",2)
$hWnd =WinGetHandle("Microsoft Internet Explorer")
Opt("WinTitleMatchMode",4)
While 1
Opt("WinTitleMatchMode",2)
$x = WinGetHandle("Microsoft Internet Explorer")
Opt("WinTitleMatchMode",4)
If $x<>$hWnd Then winclose("handle="&$x)
sleep(10)
If NOT winexists("handle="&$hWnd) Then exitloop
Wend
while winexists("Microsoft Internet Explorer"); close backround ones.
winclose("Microsoft Internet Explorer")
wend
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

That one larry does not work to good . it opens it and when you click on the back button it closes the window ? ( i was at a porn site to test popups , really I was . lol )

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Sheesh, why do you hate my code so much?

Code explained.

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
sleep(2000)
Opt("WinTitleMatchMode",2)
$hWnd =WinGetHandle("Microsoft Internet Explorer"); get good handle
While 1; loop
Opt("WinTitleMatchMode",2) 
$x = WinGetHandle("Microsoft Internet Explorer"); check for other handle
Opt("WinTitleMatchMode",4)
If $x<>$hWnd Then winclose("handle="&$x); close if not my handle
sleep(10)
If NOT winexists("handle="&$hWnd) Then exitloop; stop if original is gone 
Wend
while winexists("Microsoft Internet Explorer"); close backround ones.
winclose("Microsoft Internet Explorer")
wend

..edit my question would be, can you use both

WinExists("Microsoft Internet Explorer") And _

"handle=" & WinGetHandle("Microsoft Internet Explorer") <> $hWnd under Opt("WinTitleMatchMode",4)??

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Sheesh, why do you hate my code so much?

Code explained.

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
sleep(2000)
Opt("WinTitleMatchMode",2)
$hWnd =WinGetHandle("Microsoft Internet Explorer"); get good handle
While 1; loop
Opt("WinTitleMatchMode",2) 
$x = WinGetHandle("Microsoft Internet Explorer"); check for other handle
Opt("WinTitleMatchMode",4)
If $x<>$hWnd Then winclose("handle="&$x); close if not my handle
sleep(10)
If NOT winexists("handle="&$hWnd) Then exitloop; stop if original is gone 
Wend
while winexists("Microsoft Internet Explorer"); close backround ones.
winclose("Microsoft Internet Explorer")
wend
I like it and it worked great .. :D

Share this post


Link to post
Share on other sites

Just teasing Larry. His code is always top notch, not often I can find any bug in it. :huh2:

I better mark it down in my calendar :D


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Did you try yours ? it looks like it blocks ad's ? try it and see if it does on yours .

Share this post


Link to post
Share on other sites

I tested mine, it works OK. Adds and spyware do many more evil things than pop up windows though, so I still suggest some other program, like say google or such. This is more of an example of showing cool things you can do with AutoIt than a perfect solution.

Webpages can add tracking cookies, lock up your mouse, change your homepage, and many other more sinister things.

It is nice to know you can build a fire on your own, but after that, I grab a lighter or matches.


AutoIt3, the MACGYVER Pocket Knife for computers.

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