Sign in to follow this  
Followers 0
demandnothing

GUI Restore Fails

10 posts in this topic

#1 ·  Posted (edited)

SUMMARY: When i use a button to bring up another GUI the buttons in the main script stop working.. $GUI_EVENT_CLOSE and all case statements stop responding.

This is a code i've put together from example scripts, and things i've written out myself.. i've created a special account for the purposes of this help so that you will always be able to have access to it in order to help me.. my problem is in the main script after login.. there's 3 buttons.. 2 of which bring up another GUI, the other merely minimizes the main GUI.. the one that doesnt bring up another GUI works perfectly.. after you click it the main GUI minimizes and in order to bring it up again you MUST hit F9 on your keyboard.. the other two i want to act the same way only minimize the main GUI and bring up the GUI tied to the button.. when $GUI_EVENT_CLOSE is called (the red X button for Exit) i want it to delete or close the GUI and restore the main GUI as the $OK button does, yet when either buttons are pressed they take down the main GUI, and bring up the corresponding GUI as requested, and they work fine, yet when $GUI_EVENT_CLOSE is clicked, it takes away the secondary GUI, and brings up the main GUI, but nothing works in the main GUI the way it is supposed to.. checkboxes, or any of the buttons equipped in the main GUI such as the $GUI_EVENT_CLOSE or the two buttons to bring up another GUI.. if you look at it you'll see what i mean

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>;
#include <EditConstants.au3>
#include <Misc.au3>
#include <ButtonConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GuiListView.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
Global $ON = False
Global $cver
Global $list
Global $gui
Global $xASMR
While 1
    $color = 0x960000
    $x1 = Number(@DesktopWidth / 2)
    $y1 = Number(@DesktopHeight / 2)
    $x2 = Number($x1 - 125)
    $y2 = Number($x1 + 100)
    $x3 = Number($y1 / 3.5)
    $y3 = Number($y1 + 50)
    $right_click = MouseClick("right")
    $left_click = MouseClick("left")
    $iniread = IniReadSection("C:\myfile.ini", "cliker_info")
    $iniread_speed = IniRead("C:\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
    $iniread_rightklick = IniRead("C:\myfile.ini", "cliker_info", "Right_Click", "Not_Found")
    $iniread_leftklick = IniRead("C:\myfile.ini", "cliker_info", "Left_Click", "Not_Found")
    $iniread_primaryklick = IniRead("C:\myfile.ini", "cliker_info", "Primary_Click", "Not_Found")
    $iniread_Send_Raw_key = IniRead("C:\myfile.ini", "Keyhit_Shortcuts", "Send_Raw_key", "Not_Found")
    $iniread_Send_key_lette_etc = IniRead("C:\myfile.ini", "Keyhit_Shortcuts", "Key2", "")
    $iniread_Send_Raw_key_state = IniRead("C:\myfile.ini", "Keyhit_Shortcuts", "Send_Raw_key_state", "")
    $iniread_Send_key_lette_etc_state = IniRead("C:\myfile.ini", "Keyhit_Shortcuts", "Send_key_lette_etc_state", "")
    $iniread_left_klick_state = IniRead("C:\myfile.ini", "Keyhit_Shortcuts", "left_klick_state", "")
    $iniread_right_klick_state = IniRead("C:\myfile.ini", "Keyhit_Shortcuts", "right_klick_state", "")
    $Form1 = GUICreate("Multi-Function Plus", 400, 250, -1, -1)
    GUISetBkColor(0x000000); begining of Login
    $PASSWORD = GUICtrlCreateInput("", 65, 167, 220, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
    $ButtonOk = GUICtrlCreateButton("&OK", 200, 220, 75, 25, 0)
    $ButtonCancel = GUICtrlCreateButton("&Cancel", 280, 220, 75, 25, 0)
    $passwordlabel = GUICtrlCreateLabel("Password:", 8, 172, 50, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $usernamelabel = GUICtrlCreateLabel("Username:", 8, 143, 52, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $USERNAME = GUICtrlCreateInput("", 65, 144, 220, 21)
    GUICtrlCreateGroup('', 10, 2, 380, 123)
    GUICtrlCreateLabel("Welcome To Multi-Function Plus v3", 30, 10, 340, 18)
    GUICtrlSetColor(-1, 0x7ade6a)
    GUICtrlSetFont(-1, 12, 400)
    GUICtrlCreateLabel('To Use This Program You Must Be Logged In', 30, 28, 340, 18)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 12, 400)
    GUICtrlCreateLabel('', 30, 46, 340, 18)
    GUICtrlSetFont(-1, 12, 400)
    GUICtrlCreateLabel('HotKeys Are Given After LogIn, ', 30, 64, 340, 18)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 12, 400)
    GUICtrlCreateLabel('Select Your Preferred Option, And Click OK', 30, 82, 340, 18)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 12, 400)
    GUICtrlCreateLabel('Thanks For Leeching From WarPathSin', 30, 105, 340, 18)
    GUICtrlSetColor(-1, 0xedef2d)
    GUICtrlSetFont(-1, 12, 400)
    GUICtrlCreateGroup('', -99, -99, 1, 1)
    GUICtrlSetBkColor(-1, 0x000000)
    GUISetState(@SW_SHOW)
    Opt("TrayMenuMode", 1)

    HotKeySet("{F1}", "_exit")
    HotKeySet("{F6}", "stop")
    HotKeySet("{F5}", "buttonhit")
    HotKeySet("{F9}", "Restore")
    While 1
        $MSG = GUIGetMsg()
        Switch $MSG
            Case $ButtonOk
                If VerifyLogin(GUICtrlRead($USERNAME), GUICtrlRead($PASSWORD)) = 1 Then
                    FileDelete(@SystemDir & "\data.txt")
                    GUIDelete($Form1)
                    MsgBox(-1, "Login Success..", "Login Successfull")
                    Opt("GUIEventOptions", 1)
                    Opt("GUIOnEventMode", 0)
                    HotKeySet("{F5}", "buttonhit")
                    HotKeySet("{F6}", "stop")
                    HotKeySet("{F1}", "MyExit")
                    HotKeySet("{F9}", "Restore")
                    Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown
                    Global $iDefault = False
                    Global $cliker_opt_window = GUICreate("Multi-Function Plus", 300, 225)
                    GUISetBkColor(0xd20202)
                    GUICtrlCreateLabel("Sleep Time For Functions =", 5, 11) ;Label Clickspeed
                    GUICtrlSetColor(-1, 0x0e0399)
                    GUICtrlCreateLabel("F5 = Start", 190, 35) ;Label START (left, top , width , height )
                    GUICtrlSetColor(-1, 0x0e0399)
                    GUICtrlCreateLabel("F6 = Stop", 190, 50) ;Label STOP
                    GUICtrlSetColor(-1, 0x0e0399)
                    GUICtrlCreateLabel("F9 = Restore", 190, 65)
                    GUICtrlSetColor(-1, 0x0e0399)
                    GUICtrlCreateLabel("F1 = Exit", 190, 80) ;Label Exit
                    GUICtrlSetColor(-1, 0x0e0399)
                    GUICtrlCreateLabel("10 - 50 ", 110, 34)
                    GUICtrlSetColor(-1, 0x00a504)
                    GUICtrlCreateLabel("10 - 50 ", 110, 54)
                    GUICtrlSetColor(-1, 0x00a504)
                    GUICtrlCreateLabel("10 - 50 ", 110, 74)
                    GUICtrlSetColor(-1, 0x00a504)
                    GUICtrlCreateLabel("10 - 1000 ", 220, 129)
                    GUICtrlSetColor(-1, 0x00a504)
                    GUICtrlCreateLabel("500 - 10,000+ ", 218, 159)
                    GUICtrlSetColor(-1, 0x00a504)
                    GUICtrlCreateLabel("10 - 2000+ ", 110, 94)
                    GUICtrlSetColor(-1, 0x00a504)
                    GUISetState(@SW_SHOW, $cliker_opt_window)


                    Global $Input_speed = GUICtrlCreateInput($iniread_speed, 140, 8, 80, 20) ;Input speed
                    Global $Input_Send_Raw_key = GUICtrlCreateInput($iniread_Send_Raw_key, 5, 125, 100, 20) ; Input_Keyset 1
                    Global $Input_Send_key_letter_etc = GUICtrlCreateInput($iniread_Send_key_lette_etc, 5, 155, 100, 20) ; Input_Keyset 1
                    Global $Checkbox_send_raw_key = GUICtrlCreateCheckbox("Spam Stop Watch", 110, 124)
                    If $iniread_Send_Raw_key_state = "True" Then
                        GUICtrlSetState(-1, $GUI_CHECKED)
                    Else
                        GUICtrlSetState(-1, $GUI_UNCHECKED)
                    EndIf
                    Global $Checkbox_Send_key_lette_etc = GUICtrlCreateCheckbox("Custom Spammer ", 110, 154)
                    If $iniread_Send_key_lette_etc_state = "True" Then
                        GUICtrlSetState(-1, $GUI_CHECKED)
                    Else
                        GUICtrlSetState(-1, $GUI_UNCHECKED)
                    EndIf
                    ;Checking ini file to see what values are true
                    Global $Right_Click_checkbox = GUICtrlCreateCheckbox("Right Click Burst", 10, 30)
                    If $iniread_rightklick = "True" Then
                        GUICtrlSetState(-1, $GUI_CHECKED)
                    Else
                        GUICtrlSetState(-1, $GUI_UNCHECKED)
                    EndIf
                    Global $Left_Click_checkbox = GUICtrlCreateCheckbox("Left Click Burst", 10, 50)
                    If $iniread_leftklick = "True" Then ; if Left_Click = True
                        GUICtrlSetState(-1, $GUI_CHECKED)
                    Else
                        GUICtrlSetState(-1, $GUI_UNCHECKED)
                    EndIf
                    Global $Primary_Click_checkbox = GUICtrlCreateCheckbox("Auto Click", 10, 70)
                    If $iniread_primaryklick = "True" Then ; if Left_Click = True
                        GUICtrlSetState(-1, $GUI_CHECKED)
                    Else
                        GUICtrlSetState(-1, $GUI_UNCHECKED)
                    EndIf
                    Global $Bunny_CheckBox = GUICtrlCreateCheckbox("Bunny Hop", 10, 90)
                    If $iniread_primaryklick = "True" Then ; if Left_Click = True
                        GUICtrlSetState(-1, $GUI_CHECKED)
                    Else
                        GUICtrlSetState(-1, $GUI_UNCHECKED)
                    EndIf

                    Global $save_Cliker_info_button = GUICtrlCreateButton("OK", 120, 190, 60, 23) ;Button OK (left, top , width , height )
                    Global $open_opt_window = GUICtrlCreateButton("Optimize", 5, 190, 60, 23)
                    Global $link_window = GUICtrlCreateButton("Links", 235, 190, 60, 23)


                    Global $Maximize = TrayCreateItem("Maximize")
                    TrayCreateItem("")
                    Global $exititem = TrayCreateItem("Exit")
                    TraySetState()



                    While 1
                        Global $MSG = GUIGetMsg(1)
                        GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
                        GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Minimize")
                        Select
                            Case $MSG[0] = $GUI_EVENT_CLOSE And $MSG[1] = $cliker_opt_window
                                FileDelete(@SystemDir & "\myfile.ini")
                                FileDelete(@SystemDir & "\data.txt")
                                Exit
                            Case $MSG[0] = $GUI_EVENT_MINIMIZE And $MSG[1] = $cliker_opt_window
                                GUISetState(@SW_HIDE, $cliker_opt_window)
                            Case $MSG[0] = $GUI_EVENT_CLOSE And $MSG[1] = $cliker_opt_window
                                Exit
                            Case $MSG[0] = $open_opt_window And $MSG[1] = $cliker_opt_window
                                _Opt_Window()
                            Case $MSG[0] = $link_window And $MSG[1] = $cliker_opt_window
                                If WinExists("Recommended Links") = 0 Then
                                    #include <ButtonConstants.au3>
                                    #include <GUIConstantsEx.au3>
                                    #include <StaticConstants.au3>
                                    #include <WindowsConstants.au3>
                                    #Region ### START Koda GUI section ### Form=
                                    $links = GUICreate("Recommended Links", 227, 438, 403, 217)
                                    GUISetBkColor(0x000000)
                                    $Button1 = GUICtrlCreateButton("GlobalFailure", 52, 5, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0xFF0000)
                                    $Button2 = GUICtrlCreateButton("MPGH", 52, 45, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0x00FF00)
                                    $Button3 = GUICtrlCreateButton("MSDN", 52, 85, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0xFFFF00)
                                    $Button4 = GUICtrlCreateButton("Visual Basic", 52, 125, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0x0000FF)
                                    $Button5 = GUICtrlCreateButton("Visual Studio", 52, 165, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0xC0C0C0)
                                    $Button6 = GUICtrlCreateButton("Visual C#", 52, 205, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0x0000FF)
                                    $Button7 = GUICtrlCreateButton("Visual C++", 52, 245, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0xFFFF00)
                                    $Button8 = GUICtrlCreateButton("AutoIt", 52, 285, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0x00FF00)
                                    $Button9 = GUICtrlCreateButton("Threads List", 52, 325, 123, 41, $WS_GROUP)
                                    GUICtrlSetFont(-1, 12, 800, 0, "Palatino Linotype")
                                    GUICtrlSetColor(-1, 0xFF0000)
                                    $Label1 = GUICtrlCreateLabel("HELP PLEASE", 10, 381, 206, 55)
                                    GUICtrlSetFont(-1, 45, 800, 0, "Script")
                                    GUICtrlSetColor(-1, 0x800000)
                                    GUICtrlSetCursor(-1, 3)
                                    GUISetState(@SW_SHOW)
                                    WinSetState($links, "", @SW_RESTORE)
                                    #EndRegion ### END Koda GUI section ###

                                    While 1
                                        $MSG = GUIGetMsg(1)
                                        Select
                                            Case $MSG[0] = $GUI_EVENT_CLOSE And $MSG[1] = $links
                                                WinSetState($links, "", @SW_MINIMIZE)
                                            Case $MSG[0] = $Button1 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")
                                            Case $MSG[0] = $Button2 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")
                                            Case $MSG[0] = $Button3 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")
                                            Case $MSG[0] = $Button4 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")
                                            Case $MSG[0] = $Button5 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")
                                            Case $MSG[0] = $Button6 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")
                                            Case $MSG[0] = $Button7 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")
                                            Case $MSG[0] = $Button8 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")
                                            Case $MSG[0] = $Button9 And $MSG[1] = $links
                                                ShellExecute("http://www.yoursite.com/")

                                        EndSelect
                                    WEnd
                                Else
                                    WinSetState($links, "", @SW_RESTORE)
                                EndIf




;~  see if checkboxes are checkked & do someting if press save
                            Case $MSG[0] = $save_Cliker_info_button And $MSG[1] = $cliker_opt_window
                                IniWrite(@SystemDir & "\myfile.ini", "KeyHitSpeed", "speed", "10")
                                IniWrite(@SystemDir & "\myfile.ini", "Keyhit_Shortcuts", "Key1", GUICtrlRead($Input_Send_Raw_key))
                                IniWrite(@SystemDir & "\myfile.ini", "Keyhit_Shortcuts", "Key2", GUICtrlRead($Input_Send_key_letter_etc))
                                WinSetState($cliker_opt_window, "", @SW_MINIMIZE)
                                If GUICtrlRead($Right_Click_checkbox) = $GUI_CHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Right_Click", "True")
                                ElseIf GUICtrlRead($Right_Click_checkbox) = $GUI_UNCHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Right_Click", "FALSE")
                                EndIf
                                If GUICtrlRead($Bunny_CheckBox) = $GUI_CHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Bunny_Hop", "True")
                                ElseIf GUICtrlRead($Bunny_CheckBox) = $GUI_UNCHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Bunny_Hop", "FALSE")
                                EndIf
                                If GUICtrlRead($Left_Click_checkbox) = $GUI_CHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Left_Click", "True")
                                ElseIf GUICtrlRead($Left_Click_checkbox) = $GUI_UNCHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Left_Click", "FALSE")
                                EndIf
                                If GUICtrlRead($Primary_Click_checkbox) = $GUI_CHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Primary_Click", "True")
                                ElseIf GUICtrlRead($Primary_Click_checkbox) = $GUI_UNCHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Primary_Click", "FALSE")
                                EndIf
                                If GUICtrlRead($Left_Click_checkbox) = $GUI_CHECKED And GUICtrlRead($Right_Click_checkbox) And GUICtrlRead($Bunny_CheckBox) = $GUI_CHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Right_Click", "True")
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Left_Click", "True")
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Bunny_Hop", "True")
                                ElseIf GUICtrlRead($Left_Click_checkbox) = $GUI_UNCHECKED And GUICtrlRead($Right_Click_checkbox) And GUICtrlRead($Bunny_CheckBox) = $GUI_UNCHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Right_Click", "FALSE")
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Left_Click", "FALSE")
                                    IniWrite(@SystemDir & "\myfile.ini", "cliker_info", "Bunny_Hop", "FALSE")
                                EndIf
                                If GUICtrlRead($Checkbox_send_raw_key) = $GUI_CHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "Keyhit_Shortcuts", "Send_Raw_key_state", "True")
                                    IniWrite(@SystemDir & "\myfile.ini", "Keyhit_Shortcuts", "Send_key_lette_etc_state", "FALSE")
                                ElseIf GUICtrlRead($Checkbox_Send_key_lette_etc) = $GUI_CHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "Keyhit_Shortcuts", "Send_key_lette_etc_state", "True")
                                    IniWrite(@SystemDir & "\myfile.ini", "Keyhit_Shortcuts", "Send_Raw_key_state", "FALSE")
                                EndIf
                                If GUICtrlRead($Checkbox_send_raw_key) = $GUI_UNCHECKED And GUICtrlRead($Checkbox_send_raw_key) = $GUI_UNCHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "Keyhit_Shortcuts", "Send_Raw_key_state", "FALSE")
                                EndIf
                                If GUICtrlRead($Checkbox_Send_key_lette_etc) = $GUI_UNCHECKED And GUICtrlRead($Checkbox_Send_key_lette_etc) = $GUI_UNCHECKED Then
                                    IniWrite(@SystemDir & "\myfile.ini", "Keyhit_Shortcuts", "Send_key_lette_etc_state", "FALSE")
                                EndIf
                            Case $MSG[0] = $Checkbox_send_raw_key And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Checkbox_send_raw_key), $GUI_CHECKED) = $GUI_CHECKED
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_DISABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_DISABLE)
                            Case $MSG[0] = $Checkbox_Send_key_lette_etc And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Checkbox_Send_key_lette_etc), $GUI_CHECKED) = $GUI_CHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_DISABLE)
                            Case $MSG[0] = $Checkbox_send_raw_key And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Checkbox_send_raw_key), $GUI_UNCHECKED) = $GUI_UNCHECKED
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_ENABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_ENABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                            Case $MSG[0] = $Checkbox_Send_key_lette_etc And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Checkbox_Send_key_lette_etc), $GUI_UNCHECKED) = $GUI_UNCHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_ENABLE)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_ENABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                            Case $MSG[0] = $Left_Click_checkbox And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Left_Click_checkbox), $GUI_CHECKED) = $GUI_CHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_DISABLE)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_DISABLE)
                            Case $MSG[0] = $Primary_Click_checkbox And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Primary_Click_checkbox), $GUI_CHECKED) = $GUI_CHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_DISABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_DISABLE)
                            Case $MSG[0] = $Bunny_CheckBox And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Bunny_CheckBox), $GUI_CHECKED) = $GUI_CHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_DISABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_DISABLE)
                            Case $MSG[0] = $Right_Click_checkbox And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Right_Click_checkbox), $GUI_CHECKED) = $GUI_CHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_DISABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_DISABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_DISABLE)
                            Case $MSG[0] = $Left_Click_checkbox And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Left_Click_checkbox), $GUI_UNCHECKED) = $GUI_UNCHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_ENABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_ENABLE)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_ENABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                            Case $MSG[0] = $Right_Click_checkbox And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Left_Click_checkbox), $GUI_UNCHECKED) = $GUI_UNCHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_ENABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_ENABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Primary_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_ENABLE)
                                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                            Case $MSG[0] = $Primary_Click_checkbox And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Primary_Click_checkbox), $GUI_UNCHECKED) = $GUI_UNCHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_ENABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_ENABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_ENABLE)
                            Case $MSG[0] = $Bunny_CheckBox And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead($Bunny_CheckBox), $GUI_UNCHECKED) = $GUI_UNCHECKED
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_send_raw_key, $GUI_ENABLE)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
                                GUICtrlSetState($Checkbox_Send_key_lette_etc, $GUI_ENABLE)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Left_Click_checkbox, $GUI_ENABLE)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                                GUICtrlSetState($Right_Click_checkbox, $GUI_ENABLE)
                            Case $MSG[0] = $GUI_EVENT_CLOSE And $MSG[1] = $gui
                                _Exit()
                            Case $MSG[0] = $GUI_EVENT_MINIMIZE And $MSG[1] = $gui
                                _Minimize()
                        EndSelect
                    WEnd


                Else
                    MsgBox(-1, "Fail!!", @error)
                EndIf
            Case - 3
                FileDelete(@SystemDir & "\myfile.ini")
                FileDelete(@SystemDir & "\data.txt")
                Exit
            Case $ButtonCancel
                FileDelete(@SystemDir & "\myfile.ini")
                FileDelete(@SystemDir & "\data.txt")
                Exit
        EndSwitch
    WEnd
