Jump to content

Reading muliple como boxes but when I check my globals aren't accepting the data


Recommended Posts

Hello everyone,

I'm trying to use multiple combo boxes and then store the data in Global variables. The data seems to be gathered but when I read the globals they don't change, code follows.

Code:

#include "C:\Program Files\AutoIt3\Include\GuiConstants.au3"
#include "C:\Program Files\AutoIt3\Include\Constants.au3"

; Hides tray icon
#NoTrayIcon

; Change to OnEvent mode
;Opt("GUIOnEventMode", 1)

; variable to hold tape 1's numbers
Global $stp1_adpt_no = "0"
Global $stp1_scsi_no = "0"
Global $stp1_lun_no = "0"

; GUI Creation
GuiCreate("Standalone data collection", 150, 150)


; Runs the GUIExit() function if the GUI is closed
GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')

GUICtrlCreateLabel("Tape 1:", 25, 20, 75, 15)
    GUICtrlSetColor(-1,0x000000) ; Makes instructions Red
    
    GUICtrlCreateLabel("Adapter:", 25, 40, 40, 15)
    GUICtrlSetColor(-1,0x000000) ; Makes instructions Red
    
    GUICtrlCreateCombo(" ",65, 40, 40, 10)
    $combo1 = GuiCtrlSetData(-1,"1|2|3|4|5|6|7|8|9|10|11|12|13|14|15")
    
    GUICtrlCreateLabel("SCSI:", 25, 60, 40, 15)
    GUICtrlSetColor(-1,0x000000) ; Makes instructions Red
    
    GUICtrlCreateCombo(" ",65, 60, 40, 10)
    $combo2 = GuiCtrlSetData(-1,"1|2|3|4|5|6|7|8|9|10|11|12|13|14|15")
    
    GUICtrlCreateLabel("LUN:", 25, 80, 40, 15)
    GUICtrlSetColor(-1,0x000000) ; Makes instructions Red
    
    GUICtrlCreateCombo(" ",65, 80, 40, 10)
    $combo3 = GuiCtrlSetData(-1,"1|2|3|4|5|6|7|8|9|10|11|12|13|14|15")
    
    ; Button Creation
    $button = GuiCtrlCreateButton("Go",60,115,50,20)
    
    
    
    ; Shows the GUI after the function completes
GUISetState(@SW_SHOW)

; Idles the script in an infinite loop - this MUST be included when using OnEvent mode
While 1
    ; "Listen" for the message
    $message = GUIGetMsg()
    
    If $message = $GUI_EVENT_CLOSE Then GUIExit()
    
    If $message = $button Then
        ; read the selected day in the combo
        $stp1_adpt_no = GUICtrlRead($combo1)
        $stp1_scsi_no = GUICtrlRead($combo2)
        $stp1_lun_no = GUICtrlRead($combo3)
        ; call the function with the info
        ;MsgBox(0,"","The numbers you entered are Adapter number " & $stp1_adpt_no & ", SCSI number " & $stp1_scsi_no & ", Lun Number " & $stp1_lun_no)
        MsgBox(0,"","The numbers you entered are Adapter number " & $stp1_adpt_no & ", SCSI number " & $stp1_scsi_no & ", Lun Number " & $stp1_lun_no)
    EndIf

WEnd



; This function makes the script exit when the GUI is closed
Func GUIExit()
Exit
EndFunc

Thanks for the help and instruction.

Edited by GaryFrost
changed from color to code box
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...