Arclite86 Posted April 16, 2014 Share Posted April 16, 2014 I would like to make a counter that count from a list every time the next name is selected with this code: $iIndex += 1 If $iIndex = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0 _GUICtrlListBox_SetCurSel($List1, $iIndex) (selects the next name in $list1) I have made a input were i want the number to be displayed $listcounter = GUICtrlCreateInput("1", 232, 32, 41, 21) I tried to do something like this:, every time i press the next button $iIndex += 1 If $iIndex = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0 _GUICtrlListBox_SetCurSel($List1, $iIndex) GUICtrlSetData($listcounter,+1) but it doesnt work, and like this it wil keep counting every time i press is it even when the list is done.. could someody help me with this? Link to comment Share on other sites More sharing options...
FireFox Posted April 16, 2014 Share Posted April 16, 2014 (edited) Hi, You remind me a guy on this forum who kept asking questions, those questions could be answered easily with some practice and by reading the helpfile. What do you think this does ? GUICtrlSetData($listcounter,+1) Unfortunately not what you're expecting. Edited April 16, 2014 by FireFox Link to comment Share on other sites More sharing options...
Arclite86 Posted April 18, 2014 Author Share Posted April 18, 2014 Hi, You remind me a guy on this forum who kept asking questions, those questions could be answered easily with some practice and by reading the helpfile. What do you think this does ? GUICtrlSetData($listcounter,+1) Unfortunately not what you're expecting. alright I already got it ,its GUICtrlSetData($listcounter,$iIndex) but now im trying to make an other counter that when its hits the nummer 20 it returns to 0 and starts all over again I have looked in the helpfile but could not find what i was looking for I have tried these things: GUICtrlSetData($listcounter,$iIndex) $rt = GUICtrlRead($listcounter) GUICtrlSetData($listcounter2,$rt ) If $iIndex = 20 Then $listcounter2 =0 GUICtrlSetData($listcounter,$iIndex) $rt = GUICtrlRead($listcounter) GUICtrlSetData($listcounter2,$rt ) If $iIndex = 20 Then $listcounter2 =$listcounter2-20 but instead of returing to 0 it stays stuck at 20 Link to comment Share on other sites More sharing options...
FireFox Posted April 18, 2014 Share Posted April 18, 2014 (edited) Where is $listcounter2 var set to? Others : I know what's wrong, I'm trying to guide him to the problem. Edited April 18, 2014 by FireFox Link to comment Share on other sites More sharing options...
Arclite86 Posted April 18, 2014 Author Share Posted April 18, 2014 (edited) Where is $listcounter2 var set to? Others : I know what's wrong, I'm trying to guide him to the problem. im sorry I forgot to give the info of the second input $listcounter2 = GUICtrlCreateInput("0", 272, 32, 41, 21) I hope thats answers your question What should i do now...? Edited April 18, 2014 by Arclite86 Link to comment Share on other sites More sharing options...
BrewManNH Posted April 19, 2014 Share Posted April 19, 2014 What should i do now...? Open the help file and read it thoroughly. Another extremely simple question that would be answered by doing some of the work yourself for once. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Arclite86 Posted April 19, 2014 Author Share Posted April 19, 2014 Open the help file and read it thoroughly. Another extremely simple question that would be answered by doing some of the work yourself for once. then show me where i can find this part in the helpfile because I cant find it, I already told that Link to comment Share on other sites More sharing options...
FireFox Posted April 19, 2014 Share Posted April 19, 2014 (edited) Questions to answer are : What GUICtrlCreate* functions return? Can this return variable be directly assigned to change the control value? Edited April 19, 2014 by FireFox Link to comment Share on other sites More sharing options...
Arclite86 Posted April 19, 2014 Author Share Posted April 19, 2014 Questions to answer are : What GUICtrlCreate* functions return? Can this return variable be directly assigned to change the control value? I used multiple, GUICtrlCreate* input,label,edit but they al wont work if i use my code, I did figured out how to get it to "0" with this GUICtrlSetData($listcounter,$iIndex) $rt = GUICtrlRead($listcounter) GUICtrlSetData($listcounter2,$rt ) If $iIndex = 5 Then $listcounter2 = GUICtrlSetData($listcounter2,0) But i just cant figure out how to make it count after it returns to "0" Link to comment Share on other sites More sharing options...
Arclite86 Posted April 19, 2014 Author Share Posted April 19, 2014 (edited) when I also use something like this Local $i = 0 While $i <= 10 GUICtrlSetData($listcounter2,$i) $i = $i + 1 WEnd For $counter = 1 to 10 GUICtrlSetData($listcounter2,$counter) Next It should work but when i press one time it shows the number 10 and stays at that number how is that possible, I have also tried different GUICtrlCreate, what am i doing wrong? can somebody explain this please ? Edited April 19, 2014 by Arclite86 Link to comment Share on other sites More sharing options...
FireFox Posted April 19, 2014 Share Posted April 19, 2014 Explain me this line : If $iIndex = 5 Then $listcounter2 = GUICtrlSetData($listcounter2,0) Link to comment Share on other sites More sharing options...
Arclite86 Posted April 19, 2014 Author Share Posted April 19, 2014 (edited) Explain me this line : If $iIndex = 5 Then $listcounter2 = GUICtrlSetData($listcounter2,0) I tried when the $index is 5 then set the input to 0 but i have a better code For $counter = 1 to 10 GUICtrlSetData($listcounter2,$counter) Next I tried to make it count every time I hit the button until 10 and then restart, but when I press it the first time it doesnt count but directly shows the number 10.. I dont know what to do, I'm looking in the helpfile for a while now but I cant find the solution, help please. Edited April 19, 2014 by Arclite86 Link to comment Share on other sites More sharing options...
FireFox Posted April 19, 2014 Share Posted April 19, 2014 This is not what I asked, I know what you're trying to do. Link to comment Share on other sites More sharing options...
Arclite86 Posted April 19, 2014 Author Share Posted April 19, 2014 (edited) This is not what I asked, I know what you're trying to do. If $iIndex = 5 Then $listcounter2 = GUICtrlSetData($listcounter2,0) when the $index is 5 then display 0 right? Edited April 19, 2014 by Arclite86 Link to comment Share on other sites More sharing options...
FireFox Posted April 19, 2014 Share Posted April 19, 2014 Partly yes, but that's not all. And that's the rest which causes a problem. Link to comment Share on other sites More sharing options...
Arclite86 Posted April 19, 2014 Author Share Posted April 19, 2014 Partly yes, but that's not all. And that's the rest which causes a problem. but when i use this Local $i = 0 While $i <= 10 GUICtrlSetData($listcounter2,$i) $i = $i + 1 WEnd how can this not work? Link to comment Share on other sites More sharing options...
FireFox Posted April 19, 2014 Share Posted April 19, 2014 I don't see the point of your while code since it will set the data from 0 to 10 and you won't have enough time to see it has changed. So it's the same as setting the data to 10. So I wanted you to find out that you are resetting the value of the $listcounter2 variable in this code : If $iIndex = 5 Then $listcounter2 = GUICtrlSetData($listcounter2,0) Because the function GUICtrlSetData return either 0, 1 or -1 (see helpfile). Hence, you can't reuse this variable to handle the input. At start, the variable contained the id of the input. And please, read the helpfile. Br, FireFox. 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