Jump to content
Sign in to follow this  
ChazFire's REVENGE

Need help w/ arrays ...

Recommended Posts

Wow, i've searched these fourms for over an hour and cant find what i need including the AutoIt Help. Either im realy dumb (hope not) or I just keep skipping over it.

Last night i got some help from cyberslug, and he told me that i should put my radio buttons in as arrays. Click here to see what i meen

can any one give me advice on what i should do? Any help is apreciated thx in advace!

(open attached file for my current code)


[font="Arial"]--------When you go to jail a friend will bve thier to bail you out, but a best friend will be sitting right next to you saying, "D*** we F**ked up!"--------A friend helps you move, but a best friend helps you move dead bodies?Which brings me to my question, what kind of friend are you?[/font]

Share this post

Link to post
Share on other sites

Study :)

Array is created with Dim $nameOfArray[$numberOfElements]

You access array elements using

$nameOfArray[0], $nameOfArray[1], ..., $nameOfArray[$numElements-1]

Next for-loop is used to create the table of radio buttons:

Note the formulas 10 + $row*50 and 10 + $col*20

which mean

original_x_coord + $row * distance between rows

original_y_coord + $col * distance between columns

Select Case with Eval statements was replaced with

Case $msg >= $optInfo[0] And $msg <= $optInfo[19]

By the way, I also used the $BS_PUSHLIKE (0x1000) style for the radios.

#include <GUIConstants.au3>

GUICreate("GUI menu",300,200)

GUICtrlCreateLabel("What do you want to say?", 10, 110, 150)
$TITLE = GUICtrlCreateInput("", 5, 125, 290, 20)
GUICtrlSetState ( -1, $GUI_FOCUS)
GUICtrlSetTip(-1, "The title of the message box.")

$filemenu = GuiCtrlCreateMenu ("File")
$fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu)
$recentfilesmenu = GuiCtrlCreateMenu ("Recent Files",$filemenu)
$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)
$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)
$helpmenu = GuiCtrlCreateMenu ("?")
$aboutitem = GuiCtrlCreateMenuitem ("About",$helpmenu)
;$helpmenu2 = GuiCtrlCreateMenuitem ("help",$helpmenu)
$aboutitemhelp = GuiCtrlCreateMenuitem ("OMFG HELP",$helpmenu)

Dim $optInfo[20];radio button array
Dim $row, $col, $count
; $count is not necessary since it can be derived from $row and $col,
; but $count makes the code cleaner
For $row = 0 to 3
    For $col = 0 to 4
        $optInfo[$count] = GUICtrlCreateRadio("(" & _zeroPad($count+1) & ")", 10 + $row*50, 10 + $col*20,  50, 20, 0x1000)
        $count = $count + 1

; Helper function to pad single digits with a leading zero
Func _zeroPad($num);assume $num is an integer between 0 and 99
    If $num <= 9 Then Return "0" & $num
    Return $num;otherwise just return original number
$spambutton = GuiCtrlCreateButton ("SEND",210,30,70,20)

$cancelbutton = GuiCtrlCreateButton ("Close",210,70,70,20)


Global $selectedNumber = 0

While 1
    $msg = GUIGetMsg()

        Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
        Case $msg = $fileitem
            $file = FileOpenDialog("Choose file...",@TempDir,"All (*.*)")
            If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu)

        Case $msg = $exititem

        Case $msg >= $optInfo[0] And $msg <= $optInfo[19]
            $selectedNumber = $msg - 12;subtract 12 to convert ctrlID# into number you want

        Case $msg = $spambutton
Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(36,"","You'r about to send MESSAGE to USER, are you sure u want to continue?")
                Case $iMsgBoxAnswer = 6;Yes
                    MsgBox(4096,"debug", $selectedNumber)
                    $recipient = "lake" & $selectedNumber
                    $message = """" & GuiCtrlRead($TITLE) & """"
                    Run("net send " & $recipient & " " & $message, "", @SW_HIDE)
                    GuiCtrlSetData($title, "")
                    GuiCtrlSetState($title, $GUI_FOCUS)

                       Case $iMsgBoxAnswer = 7;No


        Case $msg =  $aboutitemhelp
            MsgBox(0, "OMFG HELP","This will be help file."); work damnit
        Case $msg = $aboutitem
            Msgbox(0,"About","Thanks to all who supported this d/l! Email me @ michaell428wak@hotmail.com        v1.0")




Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...