forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Popup Killer for IE...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Jul 30, 2002 5:43 am    Post subject: Popup Killer for IE... Reply with quote

Here's a popup killer that checks for the IE toolbar.
If there is none, it assumes the window is a popup
and closes it. The popup killer runs as an icon in the
systray.

It keeps a list of opened IE windows, and checks them
against WINLIST for new ones, so it doesn't check the
same windows again. It must activate the windows to
check for the toolbar, so if you open several IE windows
before starting the popup, it's gonna cycle thru all of
them checking for toolbars.

It also updates the IE windows list. Windows that no
longer exist are removed.

The popup menu has options to stop/start the popup
killer routine, since some sites (such as this one) may
notify you of PMs etc. with popups.

NOTE: I use IE4. If IE5+ has a different toolbar class,
you'll have to change that from "ToolbarWindow32".
I'm hoping they're the same...
__________________________________________________________________________________________________________________________
Code:

TITLE "By Mac"
if @winexists("Popup Killer")
   INFO "Popup Killer is running..."@tab()
   EXIT
end
OPTION SCALE, 96
OPTION DECIMALSEP, "."
OPTION PRIORITY, IDLE
DIALOG CREATE,"Popup Killer",0,160,300,40
  DIALOG ADD,TASKICON,TaskBar,," Popup Killer "
rem -- No reason to show dialog --

rem -- For WINLIST --
LIST CREATE, 1
rem -- For currently open IE windows --
LIST CREATE, 2, SORTED

rem -- Sets popup on/off --
%%popup = 1
rem -- For those who renamed the IE title bar in the reg --
%%IEtitle = @REGREAD(CURUSER,Software\Microsoft\Internet Explorer\Main,"Window Title","Internet Explorer")

:ContinueMENU
  REPEAT
    WAIT ".1"
    rem ============== Popup Killer Routine ==============
    if %%popup
       %a = @winactive()
       rem -- Update current IE list --
       if @greater(@count(2), 0)
          %x = 0
          REPEAT
            if @not(@winexists(@item(2, %x)))
               LIST DELETE, 2
            end
            %x = @succ(%x)
          UNTIL @equal(%x, @count(2))@greater(%x, @count(2))
       end

       rem -- Check WINLIST (1) against IE list (2) for new IE windows --
       LIST WINLIST, 1
       %x = 0
       REPEAT
         %%window = @item(1, %x)
         if @greater(@pos(%%IEtitle, %%window), 0)
            %%found = ""
            %y = 0
            REPEAT
              if @equal(@item(2, %y), %%window)
                 %%found = 1
                 %y = @pred(@count(2))
              end
              %y = @succ(%y)
            UNTIL @equal(%y, @count(2))@greater(%y, @count(2))

            rem -- If new window, close if no toolbar  --
            if @not(%%found)
               %%status = @winpos(%%window,S)
               WINDOW ACTIVATE, %%window
               WAIT ".2"
               PARSE "%t;%l", @winpos(%%window,TL)
               %c = @winclass(@winatpoint(@sum(%l, 35), @sum(%t, 35)))
               WAIT ".2"
               if @not(@equal(%c, "ToolbarWindow32"))
                  WINDOW SEND, %%window, @alt(@key(f4))
                  rem -- Check if second attempt is needed --
                  if @winexists(%%window)
                     WAIT ".2"
                     WINDOW SEND, %%window, @alt(@key(f4))
                  end
               else
                  rem -- Restore to previous status --
                  if @equal(%%status, 1)
                     WINDOW NORMAL, %%window
                  end
                  if @equal(%%status, 2)
                     WINDOW ICONIZE, %%window
                  end
                  if @equal(%%status, 3)
                     WINDOW MAXIMIZE, %%window
                  end
                  LIST ADD, 2, %%window
               end
            end
         end
         %x = @succ(%x)
       UNTIL @equal(%x, @count(1))@greater(%x, @count(1))
       rem -- Restore active window --
       if @not(@equal(@winactive(), %a))
          if @winexists(%a)
             WINDOW ACTIVATE, %a
             WAIT ".5"
          end
       end
    end
    rem ==================================================
  UNTIL @event()
  if %%popup
     DIALOG POPUP,Continue|Stop Popup Killer|-|Exit
  else
     DIALOG POPUP,Continue|Start Popup Killer|-|Exit
  end
  %e = @event()
  rem -- This prevents problems if user clicks off menu to close it --
  %s = "Stop Popup KillerMENU Start Popup KillerMENU ExitMENU CLOSE"
  if @greater(@pos(%e, %s), 0)
     goto %e
  end
  goto ContinueMENU

:Stop Popup KillerMENU
  %%popup = ""
  goto ContinueMENU

:Start Popup KillerMENU
  %%popup = 1
  goto ContinueMENU

:ExitMENU
:CLOSE
  EXIT

[EDIT] Changed some WAIT times from ".1" to".2" to allow
more checking time on faster systems.

[EDIT2] Added code to restore the active window if popup
routine leaves another window active.

[EDIT3] Modified the restore active window code just added.

[EDIT4] Added code to restore windows to their previous status
(normal, minimized, maximized). Also checks reg in case user
has renamed IE title bar (Thanks to Dread and Tommy for this).

[EDIT5] Changed popup menu to reflect current popup status
(offers "Stop Popup Killer" if running, "Start Popup Killer" if not).
Another idea from Dread.

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361


Last edited by Mac on Fri Aug 02, 2002 10:17 pm; edited 6 times in total
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Jul 30, 2002 7:10 pm    Post subject: Reply with quote

Ran it through VDS 4.5....

