Maurizio Posted October 15, 2020 Share Posted October 15, 2020 Hi! Another request for help because I can't get there alone. I have an input box where only numbers from 1 to 10 must be entered, and the chosen number must call a function from a list of 10 functions. How can it be done ? Thank you Link to comment Share on other sites More sharing options...
Dan_555 Posted October 15, 2020 Share Posted October 15, 2020 (edited) Hi The best way to enter a predefined set of numbers is to use a Read-only combo box, and to add the needed numbers. If you need it in an input box, then you can use something like this: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 283, 45, 192, 124) $hinp = GUICtrlCreateInput("", 13, 11, 248, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $htimer = TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If TimerDiff($htimer) > 1500 Then $input = GUICtrlRead($hinp) if Not(IsNumber($input)) then GUICtrlSetData($hinp,1) If $input < 1 Or $input > 10 Then GUICtrlSetData($hinp, (Mod($input, 9)+1)) EndIf $htimer = TimerInit() EndIf WEnd Edited October 15, 2020 by Dan_555 Small corrections Some of my script sourcecode Link to comment Share on other sites More sharing options...
Maurizio Posted October 15, 2020 Author Share Posted October 15, 2020 Soon I'll try and I'll let you know Thanks Link to comment Share on other sites More sharing options...
Maurizio Posted October 15, 2020 Author Share Posted October 15, 2020 A number from 1 to 10 is typed in the third box. This number will activate an action of the program with 10 different variables, so if I write 3, the number 3 will have to be chosen from the ten options. I hope I was clear, I was getting confused while writing Link to comment Share on other sites More sharing options...
Maurizio Posted October 15, 2020 Author Share Posted October 15, 2020 I am waiting Link to comment Share on other sites More sharing options...
Developers Jos Posted October 15, 2020 Developers Share Posted October 15, 2020 3 minutes ago, Maurizio said: I am waiting ...yes...and? 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. Link to comment Share on other sites More sharing options...
Maurizio Posted October 15, 2020 Author Share Posted October 15, 2020 could you help me in this puzzle of mine? Link to comment Share on other sites More sharing options...
Developers Jos Posted October 15, 2020 Developers Share Posted October 15, 2020 Don't you think that you simply just need to be patient till somebody is willing to help you? 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. Link to comment Share on other sites More sharing options...
Maurizio Posted October 15, 2020 Author Share Posted October 15, 2020 206/5000 you are right but what I wrote is not what I think, the translator reported that sentence, but what I wrote was much more polite i am italian and i don't speak english, sorry. Link to comment Share on other sites More sharing options...
Developers Jos Posted October 15, 2020 Developers Share Posted October 15, 2020 I knew that already, but my comments are not about the chosen words but rather you are bumping you thread in the hope you get faster help, which is considered impolite and against out forum etiquettes. 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. Link to comment Share on other sites More sharing options...
Maurizio Posted October 15, 2020 Author Share Posted October 15, 2020 I humbly apologize, it was not my intention. Link to comment Share on other sites More sharing options...
jchd Posted October 16, 2020 Share Posted October 16, 2020 This is a good use case for a combobox, leaving only a limited number of choices. Also you can give options 1, 2, 3, ..., 10 more explicit "names" (plain text). This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Maurizio Posted October 16, 2020 Author Share Posted October 16, 2020 It may be but I don't understand how it works and therefore I can't implement it in my little program. I need that typing a number in the input box, the program goes to read that number, and use the corresponding variable, so if I write 3 it chooses the variable 3, without writing any message. Thanks for your patience and availability. Link to comment Share on other sites More sharing options...
Zedna Posted October 16, 2020 Share Posted October 16, 2020 My advice: Read at least basics from AutoIt's (great) helpfile instead of placing so many basic questions on the forum. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Maurizio Posted October 16, 2020 Author Share Posted October 16, 2020 6 minutes ago, Zedna said: My advice: Read at least basics from AutoIt's (great) helpfile instead of placing so many basic questions on the forum. Thanks very interesting post. Link to comment Share on other sites More sharing options...
Dan_555 Posted October 16, 2020 Share Posted October 16, 2020 Here is an example with Combo box; #include <GUIConstants.au3> GUICreate('', 120, 40) GUICtrlCreateCombo('', 10, 10, 100, 200, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL)) For $i = 1 To 10 ;Enter the predefined numbers into the combo box GUICtrlSetData(-1,$i) Next GUICtrlSetData(-1, '1') ;Set the 1st entry to 1 GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Some of my script sourcecode 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