Jump to content

Weird problem with script


 Share

Recommended Posts

Hi, i have a strange problem in my script. I am writing a popup blocker that works by checking URLs in the title of windows to a DB (ini file) and closing ones that match any of the entries. I have gotten the parts that closes the windows to work, however, after closing the window it is supposed to, windows displays the Shutdown/Turn Off computer box asking me select Hibernate, standby, etc. The software is not to shut off the computer, just close a window. And worse, there is no shutoff computer actions in the script! Below is the basic code (you need the HTM part!) and a link to a zip file containing the script and associated files (mainly icons for the tray and the ini with one entry.)

The Script (also in zipfile linked at bottom):

#Include <Constants.au3>
TraySetIcon("arrow.ico")
$isdb = FileExists("popupdb.ini")
If $isdb = 0 Then
    TrayTip("Pop Up Killer", "Pop Up Killer could not locate the database file. If this error persists, reinstall Pop up Killer.",-1,3)
    Sleep(10000)
    Exit
EndIf

TraySetIcon("check.ico")
TraySetToolTip("Popup Killer")
Opt("TrayMenuMode",1)  ; Default tray menu items (Script Paused/Exit) will not be shown.

$disableitem    = TrayCreateItem("Disable")
TrayCreateItem("")
$aboutitem    = TrayCreateItem("About")
TrayCreateItem("")
$exititem      = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            While 1
                Opt("WinTitleMatchMode", 2) 
                $checkwin = WinGetTitle(" - Microsoft Internet Explorer")
                If $checkwin = "" Then
                    ExitLoop
                EndIf
                Opt("WinTitleMatchMode", 2)
                For $dbspot = 1 to 10
                    $dbentry = IniRead("popupdb.ini","titles",$dbspot,"");$dbspot)
                ;MsgBox(-1,"test",$dbentry & " is entry of db being read.")
                    $checkwin = WinGetTitle($dbentry)
                ;MsgBox(0,"$checkwin Value",$checkwin)
                    If $checkwin <> "" Then
                    ;MsgBox(0,"Notice","The IF...Then Seems to be True...")
                        WinClose($checkwin);$dbentry)
                    EndIf
                    $msg = TrayGetMsg()
                    If $msg = $disableitem Then
                        ExitLoop
                    EndIf
                    If $msg = $exititem Then
                        TraySetIcon("x.ico")
                        TrayTip("Pop-up Killer","WOLS Pop-up Killer is now quitting...",-1,2)
                        sleep (1500)
                        Exit
                    EndIf
                Next
            ;Exit
                $dbspot = 0
            WEnd
        Case $msg = $disableitem
            TraySetIcon("exclaim.ico")
            TrayTip("Pop-up Killer","WOLS Pop-up Killer has been disabled!",-1,2)
            ExitLoop
        Case $msg = $aboutitem
            Msgbox(64,"About","WOLS Pop-up Killer (C) 2006 WOLS inc. Help and documentation are available at 'http://www.wolsinc.tk'. Click Downloads, then Popup Killer.")
        Case $msg = $exititem
            TraySetIcon("x.ico")
            TrayTip("Pop-up Killer","WOLS Pop-up Killer is now quitting...",-1,2)
            sleep (1500)
            Exit
    EndSelect
WEnd
Sleep (2000)
Exit

The following is for a HTM file used for testing. This is the title the zipped version below it is set to look for currently. (Sorry, this file is not in zip :lmao: ) Just paste in notepad and save as an HTM file. Open in IE (will be blank with window title "Mediaclick - Microsoft Internet Explorer") before launching Script.

<title>mediaclick</title>

Heres the link to my zip with the script. You may need to right click > Save target As... the file:

Zip File

Hope someone can help,

thanks, wolstech

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