When the program is running, it kills the main IE window which
has toolbars.

Another test, and it killed the main window and left the popup.

Another test and it killed both the popup and the main window.

I think it's because I have my toolbars on only two rows and
not three like the default setup for IE.

I have the address bar to the right of the menu, then I have the
links bar to the right of the buttons bar.

I have a suggestion... How about checking for a status bar
instead? Most popups do not use the status bar either. Another
difference is that popups usually disable the resizing of the
window.. Not sure that is any help though. Many also do not
contain scroll bars. But there are popups that do have toolbars
and scroll bars. Ran into one while testing.

Another thing I would suggest, is since there are going to be
popups that will get by this, how about adding my method of
allowing the title bar to be checked? Basically, my method allows
the user to add a popup's title bar to a list, if that title ever shows
up again, it's killed as quickly as possible. You should also allow
a list of accepted popups instead of having to turn it off via the
menu.

Under such conditions of course, you'd have to check for titles
first to see if it's an accepted popup or not, if not, then send it
through your method to see if it even fits the criteria for a
popup.

Since I have been using my popup killer for a long time now, I
have a list of popups to kill that could be shared. We could
coordinate a universal list amongst ourselves and update the list
every so often and then anyone using the program can update
their list with the culmative list or just an updated list to append
to their own list.

Another version of a popup killer I had was by using the proxy
dll by pgware. I had a list of IP's and domain names that were
known for serving popups and I'd filter them out using the
proxy dll.


-Garrett
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Jul 30, 2002 8:24 pm    Post subject: Reply with quote

The program checks the area approx 13 pixels below the title
bar, so it only checks the top toolbar row.

I changed some WAIT times from ".1" to ".2" to allow more
time for toolbar checking on faster systems (in case that
was a problem). It works well on my system so far...

Did you check to see what the toolbar class is in the version
of IE that you're using?
If it's not "ToolbarWindow32", that
will have to be changed (or added). You can use the Window
Spy Tool I posted to find what the class name is.

The only problem with checking the status bar is that users
can disable that in normal IE windows.

If you want to add some of your routines to this, feel free to
do so. While a list of popup windows would be an asset on
frequently visited sites, I designed this for users (like myself)
that visit many different sites, and often only visit them once...

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Jul 31, 2002 11:42 pm    Post subject: Reply with quote

I Added code to restore the active window if the popup
routine leaves another window active. I also added it to
the "Auto position/size any active window" code, which
is the program I use (has the same popup killer routine).

Does this working on anyone's system besides mine? Confused

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361


Last edited by Mac on Thu Aug 01, 2002 8:07 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Aug 01, 2002 4:05 am    Post subject: Reply with quote

Seems to work for me in Win ME with IE 6, although it closed IE one of the times I went to open it initially.
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Aug 01, 2002 8:01 am    Post subject: Reply with quote

Thanks Sheep, Smile

I modified the "restore active window" code added
earlier (it needed some WAIT time on my system).
It also now checks to make sure the previously
active window still exists before re-activating it. Embarassed

Also changed this in the "Auto position/size any active
window" code. I'm using this program constantly, so I'll
try to post improvements if/when I make any.

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Aug 01, 2002 9:06 am    Post subject: Reply with quote

Hi Mac!

Nice proggie. One suggestion for ya:

Don't hardcode the browser title part because users may change it - I have, anyway Wink
Look in the registry -
Code:
%%maintitle = @REGREAD(CURUSER,Software\Microsoft\Internet Explorer\Main,"Window Title")

and use this variable instead of "Internet Explorer".

Keep on trucking.

Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Aug 01, 2002 9:28 am    Post subject: Reply with quote

Hiya Dread, Smile

Unfortunately, my Windows 95 reg doesn't have that
value for for IE4. Maybe later IE versions? I dunno. Confused

Anyway, you're on your own on this one.... Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Aug 01, 2002 9:43 am    Post subject: Reply with quote

Arrrh. Bad luck with the missing reg value Crying or Very sad

I am on my own Question Ohh nooo. Not again.

Well, no problemos. But if someone else cannot make it work (like me, initially) they
might be advised to check that they have the correct string for the browser window title.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Thu Aug 01, 2002 7:49 pm    Post subject: Reply with quote

At least use it like this so that it'll use a default string in case it doesn't exist:

%%maintitle = @REGREAD(CURUSER,Software\Microsoft\Internet Explorer\Main,"Window Title",Internet Explorer)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Aug 01, 2002 9:20 pm    Post subject: Reply with quote

Good idea Tommy, Wink

I added this code using %%IEtitle as the title bar var. Many
thanks to you and Dread. Smile

I also added code to restore a window to its' previous status
(normal, minimized, maximized) after the popup killer activates
and checks it for a toolbar (if it doesn't close it as a popup).

Also added these to the "Auto position/size any active window"
code.

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri Aug 02, 2002 8:20 am    Post subject: Reply with quote

Hey Mac!

You got the registry thing going - nice!

One more idea for ya:

Instead of
Code:
DIALOG POPUP,Continue|Stop Popup Killer|Start Popup Killer|-|Exit


one could use
Code:
  if %%popup
     DIALOG POPUP,Continue|Stop Popup Killer|-|Exit
  else
     DIALOG POPUP,Continue|Start Popup Killer|-|Exit
  end


Then you will get only the appropriate Start/Stop choice (according to the prog's status) from the popup.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Aug 02, 2002 10:20 pm    Post subject: Reply with quote

Another nice idea Dread, Wink

Implemented this in both the "Popup Killer for IE" and
the "Auto position/size any active window" code.

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group