palidhjede Posted November 28, 2007 Posted November 28, 2007 Im trying to creat a GUI to launch programs and im tryin to use a combo but i dont know how to assign values the the names on the combo so when the user clicks that program name a certain event is triggered to open that program..any help will b appreciated
Thatsgreat2345 Posted November 28, 2007 Posted November 28, 2007 You could use guictrlread and either select case endselect, or if then statements . Or 2 dimentional arrays. for a beginner, the first way i said would be easier
PsaltyDS Posted November 28, 2007 Posted November 28, 2007 Im trying to creat a GUI to launch programs and im tryin to use a combo but i dont know how to assign values the the names on the combo so when the user clicks that program name a certain event is triggered to open that program..any help will b appreciated When you read a combo, the text of the selection is returned. That text is then used to look up the action: expandcollapse popup#Include <GuiConstants.au3> Opt("GuiOnEventMode", 1) Global $avProgs[5] = [0, "Firefox 2.0.0.10", "OpenOffice.org 2.2.1", "GIMP 2.4.2", "7-Zip 4.56"] Global $hGUI = GUICreate("Combo Test", 300, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") GUICtrlCreateLabel("Select an application and click START:", 10, 10, 280, 20) $Combo_1 = GUICtrlCreateCombo("<Select Program>", 10, 40, 280, 200) For $n = 1 To UBound($avProgs) - 1 GUICtrlSetData($Combo_1, $avProgs[$n]) Next GUICtrlCreateButton("START", 100, 160, 100, 30) GUICtrlSetOnEvent(-1, "_ButtonHit") GUISetState() While 1 If $avProgs[0] Then MsgBox(64, "Selection", "Selection index = " & $avProgs[0]) MsgBox(64, "Running", "Running something now for " & $avProgs[$avProgs[0]]) $avProgs[0] = 0 ; Done, clear selection EndIf Sleep(20) WEnd Func _ButtonHit() $sProg = GUICtrlRead($Combo_1) For $n = 1 To UBound($avProgs) - 1 If $sProg = $avProgs[$n] Then $avProgs[0] = $n Return EndIf Next EndFunc ;==>_ButtonHit Func _Quit() Exit EndFunc ;==>_Quit Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
palidhjede Posted November 28, 2007 Author Posted November 28, 2007 Thank you very much that is exactually what I needed
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