Sign in to follow this  
Followers 0
Valiante

Lottery Number Picker

1 post in this topic

#1 ·  Posted (edited)

I'm a beginner, so be kind...

#include <Array.au3>
#include <GUIConstants.au3>

Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

Dim $avArray[6]
    $avArray[0] = Random(1, 49, 1)
Do
    $avArray[1] = Random(1, 49, 1)
Until $avArray[1] <> $avArray[0]
Do
    $avArray[2] = Random(1, 49, 1)
Until $avArray[2] <> $avArray[0] AND $avArray[2] <> $avArray[1]
Do
    $avArray[3] = Random(1, 49, 1)
Until $avArray[3] <> $avArray[0] AND $avArray[3] <> $avArray[1] AND $avArray[3] <> $avArray[2]
Do
    $avArray[4] = Random(1, 49, 1)
Until $avArray[4] <> $avArray[0] AND $avArray[4] <> $avArray[1] AND $avArray[4] <> $avArray[2] AND $avArray[4] <> $avArray[3]
Do
    $avArray[5] = Random(1, 49, 1)
Until $avArray[5] <> $avArray[0] AND $avArray[5] <> $avArray[1] AND $avArray[5] <> $avArray[2] AND $avArray[5] <> $avArray[3] AND $avArray[5] <> $avArray[4]

_ArraySort($avArray)

GUICreate("Lottery Picker", 670, 120)
GUISetFont(12, -1, 4, "Tahoma")
GUISetOnEvent(-3, "ClosePressed")
GUICtrlCreatePic(GetBall($avArray[0]), 10, 10, 100, 100)
GUICtrlCreateLabel ($avArray[0], 50, 50, 20, 20, $SS_CENTER)
GUICtrlSetBkColor(-1, GetColour($avArray[0]))
GUICtrlCreatePic(GetBall($avArray[1]), 120, 10, 100, 100)
GUICtrlCreateLabel ($avArray[1], 160, 50, 20, 20, $SS_CENTER)
GUICtrlSetBkColor(-1, GetColour($avArray[1]))
GUICtrlCreatePic(GetBall($avArray[2]), 230, 10, 100, 100)
GUICtrlCreateLabel ($avArray[2], 270, 50, 20, 20, $SS_CENTER)
GUICtrlSetBkColor(-1, GetColour($avArray[2]))
GUICtrlCreatePic(GetBall($avArray[3]), 340, 10, 100, 100)
GUICtrlCreateLabel ($avArray[3], 380, 50, 20, 20, $SS_CENTER)
GUICtrlSetBkColor(-1, GetColour($avArray[3]))
GUICtrlCreatePic(GetBall($avArray[4]), 450, 10, 100, 100)
GUICtrlCreateLabel ($avArray[4], 490, 50, 20, 20, $SS_CENTER)
GUICtrlSetBkColor(-1, GetColour($avArray[4]))
GUICtrlCreatePic(GetBall($avArray[5]), 560, 10, 100, 100)
GUICtrlCreateLabel ($avArray[5], 600, 50, 20, 20, $SS_CENTER)
GUICtrlSetBkColor(-1, GetColour($avArray[5]))


GUISetState(@SW_SHOW)

; Just idle around
While 1
    Sleep(10)
Wend

Func GetColour($value)
    Select
        Case $value < 10
            $colour = "0xFFFFFF"
        Case $value < 20
            $colour = "0xAEC8EB"
        Case $value < 30
            $colour = "0xFD9DAA"
        Case $value < 40
            $colour = "0x5CA03C"
        Case $value < 50
            $colour = "0xF2E142"
    EndSelect
    Return $colour
EndFunc

Func GetBall($value)
    Select
        Case $value < 10
            $ball = "white.bmp"
        Case $value < 20
            $ball = "blue.bmp"
        Case $value < 30
            $ball = "pink.bmp"
        Case $value < 40
            $ball = "green.bmp"
        Case $value < 50
            $ball = "yellow.bmp"
    EndSelect
    Return $ball
EndFunc

Func ClosePressed()
    Exit
EndFunc

Produces:

Posted Image

Code and images attached (zipped).

Lottery_Picker.zip

Edited by Valiante

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