Jump to content

display images based on random output number values


Recommended Posts

i have a script that generates 4 number results at a time, i want to display an image for every number generated. there's 52 numbers for 52 images

i tried to add this part

If $iRandomResult1 = 1 Then

        $n1 = GUICtrlCreatePic("image1.gif", 50, 50, 0, 0)

  EndIf

to this code

 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $iRandomResult1 = 0
    Local $iRandomResult2 = 0
    Local $iRandomResult3 = 0
    Local $iRandomResult4 = 0
    Local $hGUI = GUICreate("Ace Play", 400, 250, -1, -1)
    Local $n1, $n2, $n3, $n4
    Local $iButton1 = GUICtrlCreateButton("Play", 5, 215, 50, 30)
    Local $iButton10 = GUICtrlCreateButton("Clear", 60, 215, 65, 30)
    Local $iOutput1 = GUICtrlCreateLabel("", 60, 125, 30, 20, BitOR($BS_PUSHLIKE, $SS_CENTER))
    Local $iOutput2 = GUICtrlCreateLabel("", 140, 125, 30, 20, BitOR($BS_PUSHLIKE, $SS_CENTER))
    Local $iOutput3 = GUICtrlCreateLabel("", 225, 125, 30, 20, BitOR($BS_PUSHLIKE, $SS_CENTER))
    Local $iOutput4 = GUICtrlCreateLabel("", 300, 125, 30, 20, BitOR($BS_PUSHLIKE, $SS_CENTER))
    GUICtrlSetFont($iOutput1, 8, 800, "", "Comic Sans MS")
    GUICtrlSetFont($iOutput2, 8, 800, "", "Comic Sans MS")
    GUICtrlSetFont($iOutput3, 8, 800, "", "Comic Sans MS")
    GUICtrlSetFont($iOutput4, 8, 800, "", "Comic Sans MS")

    GUISetState(@SW_SHOW, $hGUI)


; Run the GUI until the dialog is closed
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $iButton1
                $iRandomResult1 = Random(1, 52, 1)
                $iRandomResult2 = Random(1, 52, 1)
                $iRandomResult3 = Random(1, 52, 1)
                $iRandomResult4 = Random(1, 52, 1)
                GUICtrlSetData($iOutput1, $iRandomResult1)
                GUICtrlSetData($iOutput2, $iRandomResult2)
                GUICtrlSetData($iOutput3, $iRandomResult3)
                GUICtrlSetData($iOutput4, $iRandomResult4)


            Case $iButton10
                GUICtrlSetData($iOutput1, "")
                GUICtrlSetData($iOutput2, "")
                GUICtrlSetData($iOutput3, "")
                GUICtrlSetData($iOutput4, "")


        EndSwitch
     WEnd

    GUIDelete($hGUI)
    Exit

 EndFunc   ;==>Example

it doesn't seem to work

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