Jump to content

Random GUICtrlSetData


nf67
 Share

Recommended Posts

Hello there,

If I press the button Ontvang ( = Receive ) I'd like the Bericht ( = Message ), Van ( = From ), Onderwerp ( = Subject ) and Aan ( = To ) content to be set randomly ( I want the script to choose between a few presets ).

How do I do this?

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Chris\Mijn documenten\slaafzender.kxf
$Form1 = GUICreate("Form1", 436, 240, 193, 125)
$Kolen = GUICtrlCreateCheckbox("Kolen?", 24, 104, 65, 17)
$Pluimen = GUICtrlCreateCheckbox("Pluimen?", 24, 120, 65, 17)
$Wapens = GUICtrlCreateCheckbox("Wapens?", 24, 136, 65, 17)
$Hulp = GUICtrlCreateCheckbox("Hulp?", 24, 152, 57, 17)
$Onderwerp = GUICtrlCreateInput("Onderwerp", 88, 32, 313, 21)
$Label1 = GUICtrlCreateLabel("Onderwerp:", 24, 32, 59, 17)
$Aan = GUICtrlCreateInput("Aan", 56, 56, 345, 21)
$Label2 = GUICtrlCreateLabel("Aan:", 24, 56, 26, 17)
$Label3 = GUICtrlCreateLabel("Van:", 24, 80, 26, 17)
$Van = GUICtrlCreateInput("Van", 56, 80, 345, 21)
$Bericht = GUICtrlCreateInput("Bericht", 104, 104, 297, 100)
$Verzend = GUICtrlCreateButton("Verzend", 320, 208, 81, 25, 0)
$Alarm = GUICtrlCreateButton("Alarm", 232, 208, 81, 25, 0)
$Ontvang = GUICtrlCreateButton("Ontvang", 144, 208, 81, 25, 0)
$Boodschap = GUICtrlCreateRadio("Boodschap", 24, 208, 73, 17)
$Bestelling = GUICtrlCreateRadio("Bestelling", 24, 192, 73, 17)
$Titel = GUICtrlCreateLabel("Slaafzender Versie 1.0.0", 160, 8, 119, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Verzend
            msgbox ( 64, "Verzonden!", "Uw bericht is verzonden" ) 
            soundplay ( "C:\Verzondengeluid.wav") 
        Case $Alarm
            soundPlay ( "C:\Alarmgeluid.wav" ) 
        Case $Ontvang   
            
;EITHER SET ALL INPUTS THIS WAY
            GUICtrlSetData($Bericht, "Begrepen! Er wordt werk van gemaakt!")
            GUICtrlSetData($Van, "Leider")
            GUICtrlSetData($Aan, "Jou")
            GUICtrlSetData($Onderwerp, "Antwoord op je bericht")
            
;OR THIS WAY    [/b]    
            GUICtrlSetData($Bericht, "Komt voor elkaar!")
            GUICtrlSetData($Van, "Baas")
            GUICtrlSetData($Aan, "Jou")
            GUICtrlSetData($Onderwerp, "Antwoord")
            
;OR LIKE THIS   
            GUICtrlSetData($Bericht, "Helemaal duidelijk!")
            GUICtrlSetData($Van, "Meester")
            GUICtrlSetData($Aan, "Jou")
            GUICtrlSetData($Onderwerp, "Reactie")

    EndSwitch
WEnd

Thanks,

Chris

Edited by nf67
Link to comment
Share on other sites

Case $Ontvang  
    $iChoice = Random(1, 3, 1)
    Switch $iChoice
        Case 1
            GUICtrlSetData($Bericht, "Begrepen! Er wordt werk van gemaakt!")
            GUICtrlSetData($Van, "Leider")
            GUICtrlSetData($Aan, "Jou")
            GUICtrlSetData($Onderwerp, "Antwoord op je bericht")
        Case 2
            GUICtrlSetData($Bericht, "Komt voor elkaar!")
            GUICtrlSetData($Van, "Baas")
            GUICtrlSetData($Aan, "Jou")
            GUICtrlSetData($Onderwerp, "Antwoord")
        Case 3
            GUICtrlSetData($Bericht, "Helemaal duidelijk!")
            GUICtrlSetData($Van, "Meester")
            GUICtrlSetData($Aan, "Jou")
            GUICtrlSetData($Onderwerp, "Reactie")
    EndSwitch

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