jesternaut Posted December 14, 2007 Share Posted December 14, 2007 (edited) 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: expandcollapse popup#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 December 14, 2007 by GaryFrost changed from color to code box Link to comment Share on other sites More sharing options...
Nahuel Posted December 14, 2007 Share Posted December 14, 2007 You are doing this: GUICtrlCreateCombo() $combo3 = GUICtrlSetData() instead of this: $combo3 = GUICtrlCreateCombo() GUICtrlSetData() Link to comment Share on other sites More sharing options...
jesternaut Posted December 15, 2007 Author Share Posted December 15, 2007 OH! Man! I feel like I'm one step away from a Darwin award!!! Thanks, for your help and I hope you win a lottery soon. Link to comment Share on other sites More sharing options...
Nahuel Posted December 15, 2007 Share Posted December 15, 2007 Why, you a wizard or somethin Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now