Jump to content

Recommended Posts

Posted

Can anyone tell me why the buttons in this script don't work? I am going to go crazy if I can't figure it out... :)

#include <GUIConstants.au3>
$z = 0
$closd = 0
$am = ""
GUICreate("Locked", @DesktopWidth, @DesktopHeight)
$1 = GUICtrlCreateLabel("Do not touch computer", 80, 80, 800, 800)
$button1 = GUICtrlCreateButton("1", 608, 720, 17, 17, 0)
$button2 = GUICtrlCreateButton("2", 632, 720, 17, 17, 0)
$button3 = GUICtrlCreateButton("3", 656, 720, 17, 17, 0)
$button4 = GUICtrlCreateButton("4", 608, 744, 17, 17, 0)
$button5 = GUICtrlCreateButton("5", 632, 744, 17, 17, 0)
$button6 = GUICtrlCreateButton("6", 656, 744, 17, 17, 0)
$button7 = GUICtrlCreateButton("7", 608, 768, 17, 17, 0)
$button8 = GUICtrlCreateButton("8", 632, 768, 17, 17, 0)
$button9 = GUICtrlCreateButton("9", 656, 768, 17, 17, 0)
$Group1 = GUICtrlCreateGroup("Number Pad", 600, 704, 81, 113)
$button10 = GUICtrlCreateButton("0", 632, 792, 17, 17, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$2 = GUICtrlCreateLabel("Time: " & @MIN & ":" & @HOUR, 10, 900)
GUICtrlSetFont($1, 50)
GUISetState(@SW_SHOW)
HotKeySet(@WDAY, "wday")
Func wday ()
    Exit
EndFunc
While 1
    $time = @HOUR & @MIN & @SEC
    If $time < @HOUR & @MIN & @SEC then
    GUICtrlDelete($2)
    $2 = GUICtrlCreateLabel("Time: " & @HOUR & ":" & @MIN & ":" & @SEC, 10, 900)
    EndIf
    $msg = GUIGetMsg ()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        $closd = 1
    Case $msg = $button1
        $am = $am & 1
    Case $msg = $button2
        $am = $am & 2
    Case $msg = $button3
        $am = $am & 3
    Case $msg = $button4
        $am = $am & 4
    Case $msg = $button5
        $am = $am & 5
    Case $msg = $button6
        $am = $am & 6
    Case $msg = $button7
        $am = $am & 7
    Case $msg = $button8
        $am = $am & 8
    Case $msg = $button9
        $am = $am & 9
    Case $msg = $button10
        $am = $am & 0
    Case $am = @YEAR & @MDAY
        Exit
    EndSelect
WEnd
MsgBox(0, "Closed", "Closed:" & $closd)
Posted (edited)

#include <GUIConstants.au3>
$z = 0
$closd = 0
$am = ""
GUICreate("Locked", @DesktopWidth, @DesktopHeight)
$1 = GUICtrlCreateLabel("Do not touch computer", 80, 80, 800, 200)
$button1 = GUICtrlCreateButton("1", 608, 720, 17, 17, 0)
$button2 = GUICtrlCreateButton("2", 632, 720, 17, 17, 0)
$button3 = GUICtrlCreateButton("3", 656, 720, 17, 17, 0)
$button4 = GUICtrlCreateButton("4", 608, 744, 17, 17, 0)
$button5 = GUICtrlCreateButton("5", 632, 744, 17, 17, 0)
$button6 = GUICtrlCreateButton("6", 656, 744, 17, 17, 0)
$button7 = GUICtrlCreateButton("7", 608, 768, 17, 17, 0)
$button8 = GUICtrlCreateButton("8", 632, 768, 17, 17, 0)
$button9 = GUICtrlCreateButton("9", 656, 768, 17, 17, 0)
$Group1 = GUICtrlCreateGroup("Number Pad", 600, 704, 81, 113)
$button10 = GUICtrlCreateButton("0", 632, 792, 17, 17, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$2 = GUICtrlCreateLabel("Time: " & @MIN & ":" & @HOUR, 10, 900)
GUICtrlSetFont($1, 50)
GUISetState(@SW_SHOW)
HotKeySet(@WDAY, "wday")
Func wday ()
    Exit
EndFunc
While 1
    $time = @HOUR & @MIN & @SEC
    If $time < @HOUR & @MIN & @SEC then
    GUICtrlDelete($2)
    $2 = GUICtrlCreateLabel("Time: " & @HOUR & ":" & @MIN & ":" & @SEC, 10, 900)
    EndIf
    $msg = GUIGetMsg ()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        $closd = 1
    Case $msg = $button1
        $am = $am & 1
    Case $msg = $button2
        $am = $am & 2
    Case $msg = $button3
        $am = $am & 3
    Case $msg = $button4
        $am = $am & 4
    Case $msg = $button5
        $am = $am & 5
    Case $msg = $button6
        $am = $am & 6
    Case $msg = $button7
        $am = $am & 7
    Case $msg = $button8
        $am = $am & 8
    Case $msg = $button9
        $am = $am & 9
    Case $msg = $button10
        $am = $am & 0
    Case $am = @YEAR & @MDAY
        Exit
    EndSelect
WEnd
MsgBox(0, "Closed", "Closed:" & $closd)

(Here is a fixed version)

Look at the size of your label. it overlaps the over controls.

Edited by chris95219
Posted

Thanks!

  chris95219 said:

#include <GUIConstants.au3>
$z = 0
$closd = 0
$am = ""
GUICreate("Locked", @DesktopWidth, @DesktopHeight)
$1 = GUICtrlCreateLabel("Do not touch computer", 80, 80, 800, 200)
$button1 = GUICtrlCreateButton("1", 608, 720, 17, 17, 0)
$button2 = GUICtrlCreateButton("2", 632, 720, 17, 17, 0)
$button3 = GUICtrlCreateButton("3", 656, 720, 17, 17, 0)
$button4 = GUICtrlCreateButton("4", 608, 744, 17, 17, 0)
$button5 = GUICtrlCreateButton("5", 632, 744, 17, 17, 0)
$button6 = GUICtrlCreateButton("6", 656, 744, 17, 17, 0)
$button7 = GUICtrlCreateButton("7", 608, 768, 17, 17, 0)
$button8 = GUICtrlCreateButton("8", 632, 768, 17, 17, 0)
$button9 = GUICtrlCreateButton("9", 656, 768, 17, 17, 0)
$Group1 = GUICtrlCreateGroup("Number Pad", 600, 704, 81, 113)
$button10 = GUICtrlCreateButton("0", 632, 792, 17, 17, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$2 = GUICtrlCreateLabel("Time: " & @MIN & ":" & @HOUR, 10, 900)
GUICtrlSetFont($1, 50)
GUISetState(@SW_SHOW)
HotKeySet(@WDAY, "wday")
Func wday ()
    Exit
EndFunc
While 1
    $time = @HOUR & @MIN & @SEC
    If $time < @HOUR & @MIN & @SEC then
    GUICtrlDelete($2)
    $2 = GUICtrlCreateLabel("Time: " & @HOUR & ":" & @MIN & ":" & @SEC, 10, 900)
    EndIf
    $msg = GUIGetMsg ()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        $closd = 1
    Case $msg = $button1
        $am = $am & 1
    Case $msg = $button2
        $am = $am & 2
    Case $msg = $button3
        $am = $am & 3
    Case $msg = $button4
        $am = $am & 4
    Case $msg = $button5
        $am = $am & 5
    Case $msg = $button6
        $am = $am & 6
    Case $msg = $button7
        $am = $am & 7
    Case $msg = $button8
        $am = $am & 8
    Case $msg = $button9
        $am = $am & 9
    Case $msg = $button10
        $am = $am & 0
    Case $am = @YEAR & @MDAY
        Exit
    EndSelect
WEnd
MsgBox(0, "Closed", "Closed:" & $closd)

(Here is a fixed version)

Look at the size of your label. it overlaps the over controls.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...