Sign in to follow this  
Followers 0
CWorks

need some help with arrays

3 posts in this topic

#1 ·  Posted (edited)

ok here's a quick & dirty example

I need to convert my Updown into milliseconds without doing if else if else if else etc.. over and over again a million times

I've looked at a few hundred examples but i just can't seem to understand arrays

also how do i get it to not display negative numbers

#include <GUIConstants.au3>

$Main = GUICreate("AForm1", 235, 150, -1, -1, $WS_CAPTION + $WS_SYSMENU, $WS_EX_TOOLWINDOW)
$Wait = GUICtrlCreateInput("1", 40, 8, 45, 20, $ES_RIGHT)
$updown = GUICtrlCreateUpdown($Wait)
$OK = GUICtrlCreateButton("OK", 40, 100, 75, 22, $BS_DEFPUSHBUTTON)
$Cancel = GUICtrlCreateButton("Cancel", 120, 100, 75, 22)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Cancel
            Exit
        Case $msg = $OK
            $Wait = GUICtrlRead($Wait)
            If $Wait = "1" Then
                $Wait = "60000" ; 1 minute in milliseconds
                MsgBox(0, $Wait, $Wait)
                Exit
            Else
                If $Wait = "2" Then
                    $Wait = "120000"
                    MsgBox(0, $Wait, $Wait)
                    Exit
                Else
                    If $Wait = "3" Then
                        $Wait = "240000"
                        MsgBox(0, $Wait, $Wait)
                        Exit
                        ;;;; etc.. etc...
                    EndIf
                EndIf
            EndIf
    EndSelect
WEnd

crap my posted example didn't even work :P

Edited by CWorks

Share this post


Link to post
Share on other sites



maybe

#include <GUIConstants.au3>
$Main = GUICreate("AForm1", 235, 150, -1, -1, $WS_CAPTION + $WS_SYSMENU, $WS_EX_TOOLWINDOW)
$Wait = GUICtrlCreateInput("1", 40, 8, 45, 20, $ES_RIGHT)
$updown = GUICtrlCreateUpdown($Wait)
GUICtrlSetLimit(-1, 100, 1)
$OK = GUICtrlCreateButton("OK", 40, 100, 75, 22, $BS_DEFPUSHBUTTON)
$Cancel = GUICtrlCreateButton("Cancel", 120, 100, 75, 22)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Cancel
            Exit
        Case $msg = $OK
            $Waiter = (GUICtrlRead($Wait) * 1000)
            If $Waiter < 0 Then ContinueLoop
            MsgBox(0, "time", $Waiter)
            ;Exit
    EndSelect
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

damn that was simple :P

thanks for the help

I was hoping it needed an array so i could learn how to use them

It's the only way i can learn is if i have an example that i use

oh well i'll have to pull apart a file with an array and see how they work


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