Jump to content

Can't Figure Out Why None Of My Buttons Work...


 Share

Recommended Posts

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
#include <File.au3>
#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("MyGUI", 280, 213,(@DesktopWidth-280)/2, (@DesktopHeight-213)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button_1 = GuiCtrlCreateButton("1", 10, 30, 40, 40)
$Button_2 = GuiCtrlCreateButton("2", 50, 30, 40, 40)
$Button_3 = GuiCtrlCreateButton("3", 90, 30, 40, 40)
$Button_4 = GuiCtrlCreateButton("4", 10, 70, 40, 40)
$Button_5 = GuiCtrlCreateButton("5", 50, 70, 40, 40)
$Button_6 = GuiCtrlCreateButton("6", 90, 70, 40, 40)
$Button_7 = GuiCtrlCreateButton("7", 10, 110, 40, 40)
$Button_8 = GuiCtrlCreateButton("8", 50, 110, 40, 40)
$Button_9 = GuiCtrlCreateButton("9", 90, 110, 40, 40)
$Button_10 = GuiCtrlCreateButton("Enter", 10, 150, 120, 30)
$Group_11 = GuiCtrlCreateGroup("Please enter passsword", 0, 10, 140, 180)
$Button_12 = GuiCtrlCreateButton("Enable pass on start-up", 160, 40, 120, 20)
$Button_13 = GuiCtrlCreateButton("Disable pass on start-up", 160, 60, 120, 20)
$Button_14 = GuiCtrlCreateButton("Remove All Files", 140, 140, 100, 20)
$Date_15 = GuiCtrlCreateDate("Date15", 10, 190, 190, 20)
$Button_16 = GuiCtrlCreateButton("Open Pass Program", 160, 20, 120, 20)
$Button_17 = GuiCtrlCreateButton("Log-Out", 210, 190, 70, 20)
$Button_19 = GuiCtrlCreateButton("Start Auto-Activate Program", 140, 0, 140, 20)
$Button_20 = GuiCtrlCreateButton("Credit", 210, 170, 70, 20)
$Button_21 = GuiCtrlCreateButton("Enable Auto-Activate on start", 130, 80, 150, 20)
$Button_22 = GuiCtrlCreateButton("Disable Auto-Activate on start", 130, 100, 150, 20)
$pass = 0
$access = 0

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
        
    Case $msg =  $Button_1
        If $pass = 0 Then
            $pass = 1
        EndIf
    Case $msg = $Button_2
        If $pass = 1 Then
            $pass = 2
        EndIf
    Case $msg = $Button_3
        $pass = 0
    Case $msg = $Button_4
        $pass = 0
    Case $msg = $Button_5
        IF $pass = 2 Then
            $pass = 3
        EndIf
    Case $msg = $Button_6
        $pass = 0
    Case $msg = $Button_7
        IF $pass = 3 Then
            $pass = 4
        EndIf
    Case $msg = $Button_8
        $pass = 0
    Case $msg = $Button_9
        IF $pass = 4 Then
            $pass = 5
        EndIf
    Case $msg = $Button_10; Code -- pass = 5;; 1-2-5-7-9
    ; -- ENTER KEY --
        If $pass = 5 Then
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", " ")
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*_-=Pass Accepted=-_* " & $ATTEMPT & " -" & $returnvalue)
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", " ")
            Sleep(1200)
            MsgBox(0, "Pass", "Password accepted!")
            $access = 1
        EndIf
        If $pass = 0 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 1 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 2 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 3 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 4 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        
        $pass = 0
        $ATTEMPT = $ATTEMPT + 1
        _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat""", "*** Invalid Pass ***  " & $ATTEMPT & " -" & $returnvalue)
    ;;End Enter Key
    Case $msg = $Button_12; Enable on start-up
        _acc()
        If $access = 1 Then
            FileCopy("C:\Pass\pass.exe", "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\pass.exe", 1)
            _done()
        EndIf
    Case $msg = $Button_13; Disble on start-up
        _acc()
        If $access = 1 Then
            FileDelete("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\pass.exe")
            _done()
        EndIf
    Case $msg = $Button_14; Remove all files
        _acc()
        If $access = 1 Then
            FileDelete("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\pass.exe")
            DirRemove("C:\pass", 1)
            _done()
        EndIf
    Case $msg = $Button_16; Runs the password program
        _acc()
        If $access = 1 Then
            Run("pass.exe", "C:\pass\pass.exe")
        EndIf
    Case $msg = $Button_17; Log-Out
        If $access = 0 Then
            MsgBox(0, "Log-Out", "You can't log-out if you havn't logged in...")
        EndIf
        If $access = 1 Then
            $access = 0
            _done()
        Endif
    Case $msg = $Button_19; Starts the auto-activate program
        _acc()
        If $access = 1 Then
            Run("auto-activate", "C:\Pass")
            Msgbox(0, "Auto-Activate", "Press F9 to run pass.exe")
            _done()
        Endif
    Case $msg = $Button_20; Credits
        If $access = 0 Then
            MsgBox(0, "Enter Password", "Please Enter correct password!")
        Endif
        If $access = 1 Then
            MsgBox(0, "Credits", "This Program and all of it's extensions were made by: Firestorm." & @LF & "~~Firestorm is in no way responsible for what you do with this program or any of it's extensions!~~")
        EndIf
    Case $msg = $Button_21; Enable Auto-Activate on start-up
        _acc()
        If $access = 1 Then
            FileCopy("C:\Pass\auto-activate.exe", "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\auto-activate.exe", 1)
            _done()
        Endif
    Case $msg = $button_22; Disable Auto-Activate on start-up
        _acc()
        If $access = 1 Then
            FileDelete("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\auto-activate.exe")
        EndIf
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

Func _acc()
    If $access = 0 Then
        MsgBox(0, "Enter Password", "Please Enter correct password!")
    Endif
EndFunc

Func _done()
    MsgBox(0, "Complete", "Task Complete")
EndFunc

I've been testing it with the credit button becauise that has nothing to do with other files.

The password is 1-2-5-7-9

I can't figure out why none of my buttons work, please help.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

  • Moderators

Did you try getting rid of the Case Else??

Edit:

Example:

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
#include <File.au3>
#include <GuiConstants.au3>
Local $ATTEMPT = '', $returnvalue = ''
GuiCreate("MyGUI", 280, 213,(@DesktopWidth-280)/2, (@DesktopHeight-213)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button_1 = GuiCtrlCreateButton("1", 10, 30, 40, 40)
$Button_2 = GuiCtrlCreateButton("2", 50, 30, 40, 40)
$Button_3 = GuiCtrlCreateButton("3", 90, 30, 40, 40)
$Button_4 = GuiCtrlCreateButton("4", 10, 70, 40, 40)
$Button_5 = GuiCtrlCreateButton("5", 50, 70, 40, 40)
$Button_6 = GuiCtrlCreateButton("6", 90, 70, 40, 40)
$Button_7 = GuiCtrlCreateButton("7", 10, 110, 40, 40)
$Button_8 = GuiCtrlCreateButton("8", 50, 110, 40, 40)
$Button_9 = GuiCtrlCreateButton("9", 90, 110, 40, 40)
$Button_10 = GuiCtrlCreateButton("Enter", 10, 150, 120, 30)
$Group_11 = GuiCtrlCreateGroup("Please enter passsword", 0, 10, 140, 180)
$Button_12 = GuiCtrlCreateButton("Enable pass on start-up", 160, 40, 120, 20)
$Button_13 = GuiCtrlCreateButton("Disable pass on start-up", 160, 60, 120, 20)
$Button_14 = GuiCtrlCreateButton("Remove All Files", 140, 140, 100, 20)
$Date_15 = GuiCtrlCreateDate("Date15", 10, 190, 190, 20)
$Button_16 = GuiCtrlCreateButton("Open Pass Program", 160, 20, 120, 20)
$Button_17 = GuiCtrlCreateButton("Log-Out", 210, 190, 70, 20)
$Button_19 = GuiCtrlCreateButton("Start Auto-Activate Program", 140, 0, 140, 20)
$Button_20 = GuiCtrlCreateButton("Credit", 210, 170, 70, 20)
$Button_21 = GuiCtrlCreateButton("Enable Auto-Activate on start", 130, 80, 150, 20)
$Button_22 = GuiCtrlCreateButton("Disable Auto-Activate on start", 130, 100, 150, 20)
$pass = 0
$access = 0

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg =  $Button_1
        If $pass = 0 Then
            $pass = 1
        EndIf
    Case $msg = $Button_2
        If $pass = 1 Then
            $pass = 2
        EndIf
    Case $msg = $Button_3
        $pass = 0
    Case $msg = $Button_4
        $pass = 0
    Case $msg = $Button_5
        IF $pass = 2 Then
            $pass = 3
        EndIf
    Case $msg = $Button_6
        $pass = 0
    Case $msg = $Button_7
        IF $pass = 3 Then
            $pass = 4
        EndIf
    Case $msg = $Button_8
        $pass = 0
    Case $msg = $Button_9
        IF $pass = 4 Then
            $pass = 5
        EndIf
    Case $msg = $Button_10; Code -- pass = 5;; 1-2-5-7-9
   ; -- ENTER KEY --
        If $pass = 5 Then
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", " ")
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*_-=Pass Accepted=-_* " & $ATTEMPT & " -" & $returnvalue)
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", " ")
            Sleep(1200)
            MsgBox(0, "Pass", "Password accepted!")
            $access = 1
        EndIf
        If $pass = 0 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 1 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 2 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 3 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 4 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat", "*** Invalid Pass *** " & $ATTEMPT & " -" & $returnvalue)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        
        $pass = 0
        $ATTEMPT = $ATTEMPT + 1
        _FileWriteLog("C:\Pass\Logs\Log_Command_Center.dat""", "*** Invalid Pass ***  " & $ATTEMPT & " -" & $returnvalue)
   ;;End Enter Key
    Case $msg = $Button_12; Enable on start-up
        _acc()
        If $access = 1 Then
            FileCopy("C:\Pass\pass.exe", "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\pass.exe", 1)
            _done()
        EndIf
    Case $msg = $Button_13; Disble on start-up
        _acc()
        If $access = 1 Then
            FileDelete("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\pass.exe")
            _done()
        EndIf
    Case $msg = $Button_14; Remove all files
        _acc()
        If $access = 1 Then
            FileDelete("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\pass.exe")
            DirRemove("C:\pass", 1)
            _done()
        EndIf
    Case $msg = $Button_16; Runs the password program
        _acc()
        If $access = 1 Then
            Run("pass.exe", "C:\pass\pass.exe")
        EndIf
    Case $msg = $Button_17; Log-Out
        If $access = 0 Then
            MsgBox(0, "Log-Out", "You can't log-out if you havn't logged in...")
        EndIf
        If $access = 1 Then
            $access = 0
            _done()
        Endif
    Case $msg = $Button_19; Starts the auto-activate program
        _acc()
        If $access = 1 Then
            Run("auto-activate", "C:\Pass")
            Msgbox(0, "Auto-Activate", "Press F9 to run pass.exe")
            _done()
        Endif
    Case $msg = $Button_20; Credits
        If $access = 0 Then
            MsgBox(0, "Enter Password", "Please Enter correct password!")
        Endif
        If $access = 1 Then
            MsgBox(0, "Credits", "This Program and all of it's extensions were made by: Firestorm." & @LF & "~~Firestorm is in no way responsible for what you do with this program or any of it's extensions!~~")
        EndIf
    Case $msg = $Button_21; Enable Auto-Activate on start-up
        _acc()
        If $access = 1 Then
            FileCopy("C:\Pass\auto-activate.exe", "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\auto-activate.exe", 1)
            _done()
        Endif
    Case $msg = $button_22; Disable Auto-Activate on start-up
        _acc()
        If $access = 1 Then
            FileDelete("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\auto-activate.exe")
        EndIf
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

Func _acc()
    If $access = 0 Then
        MsgBox(0, "Enter Password", "Please Enter correct password!")
    Endif
EndFunc

Func _done()
    MsgBox(0, "Complete", "Task Complete")
EndFunc
You also didn't have $ATTEMPT / $RETURNVALUE declared... Edited by SmOke_N

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.

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