MyDisplayName Posted July 20, 2007 Share Posted July 20, 2007 I have basically a GUI form that I created that has about 50 input boxes, and 20 combos. There is a listbox on the form that determines control values - basically pulling from an excel file serving as a database with a list of People in the listbox. I want to basically: for each input on thisform .save value to database based on controlname next control I'm sure I can manage the actual functionality but is there a way to perform this loop and come out with the results I want? Link to comment Share on other sites More sharing options...
DW1 Posted July 20, 2007 Share Posted July 20, 2007 sure, post your code AutoIt3 Online Help Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 20, 2007 Share Posted July 20, 2007 I have basically a GUI form that I created that has about 50 input boxes, and 20 combos. There is a listbox on the form that determines control values - basically pulling from an excel file serving as a database with a list of People in the listbox. I want to basically: for each input on thisform .save value to database based on controlname next control I'm sure I can manage the actual functionality but is there a way to perform this loop and come out with the results I want? Put the control IDs in arrays when you create them, making it easy to For/Next loop through them: For $n = 0 To UBound($avInputs) - 1 _ExcelWriteCell($oExcel, GUICtrlRead($avInputs[$n]), "B" & 5 + $n) ; write to B5 thru B5+n Next 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 Link to comment Share on other sites More sharing options...
MyDisplayName Posted July 20, 2007 Author Share Posted July 20, 2007 Put the control IDs in arrays when you create them, making it easy to For/Next loop through themSounds good, makes great sense. However I've had a disgust for arrays since I started coding (I think I'm scared of them).What would be the best way to put them into arrays? (totally clueless here but if you can just point me to where at in the help I can figure it out) Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 21, 2007 Share Posted July 21, 2007 (edited) Sounds good, makes great sense. However I've had a disgust for arrays since I started coding (I think I'm scared of them). What would be the best way to put them into arrays? (totally clueless here but if you can just point me to where at in the help I can figure it out) Read the help file on "Variables", and the keywords "Dim/Global/Local". Try out the demos in the help file for MouseGetPos() and WinList(). Arrays are indispensable for many kinds of scripting, even outside of AutoIt. Might as well learn them now. Many AutoIt functions like MouseGetPos() return an array by default, others like StringSplit() only return arrays. So you can't even use all the standard built-in functions without using arrays. Combining arrays with For/Next loops is very powerful, and simplifies otherwise complicated tasks -- like checking the state on a bunch of GUI controls. A one dimension (1D) array is just a numbered list, numbered from zero. Sometimes you declare an array as being a certain length, and people often forget it is numbered from zero. So if you declare an array with 3 elements, they are numbered from 0 to 2: expandcollapse popup#include <array.au3> Dim $avDogs[3] = ["Lassie", "Astro", "Snoopy"] _ArrayDisplay($avDogs, "1D Array")oÝ÷ Øp¡Ø¦z{"¢v¥Ø6«¬¢²;¬¶X¤y«ZnW¨®Êky§l箢[¦«¢+Ø¥¹±Õ±ÐíÉÉä¹ÔÌÐì)¥´ÀÌØíÙ½ÍlÍulÉtômlÅÕ½Ðí1ÍÍ¥ÅÕ½Ðì°ÅÕ½Ðí1ÍÍ¥° ½µ!½µÅÕ½Ðít°lÅÕ½ÐíÍÑɼÅÕ½Ðì°ÅÕ½ÐíQ¡)Ñͽ¹ÌÅÕ½Ðít°lÅÕ½ÐíM¹½½ÁäÅÕ½Ðì°ÅÕ½ÐíA¹ÕÑÌÅÕ½Ðíut)}ÉÉå¥ÍÁ±ä ÀÌØíٽ̰ÅÕ½ÐìÉÉÉäÅÕ½Ðì¤oÝ÷ ØÚ-zØ^ëa¡×è®)â¶&¥8§Þ®(}Öj)ÞiÈlzÚn¶ëljYbÈy©èº×«n¶ëN~קʢ}ý¶IèÂÝ¢}ý·§¶Ú-)äiº.¶0n(-櫬§yçl¶Þ§Êæz+E¢»ajÛaz·¢° ëk t¢{Þب»Z²²Ø^~*ìµé^éív§jºÚËH¬±ëm¢Ø^¶Z{¦mêè~ënWéÛ)¶¬rïz{b¢y²±é_jwn±ë§ë,¶«z+r©zYb ÞjÊ'm¡8b²+u騡öPajØZ±«Ú®&éî·«¡÷!yÉ£¬"Û¬zËaz×xª¹ëÇ.²Çiº/y©Ýrw¬¶®¶²Â+a±ëÞ©E¢¿Í{e¢m¢¶°¢¹¢wºÚ"µÍÚ[ÛYH ÙÝZXÛÛÝ[Ë]LÉÝÂÚ[ÛYH Ø^K]LÉÝÂÜ ][ÝÑÝZSÛ][[ÙI][ÝËJBÛØ[ ÌÍØ]ÚÐÞÌWHHÌBÈÚÈÜÛÝ[Ú[HBIÌÍÐÛÝ[H[]Þ ][ÝÐ^HÙÕRHÛÛÛÈ[[É][ÝË ][ÝÓ[XÙÛÛÛÈ KL N ][ÝÊBRYÜ[BQ^]Q[ÙBBIÌÍÐÛÝ[H[X ÌÍÐÛÝ[ BBRY ÌÍÐÛÝ[ ÝÈ[ ÌÍÐÛÝ[ ÈH[^]ÛÜQ[YÑ[ÈÜX]HÝZBÌÍÚÕRHHÕRPÜX]J ][ÝÐ^HÙÕRHÛÛÛÈ[[É][ÝËÍ BÕRTÙ]Û][ ÌÍÑÕRWÑUSÐÓÔÑK ][Ý×Ô]Z] ][ÝÊBÕRPÝÜX]SX[ ][ÝÔÙ[XÝÚXÚØÞÈ[ÛXÚÈÒË][ÝËLLÌÌ BÕRPÝÙ]Û LKM BÈYÚXÚØÞÂÜ ÌÍØÈHHÈ ÌÍÐÛÝ[NÈØ[Ý[]HÞHÛÛÜÂRY ÌÍØÈ ÏHL[BIÌÍÞHLBIÌÍÞHH È ÌÍØÈ Ì BQ[ÙBBIÌÍÞHNBIÌÍÞHH È ÌÍØÈHL H Ì BQ[YBNÈXÙHHÛÛÛWÐ^PY ÌÍØ]ÚÐÞÕRPÝÜX]PÚXÚØÞ ][ÝÐÚXÚØÞË][ÝÈ [È ÌÍØË ÌÍÞ ÌÍÞKML JB^ÌÍØ]ÚÐÞÌHHPÝ[ ÌÍØ]ÚÐÞ HHBÈXYÈÜ^HÙÛÛÛQÂÐ^QÜ^J ÌÍØ]ÚÐÞ ][ÝÐÛÛÛQÉ][ÝÊBÈY]ÛÂÌÍÓÒ×Ø]ÛHÕRPÝÜX]P]Û ][ÝÓÒÉ][ÝËLÍLÌ BÕRPÝÙ]Û][ LK ][Ý×Ð]Û] ][ÝÊBÌÍÐÛXØ]ÛHÕRPÝÜX]P]Û ][ÝÐÛX[ ][ÝËLÍLÌ BÕRPÝÙ]Û][ LK ][Ý×Ð]Û] ][ÝÊBÕRPÝÜX]P]Û ][ÝÑVU ][ÝËÌÍLÌ BÕRPÝÙ]Û][ LK ][Ý×Ô]Z] ][ÝÊBÕRTÙ]Ý]J BÚ[HBTÛY BÑ[[ÈÐ]Û] BSØØ[ ÌÍÜÓÙÈH ][ÝÉ][ÝË ÌÍÛTÝÚ]ÚÕRWÐÝYBPØÙH ÌÍÓÒ×Ø]ÛBBPÛÛÛÛUÜ]J ][ÝÑXYÎ ÌÍÓÒ×Ð]Û] ][ÝÈ [ÈBBBQÜ ÌÍÛHHÈ ÌÍØ]ÚÐÞÌBBBBRYÛÛÛÛÛ[X[ ][ÝÐ^HÙÕRHÛÛÛÈ[[É][ÝË ][ÝÉ][ÝË ÌÍØ]ÚÐÞÉÌÍÛK ][ÝÒÐÚXÚÙY ][ÝÊH[ ÌÍÜÓÙÈ [ÏH ÌÍÛ [È ][ÝË ][ÝÂBBS^BBRY ÌÍÜÓÙÈH ][ÝÉ][ÝÈ[BBBIÌÍÜÓÙÈH ][ÝÓÛHÙ[XÝY][ÝÂBBQ[ÙBBBBIÌÍÜÓÙÈH ][ÝÔÙ[XÝY ][ÝÈ [ÈÝ[Õ[TYÚ ÌÍÜÓÙËBBBQ[YBBSÙÐÞ ][ÝÔÝ[É][ÝË ÌÍÜÓÙÊBBPØÙH ÌÍÐÛXØ]ÛBBPÛÛÛÛUÜ]J ][ÝÑXYÎ ÌÍÐÛXÐ]Û] ][ÝÈ [ÈBBBQÜ ÌÍÛHHÈ ÌÍØ]ÚÐÞÌBBBBPÛÛÛÛÛ[X[ ][ÝÐ^HÙÕRHÛÛÛÈ[[É][ÝË ][ÝÉ][ÝË ÌÍØ]ÚÐÞÉÌÍÛK ][ÝÕ[ÚXÚÉ][ÝÊBBBS^BPØÙH[ÙBBBSÙÐÞ M ][ÝÑÜ][ÝË ][ÝÕ[[YØÙNÕRWÐÝQH ][ÝÈ [ÈÕRWÐÝY BQ[ÝÚ]Ú[[ÈÏOIÝ×Ð]Û][ÈÔ]Z] BQ^][[ÈÏOIÝ×Ô]Z] Hope that helps. Edit: ARRRRRGH!!!! I hate the way the forum editor scrambles code boxes! That is really, really annoying! Edited July 21, 2007 by PsaltyDS 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 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