vickerps Posted April 4, 2004 Posted April 4, 2004 slowly starting to learn the superb autoit-qui One of the probs i'am have is how do you create a loop I have written a little test script which i want to select a name from the combo box. Once the user presses apply a messege box come up saying "name" was selected This works no probs for the first time but then if they press apply again or choose a different name nothing happens. How do i keep it looping? example script GUICreate("names") GUISetControl("button", "Apply", 240,260) GUISetControlNotify() $combo = GUISetControl("combo", "my combo", -1,10,80) GUISetControlData(-1,"paul|peter|sam") GUISetControl("button", "Exit", 290,260,50) While GUImsg() $combo = GuiRead ($combo) IF $combo = "paul" Then MsgBox(0,"", $combo & " " & "was selected") elseIF $combo = "peter" Then MsgBox(0,"", $combo & " " & "was selected") elseIF $combo = "sam" Then MsgBox(0,"", $combo & " " & "was selected") endif Wend
Developers Jos Posted April 4, 2004 Developers Posted April 4, 2004 (edited) You override the $COMBO handle with the value of the combocontrol with this statement:$combo = GuiRead ($combo) try it this way: GUICreate("names") GUISetControl("button", "Apply", 240,260) GUISetControlNotify() $C_COMBO = GUISetControl("combo", "my combo", -1,10,80) GUISetControlData(-1,"paul|peter|sam") GUISetControl("button", "Exit", 290,260,50) While GUImsg() $COMBO = GuiRead($C_COMBO) If $COMBO = "paul" Then MsgBox(0,"", $COMBO & " " & "was selected") ElseIf $COMBO = "peter" Then MsgBox(0,"", $COMBO & " " & "was selected") ElseIf $COMBO = "sam" Then MsgBox(0,"", $COMBO & " " & "was selected") EndIf Wend Edited April 4, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
krclark Posted April 4, 2004 Posted April 4, 2004 (edited) I could not get your script to work. GUICreate does not exist. Possibly I don't have the latest version? Anyway, after a quick look it seems that the Wile...Wend loop will exit after the first GUImsg is received, causing the whole function to stop. Also, there is way too much repitiion in there. You don't need to have a separate If...Then setup for each name if you just want to display which one was selected (all of the outcomes are the same). Try this: GUICreate("names") GUISetControl("button", "Apply", 240,260) GUISetControlNotify() $combo = GUISetControl("combo", "my combo", -1,10,80) GUISetControlData(-1,"paul|peter|sam") GUISetControl("button", "Exit", 290,260,50) While 1 While GUImsg() $combo = GuiRead ($combo) MsgBox(0,"", $combo & " " & "was selected") Wend Wend Of course, then you will need to build in some check to allow exiting the endless While...Wend loop... Edited April 4, 2004 by krclark
Developers Jos Posted April 4, 2004 Developers Posted April 4, 2004 (edited) I could not get your script to work. GUICreate does not exist. Possibly I don't have the latest version? Try this: GUICreate("names")I am lost..... The code works fine for me... Edited April 4, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
krclark Posted April 4, 2004 Posted April 4, 2004 I do not have any GUI functions listed in my AutoIt3 help file. The program tells me that GUICreate is an unknown function. I assume that this means somewhere there is an add-in for the GUI functions, but I did not see anything listed for downloads except the 2 versions of the program and some C++ code.
Developers Jos Posted April 4, 2004 Developers Posted April 4, 2004 I do not have any GUI functions listed in my AutoIt3 help file. The program tells me that GUICreate is an unknown function.I assume that this means somewhere there is an add-in for the GUI functions, but I did not see anything listed for downloads except the 2 versions of the program and some C++ code.This stuff is based on JPM's Test version that includes the GUI functions:http://www.hiddensoft.com/fileman/users/jp...-gui.102.16.zip SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
krclark Posted April 4, 2004 Posted April 4, 2004 Okay, I downloaded that and will try it soon. Is there a list of other useful things which can be downloaded to add-in to the program? There is nothing listing user account folders that I can find...
krclark Posted April 4, 2004 Posted April 4, 2004 Right... So I downloaded the GUI version. Now what? Should I replace the original with these files?
Developers Jos Posted April 4, 2004 Developers Posted April 4, 2004 (edited) I prefer to keep the Beta/Unstable versions in a seperate directory and make a Userfunction in the Editor so i am able to run the script Iam woking on with the Official or Beta version. Edited April 4, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
vickerps Posted April 4, 2004 Author Posted April 4, 2004 thanks JdeB thant work great and learnt somthing in the process using the same script the one you fixed for me. Is it possible to make it bring up the msgbox up without clicking on the apply button so when they select the name in the combo box the msgbox will just come up Kclarke don't take the script the litterally I only wrote it as an example. just found out about autoit-gui a few days ago and it superb with don't they just incorperate this into the main autoit dowload and have it as one entity. oh and krclark thank for your input. go to the help file and go to gui references via the contents the index and search doesn't have the gui in it.
Developers Jos Posted April 4, 2004 Developers Posted April 4, 2004 oh and krclark thank for your input. go to the help file and go to gui references via the contents the index and search doesn't have the gui in it.JPM's last version (autoit-gui.102.16.zip) has a helpfile where he did add all his newfunctions to the helpfile Index... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
vickerps Posted April 4, 2004 Author Posted April 4, 2004 that was quick lol only downloaded 15 the other day.Jdeb have you had a any thoughts on what i asked?using the same script the one you fixed for me. Is it possible to make it bring up the msgbox up without clicking on the apply button so when they select the name in the combo box the msgbox will just come up
Developers Jos Posted April 5, 2004 Developers Posted April 5, 2004 Jdeb have you had a any thoughts on what i asked?missed that questions... try this: GUICreate("names") $C_COMBO = GUISetControl("combo", "my combo", -1,10,80) GUISetControlNotify ( $C_COMBO,2) GUISetControlData(-1,"paul|peter|sam") GUISetControl("button", "Exit", 290,260,50) While GUImsg() $COMBO = GuiRead($C_COMBO) If $COMBO = "paul" Then MsgBox(0,"", $COMBO & " " & "was selected") ElseIf $COMBO = "peter" Then MsgBox(0,"", $COMBO & " " & "was selected") ElseIf $COMBO = "sam" Then MsgBox(0,"", $COMBO & " " & "was selected") EndIf Wend SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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