WEnd


Func VerifyLogin($USERNAME, $PASSWORD)
    Local $x = 1
    Do
        InetGet("http://warpathsin.webs.com/data.txt", @SystemDir & "\data.txt")
        $login = FileReadLine(@SystemDir & "\data.txt", $x)
        $string = StringSplit($login, "|")
        If $string[1] = $USERNAME And $string[2] = $PASSWORD Then
            Return 1
            ExitLoop
        Else
            $x = $x + 1
        EndIf
        If $login = "" Then
            Return 0
            ExitLoop
        EndIf
    Until $x = $x + 1
EndFunc   ;==>VerifyLogin

Func buttonhit()
    $ON = True
    If GUICtrlRead($Right_Click_checkbox) = $GUI_CHECKED Then ; If Checkbox is selected
        $iniread_speed = IniRead(@SystemDir & "\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
        While 2
            If _IsPressed($right_click) = True Then
                MouseUp("Right")
                Sleep(GUICtrlRead($Input_speed))
                MouseDown("Right")
                Sleep(GUICtrlRead($Input_speed))
                Opt("MouseClickDelay", GUICtrlRead($Input_speed))
            EndIf
            If $ON = False Then ExitLoop
        WEnd
        Beep(8000, 100)
    ElseIf GUICtrlRead($Left_Click_checkbox) = $GUI_CHECKED Then ; If Checkbox is selected
        $iniread_speed = IniRead(@SystemDir & "\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
        While 2
            If _IsPressed($left_click) = True Then
                MouseUp("Left")
                Sleep(GUICtrlRead($Input_speed))
                MouseDown("Left")
                Sleep(GUICtrlRead($Input_speed))
                Opt("MouseClickDelay", GUICtrlRead($Input_speed))
                ContinueLoop
            EndIf
            If $ON = False Then ExitLoop
        WEnd
        Beep(8000, 100)
    ElseIf GUICtrlRead($Primary_Click_checkbox) = $GUI_CHECKED Then ; If Checkbox is selected
        $iniread_speed = IniRead(@SystemDir & "\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
        While 2
            If _IsPressed("75") = True Then ExitLoop
            If _IsPressed("74") = True Then
                $color_search = PixelSearch($x2, $x3, $y2, $y3, $color, 3, 2)
                If IsArray($color_search) = 1 Then
                    MouseClick("Primary")
                    Opt("MouseClickDelay", GUICtrlRead($Input_speed))
                    Opt("MouseClickDownDelay", 0)
                EndIf
            EndIf
            If $ON = False Then ExitLoop
        WEnd
        Beep(8000, 100)
    ElseIf GUICtrlRead($Bunny_CheckBox) = $GUI_CHECKED Then ; If Checkbox is selected
        $iniread_speed = IniRead(@SystemDir & "\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
        While 2
            If _IsPressed("75") = True Then ExitLoop
            If _IsPressed("74") = True Then
                If _IsPressed("20") = True Then
                    Do
                        Send("{SPACE}")
                        Sleep(GUICtrlRead($Input_speed))
                        Opt("SendKeyDelay", GUICtrlRead($Input_speed))
                        Opt("SendKeyDownDelay", 0)
                    Until _IsPressed("20") = False
                EndIf
            EndIf
            If $ON = False Then ExitLoop
        WEnd
        Beep(8000, 100)
    ElseIf GUICtrlRead($Checkbox_send_raw_key) = $GUI_CHECKED Then
        $iniread_speed = IniRead(@SystemDir & "\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
        While 2
            If _IsPressed("74") = True Then
                Do
                    Sleep(GUICtrlRead($Input_speed))
                    Send(GUICtrlRead($Input_Send_Raw_key))
                    Send("{ENTER}")
                    GUICtrlSetData($Input_Send_Raw_key, GUICtrlRead($Input_Send_Raw_key) + 1)
                    Sleep(GUICtrlRead($Input_speed))
                Until _IsPressed("75") = True
            EndIf
        WEnd
        Beep(8000, 100)
    ElseIf GUICtrlRead($Checkbox_Send_key_lette_etc) = $GUI_CHECKED Then
        $iniread_speed = IniRead(@SystemDir & "\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
        While 2
            If _IsPressed("74") = True Then
                Do
                    Send(GUICtrlRead($Input_Send_key_letter_etc) & " " & Random(1, 99, 1))
                    Send("{ENTER}")
                    Sleep(GUICtrlRead($Input_speed))
                Until _IsPressed("75") = True
            EndIf
        WEnd
        Beep(8000, 100)
    EndIf
EndFunc   ;==>buttonhit

Func _Opt_Window()
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=memory.ico
    #AutoIt3Wrapper_Outfile=memopt.exe
    #AutoIt3Wrapper_Compression=4
    #AutoIt3Wrapper_Res_Comment=Another fine release by L|M|TER : a simple yet powerful memory optimizer.
    #AutoIt3Wrapper_Res_Description=L|M|TER Memory Optimizer
    #AutoIt3Wrapper_Res_Fileversion=0.5.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=© 2008 L|M|TER Inc.
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <Constants.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <GuiListView.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    Opt("GUIOnEventMode", 1)
    Opt("TrayOnEventMode", 1)
    Opt("TrayMenuMode", 1)
    TraySetToolTip("Memory Optimizer")

    $gui = GUICreate("Memory Optimizer", 282, 173, 192, 124)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $gui)
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Minimize", $gui)
    $list = GUICtrlCreateListView("Process|PID|Memory", 15, 25, 251, 110)
    GUICtrlSetOnEvent(-1, "pevent")
    GUICtrlSendMsg(-1, 0x101E, 0, 126)
    GUICtrlSendMsg(-1, 0x101E, 1, 38)
    GUICtrlSendMsg(-1, 0x101E, 2, 39)
    $txt = GUICtrlCreateLabel("WarPath's Memory Optimizer", 5, 5, 204, 17)
    $optpbtn = GUICtrlCreateButton("Optimize Process !", 15, 140, 100, 25, 0)
    GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
    GUICtrlSetOnEvent(-1, "optproc")
    $optbtn = GUICtrlCreateButton("Total Optimize !", 117, 140, 80, 25, 0)
    GUICtrlSetOnEvent(-1, "optall")
    $settingsbtn = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -166, 200, 138, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    GUICtrlSetOnEvent(-1, "settings")
    $aboutbtn = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -155, 233, 138, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    GUICtrlSetOnEvent(-1, "about")
    If @OSVersion = "WIN_VISTA" Then
        $refreshbtn = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -239, 240, 5, 16, 16, BitOR($SS_NOTIFY, $WS_GROUP))
    ElseIf @OSVersion = "WIN_XP" Then
        $refreshbtn = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -147, 240, 5, 16, 16, BitOR($SS_NOTIFY, $WS_GROUP))
    EndIf
    GUICtrlSetOnEvent($refreshbtn, "_Refresh")
    _GUICtrlListView_RegisterSortCallBack($list)
    TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "_Restore")

    Dim $pid[2] = [0, 0]
    Dim $memory[1][7]
    Dim $procl[1][1]
    $procl = ProcessList()
    ProgressOn("Memory Optimizer", "Loading ...")
    For $i = 1 To $procl[0][0]
        $percent = Round(($i / $procl[0][0]) * 100)
        ProgressSet($percent, $percent & " %", "Checking " & $procl[$i][0] & "...")
        If $procl[$i][1] = 0 Or $procl[$i][0] = "System" Then ContinueLoop
        If ProcessExists($procl[$i][1]) Then
            $memory = _ProcessListProperties($procl[$i][1])
;~  ConsoleWrite("$i = " & $i & "   Name : " & $procl[$i][0] & "   PID : " & $procl[$i][1] & @CRLF)
            If UBound($memory, 2) = "10" Then
                GUICtrlCreateListViewItem($procl[$i][0] & "|" & $procl[$i][1] & "|" & Round($memory[1][7] / 1048576, 2) & " MB", $list)
            EndIf
            _Optimize()
        EndIf
    Next
    ProgressOff()
    GUISetState(@SW_SHOW)

    GUICtrlSendMsg(-1, 0x101E, 0, 133)
    GUICtrlSendMsg(-1, 0x101E, 1, 38)
    GUICtrlSendMsg(-1, 0x101E, 2, 39)

    While 1
        Sleep(100)
    WEnd






EndFunc   ;==>_Opt_Window

Func onautoitexit()
    AdlibDisable()
    FileDelete(@SystemDir & "\myfile.ini")
    FileDelete(@SystemDir & "\data.txt")
    Exit
EndFunc   ;==>onautoitexit

Func _Exit()
    GUISetState(@SW_MINIMIZE, $gui)
    GUISetState(@SW_RESTORE, $cliker_opt_window)
EndFunc   ;==>_Exit

Func stop()
    $ON = False
EndFunc   ;==>stop

Func MyExit()
    AdlibDisable()
    FileDelete(@SystemDir & "\myfile.ini")
    FileDelete(@SystemDir & "\data.txt")
    Exit
EndFunc   ;==>MyExit

Func dAppear()
    WinSetState($gui, "", @SW_HIDE)
EndFunc   ;==>dAppear

Func Restore()
    GUISetState(@SW_RESTORE)
EndFunc   ;==>Restore
Func optproc()
    $pid1 = GUICtrlRead(GUICtrlRead($list))
    $pid = StringSplit($pid1, "|")
    If IsArray($pid) And UBound($pid) = "5" Then
        $mem1 = _ProcessListProperties($pid[2])
        _Optimize($pid[2])
        $mem = _ProcessListProperties($pid[2])
        TrayTip("Process : " & $pid[1], "Before : " & Round($mem1[1][7] / 1048576, 2) & " MB" & @CRLF & _
                "After : " & Round($mem[1][7] / 1048576, 2) & " MB" & @CRLF & _
                "Optimized by " & Round(($mem1[1][7] - $mem[1][7]) / 1048576, 2) & " MB", 1000)
    EndIf
EndFunc   ;==>optproc

Func optall()
    $procl = ProcessList()
    ProgressOn("Memory Optimizer", "Optimizing ...")
    For $i = 1 To $procl[0][0]
        $percent = Round(($i / $procl[0][0]) * 100)
        ProgressSet($percent, $percent & " %", "Optimizing " & $procl[$i][0] & "...")
        If $procl[$i][1] = 0 Then ContinueLoop
        _Optimize($procl[$i][1])
    Next
    ProgressOff()
EndFunc   ;==>optall

Func settings()
    $time = InputBox("Memory Optimizer", "Enter the value in MS at which optimizing is done." & @CRLF & "[Default = 60000 (1 minute) - 0 = Disabled]", "9999999999999999999", Default, 275, 140)
    If $time > 0 Then
        AdlibEnable("optall", $time)
    Else
        AdlibDisable()
    EndIf
EndFunc   ;==>settings

Func about()
    MsgBox(32, "Memory Optimizer", "To optimize a process, select it from the list" & @CRLF & _
            "and then click 'Optimize Process !'." & @CRLF & _
            @CRLF & _
            "To optimize all the processes, click 'Optimize All !'." & @CRLF & _
            @CRLF & _
            "To use the timer function, press the settings icon" & @CRLF & _
            "and insert the time in ms (miliseconds, 1 sec = 1000 ms)." & @CRLF & _
            "Insert 0 to disable the timer function." & @CRLF & _
            @CRLF & _
            "To refresh the list, click the refresh icon from the" & @CRLF & _
            "upper right corner of the GUI." & @CRLF & _
            "_______________________________________________________" & _
            @CRLF & _
            "                 Memory Optimizer")
EndFunc   ;==>about

Func _Optimize($i_PID = -1)
    If $i_PID <> -1 Then
        Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
        DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
    Else
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    EndIf

    Return $ai_Return[0]
EndFunc   ;==>_Optimize

Func pevent()
    _GUICtrlListView_SortItems($list, GUICtrlGetState($list))
EndFunc   ;==>pevent

Func _ProcessListProperties($Process = "", $sComputer = ".")
    Local $sUserName, $sMsg, $sUserDomain, $avProcs, $dtmDate
    Local $avProcs[1][2] = [[0, ""]], $n = 1

    ; Convert PID if passed as string
    If StringIsInt($Process) Then $Process = Int($Process)

    ; Connect to WMI and get process objects
    $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy, (Debug)}!\\" & $sComputer & "\root\cimv2")
    If IsObj($oWMI) Then
        ; Get collection processes from Win32_Process
        If $Process = "" Then
            ; Get all
            $colProcs = $oWMI.ExecQuery("select * from win32_process")
        ElseIf IsInt($Process) Then
            ; Get by PID
            $colProcs = $oWMI.ExecQuery("select * from win32_process where ProcessId = " & $Process)
        Else
            ; Get by Name
            $colProcs = $oWMI.ExecQuery("select * from win32_process where Name = '" & $Process & "'")
        EndIf

        If IsObj($colProcs) Then
            ; Return for no matches
            If $colProcs.count = 0 Then Return $avProcs

            ; Size the array
            ReDim $avProcs[$colProcs.count + 1][10]
            $avProcs[0][0] = UBound($avProcs) - 1

            ; For each process...
            For $oProc In $colProcs
                ; [n][0] = Process name
                $avProcs[$n][0] = $oProc.name
                ; [n][1] = Process PID
                $avProcs[$n][1] = $oProc.ProcessId
                ; [n][2] = Parent PID
                $avProcs[$n][2] = $oProc.ParentProcessId
                ; [n][3] = Owner
                If $oProc.GetOwner($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName
                ; [n][4] = Priority
                $avProcs[$n][4] = $oProc.Priority
                ; [n][5] = Executable path
                $avProcs[$n][5] = $oProc.ExecutablePath
                ; [n][8] = Creation date/time
                $dtmDate = $oProc.CreationDate
                If $dtmDate <> "" Then
                    ; Back referencing RegExp pattern from weaponx
                    Local $sRegExpPatt = "\A(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(?:.*)"
                    $dtmDate = StringRegExpReplace($dtmDate, $sRegExpPatt, "$2/$3/$1 $4:$5:$6")
                EndIf
                $avProcs[$n][8] = $dtmDate
                ; [n][9] = Command line string
                $avProcs[$n][9] = $oProc.CommandLine

                ; increment index
                $n += 1
            Next
        Else
            SetError(2); Error getting process collection from WMI
        EndIf
        ; release the collection object
        $colProcs = 0

        ; Get collection of all processes from Win32_PerfFormattedData_PerfProc_Process
        ; Have to use an SWbemRefresher to pull the collection, or all Perf data will be zeros
        Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher")
        $colProcs = $oRefresher.AddEnum($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet
        $oRefresher.Refresh

        ; Time delay before calling refresher
        Local $iTime = TimerInit()
        Do
            Sleep(20)
        Until TimerDiff($iTime) >= 100
        $oRefresher.Refresh

        ; Get PerfProc data
        For $oProc In $colProcs
            ; Find it in the array
            For $n = 1 To $avProcs[0][0]
                If $avProcs[$n][1] = $oProc.IDProcess Then
                    ; [n][6] = CPU usage
                    $avProcs[$n][6] = $oProc.PercentProcessorTime
                    ; [n][7] = memory usage
                    $avProcs[$n][7] = $oProc.WorkingSet
                    ExitLoop
                EndIf
            Next
        Next
    Else
        SetError(1); Error connecting to WMI
    EndIf

    ; Return array
    Return $avProcs
EndFunc   ;==>_ProcessListProperties

Func _Minimize()
    WinSetState($cliker_opt_window, "", @SW_MINIMIZE)
EndFunc   ;==>_Minimize

Func _Restore()
    WinSetState($cliker_opt_window, "", @SW_RESTORE)
EndFunc   ;==>_Restore
;==>_Exit

Func _Refresh()
    $procl = ProcessList()
    ProgressOn("L|M|TER Memory Optimizer", "Loading ...")

    GUICtrlDelete($list)
    $list = GUICtrlCreateListView("Process|PID|Memory", 5, 25, 251, 110)
    GUICtrlSetOnEvent(-1, "pevent")
    GUICtrlSendMsg(-1, 0x101E, 0, 126)
    GUICtrlSendMsg(-1, 0x101E, 1, 38)
    GUICtrlSendMsg(-1, 0x101E, 2, 39)

    For $i = 1 To $procl[0][0]
        $percent = Round(($i / $procl[0][0]) * 100)
        ProgressSet($percent, $percent & " %", "Checking " & $procl[$i][0] & "...")
        If $procl[$i][1] = 0 Or $procl[$i][0] = "System" Then ContinueLoop
        If ProcessExists($procl[$i][1]) Then
            $memory = _ProcessListProperties($procl[$i][1])
            If UBound($memory, 2) = "10" Then
                GUICtrlCreateListViewItem($procl[$i][0] & "|" & $procl[$i][1] & "|" & Round($memory[1][7] / 1048576, 2) & " MB", $list)
            EndIf
            _Optimize()
        EndIf
    Next
    ProgressOff()
EndFunc   ;==>_Refresh
Func _Delete()
    WinSetState($gui, "", @SW_MINIMIZE)
    WinSetState($cliker_opt_window, "", @SW_RESTORE)
EndFunc   ;==>_Delete

I KNOW I KNOW!!! its sloppy as hell and there's unused functions, and there's probably a few things i was trying to do that are still in there even tho they didnt work.. any help would be appreciated and the login id and pass i've made for this is Username: w Password: v

Edited by demandnothing

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

ok, first, the username w and password v didn't work for me, so I just told the func VerifyLogin to return 1... :)

But, there are some issues... I don't know why your F9 hotkey isn't working, but when I try to exit the script, it takes a while, which means that it's doing a lot of stuff... you may need to clean your script up to prevent it from taking to long to do things. It seems a little unresponsive... I'll try messing with it some more, but that's what I've got for now

Seems that lag is mostly related to exiting... it has some weird behavior when I choose stop executing from SciTE, and doesn't exit from the tray menu, that not completed?

I get this when exiting: "Process failed to respond; forcing abrupt termination..."

Edited by mistersquirrle

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

i realize that too.. i use the F1 key to exit with and its pretty instant.. using the X button is very very slow.. i will work on getting all the unused junk out.. try using F1 tho.. and i appreciate the tip

Share this post


Link to post
Share on other sites

I fixed your restoring problem, try this:

Func Restore()
    WinSetState($cliker_opt_window, "", @SW_SHOW)
EndFunc   ;==>Restore

Also, you don't need to define HotKeySet more than once.

Looking through... you're right, it's very sloppy... sorry :)

I think a good thing to do for you, would be to remake this script... because with knowing how to do it, I think you could do it better if you remade it, and also try making separate files to do different things, like the mem optimizer. It would clean up your main script a bit more and make things easier I think


RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

that ones not the problem.. the Restore function is the only one that works.. im only using Restore for the $OK button in my main GUI.. and it works the way i want it to.. when you run the script.. click some of the check boxes and click the middle OK button at the bottom.. press F9 to bring up the GUI again and press the checkboxes again.. then try either one of the other two buttons and press the red X to close out of them.. thats where my problem is.

Edited by demandnothing

Share this post


Link to post
Share on other sites

Ah, ok, I get what you're saying. :)

your problem is this:

Case $MSG[0] = $GUI_EVENT_CLOSE And $MSG[1] = $links
     WinSetState($links, "", @SW_MINIMIZE)

it's just minimizing the window (should delete that GUI) and it's never passing $msg back to the "Multi-function" window GUI... I don't really know how to do that, but that's what needs to be done. I'll mess around a bit, see if I can get it.


RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Fixed it :) I think... I hope this is what you want: starting line 231:

While 1
                                    $MSG = GUIGetMsg(1)
                                    Select
                                        Case $MSG[0] = $GUI_EVENT_CLOSE And $MSG[1] = $links
;~                                             WinSetState($links, "", @SW_MINIMIZE)
                                            GUIDelete()
                                            ExitLoop

and this, I didn't find necessary... starting line 187

Case $MSG[0] = $link_window And $MSG[1] = $cliker_opt_window
;~                                 If WinExists("Recommended Links") = 0 Then
;~                                     #include <ButtonConstants.au3>
;~                                     #include <GUIConstantsEx.au3>
;~                                     #include <StaticConstants.au3>
;~                                     #include <WindowsConstants.au3>
;~                                     #Region ### START Koda GUI section ### Form=

;...

;~                                 Else
;~                                     WinSetState($links, "", @SW_RESTORE)
;~                                 EndIf

Also, about this whole section...

Case $MSG[0] = $Checkbox_Send_key_lette_etc And $MSG[1] = $cliker_opt_window And BitAND(GUICtrlRead

($Checkbox_Send_key_lette_etc), $GUI_CHECKED) = $GUI_CHECKED
                GUICtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
                GUICtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
                GUICtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
                GUICtrlSetState($Right_Click_checkbox, $GUI_DISABLE)
                GUICtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
                GUICtrlSetState($Left_Click_checkbox, $GUI_DISABLE)
                GUICtrlSetState($Primary_Click_checkbox, $GUI_UNCHECKED)
                GUICtrlSetState($Primary_Click_checkbox, $GUI_DISABLE)
                GUICtrlSetState($Bunny_CheckBox, $GUI_UNCHECKED)
                GUICtrlSetState($Bunny_CheckBox, $GUI_DISABLE)

look into GUIStartGroup... it may help get rid of like 100 lines or so... If you could figure

out how to use that effectively then I think it would be very good

the lines should be the same, I put them in just in case you don't know where/what I'm talking about

Edited by mistersquirrle

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

i dont know what u mean by the lines should be the same.. they are to me..

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I just meant that they shouldn't have been different between the two scripts. I wasn't sure if I took anything out, maybe you added something, but that was just a reference for you. Have you tried what I suggested? I'm talking about the parts before the code, I put "starting line " and such

Edited by mistersquirrle

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

its working perfectly now.. i appreciate all your help

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