Rex Posted December 2, 2009 Share Posted December 2, 2009 Hi there I have a lot of inputs that i would like to clear and lots of combo's that i would like to reset to default. All are formated like this $Tab_Fx_Customer_Inputy = GUICtrlCreateInput("", 244, 42, 65, 21) $Tab_Fx_CollieCount_Inputy = GUICtrlCreateInput("", 316, 42, 57, 21, BitOR($ES_AUTOHSCROLL, $ES_NUMBER)) $Tab_Fx_CollieType_Comboy = GUICtrlCreateCombo("PLL", 380, 42, 49, 25) GUICtrlSetData($Tab_Fx_CollieType_Comboy, "CLL") $Tab_Fx_CollieWeight_Inputy = GUICtrlCreateInput("", 436, 42, 73, 21) $Tab_Fx_OrdreNr_Inputy = GUICtrlCreateInput("", 518, 42, 121, 21) Where x is 1 to 5 and y is 1 to 6 So i have 150 input/combo i would like to reset at ones, is there any way for me to do that without writing 150 lines of GuiCtrlSetData(Input, "") Hope that some one have an simple solution, course 150 lines of code is :-S Regards /Rex Link to comment Share on other sites More sharing options...
spudw2k Posted December 2, 2009 Share Posted December 2, 2009 (edited) If you assign the inputs to an Array instead, then you can loop through the Array. You'll have to figure out how to set the x,y,width,height of the controls though (could also use an array). untested: Dim $arrInputs[5][5] For $x = 0 to 4 For $y = 0 to 5 $arr[$x][$y] = GUICtrlCreateInput() Next Next Or If you'd prefer not to redesign your gui code, then use a for loop and the Execute() func. For $x = 1 to 5 For $y = 1 to 6 Execute("GUICtrlSetData($Tab_F" & $x & "_Customer_Input" & $y & ',""') Execute("GUICtrlSetData($Tab_F" & $x & "_CollieCount_Input" & $y & ',""') ;etc... Next Next Edited December 2, 2009 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Rex Posted December 3, 2009 Author Share Posted December 3, 2009 If you assign the inputs to an Array instead, then you can loop through the Array. You'll have to figure out how to set the x,y,width,height of the controls though (could also use an array). untested: Dim $arrInputs[5][5] For $x = 0 to 4 For $y = 0 to 5 $arr[$x][$y] = GUICtrlCreateInput() Next Next Or If you'd prefer not to redesign your gui code, then use a for loop and the Execute() func. For $x = 1 to 5 For $y = 1 to 6 Execute("GUICtrlSetData($Tab_F" & $x & "_Customer_Input" & $y & ',""') Execute("GUICtrlSetData($Tab_F" & $x & "_CollieCount_Input" & $y & ',""') ;etc... Next Next Hi spudw2k I did try to use this For $x = 1 to 6 For $y = 1 to 5 Execute("GUICtrlSetData($Tab_F" & $x & "_Customer_Input" & $y & ',""') Execute("GUICtrlSetData($Tab_F" & $x & "_CollieCount_Input" & $y & ',""') Execute("GUICtrlSetData($Tab_F" & $x & "_CollieType_Input" & $y & ',"PLL"') Execute("GUICtrlSetData($Tab_F" & $x & "_CollieWeight_Input" & $y & ',""') Execute("GUICtrlSetData($Tab_F" & $x & "_CollieOrdreNr_Input" & $y & ',""') Next Next But nothing happens so i tryed to wrap it in a msg Execute('MsgBox(0, "Test", "GUICtrlSetData($Tab_F" & $i & "_Customer_Input" & $i )') and that did work. Why can't i get your code to work? Regards /Rex Link to comment Share on other sites More sharing options...
Zedna Posted December 3, 2009 Share Posted December 3, 2009 (edited) It can be done also without Execute() Dim $arr[5][5] For $x = 0 to 4 For $y = 0 to 4 $arr[$x][$y] = GUICtrlCreateInput(...) Next Next ; clear all inputs For $x = 0 to 4 For $y = 0 to 4 GUICtrlSetData($arr[$x][$y],'') Next Next Edited December 3, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
spudw2k Posted December 3, 2009 Share Posted December 3, 2009 (edited) prob just syntax. try this perhaps? Execute('"GUICtrlSetData($Tab_F" & $x & "_Customer_Input" & $y)') It can be done also without Execute() Dim $arr[5][5] For $x = 0 to 4 For $y = 0 to 4 $arr[$x][$y] = GUICtrlCreateInput(...) Next Next ; clear all inputs For $x = 0 to 4 For $y = 0 to 4 GUICtrlSetData($arr[$x][$y],'') Next Next Bingo, that's how I'd prefer to do it, as I suggested in my first post. Edited December 3, 2009 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Rex Posted December 3, 2009 Author Share Posted December 3, 2009 Hi spudw2k prob just syntax. try this perhaps? Execute('"GUICtrlSetData($Tab_F" & $x & "_Customer_Input" & $y)') That did the trick, thx Funny like such a little thing can kill a big script Regards /Rex Link to comment Share on other sites More sharing options...
Rex Posted December 3, 2009 Author Share Posted December 3, 2009 @Both No redesigning my GUI, all ready redesigned it 6 times now, course i kept forgetting some info fields and so And i don't understand any of that arrayer thing any way, i always ending up here at the forum asking for help about it. Cheers /Rex Link to comment Share on other sites More sharing options...
spudw2k Posted December 3, 2009 Share Posted December 3, 2009 (edited) @BothNo redesigning my GUI, all ready redesigned it 6 times now, course i kept forgetting some info fields and so And i don't understand any of that arrayer thing any way, i always ending up here at the forum asking for help about it.Cheers/RexArrays can be very useful.http://www.autoitscript.com/wiki/ArraysAll you need to know about arrays. Cherio Edited December 3, 2009 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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