johnmcloud Posted November 13, 2012 Posted November 13, 2012 (edited) Hi all, A fast question, i need to make a For...Next, like this: For $x = 1 To 6 MsgBox(0,0, $x) Next But i want to make a version with zero like this: 01 02 03 ... 09 10 11 and one like this: 001 002 003 ... 009 010 011 ... 099 100 I have try to make the 0 before the variable but i have 010 011 in the first version and 0010 0011 in the second. Some suggestion? Thanks Edited November 13, 2012 by johnmcloud
PhoenixXL Posted November 13, 2012 Posted November 13, 2012 try usingStringFormat My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
PhoenixXL Posted November 13, 2012 Posted November 13, 2012 Somewhat like this$NoOfZeroes = 2 For $x = 1 To 6 MsgBox(64, @ScriptName & ' | Phoenix XL', StringFormat('%0' & $NoOfZeroes & 'i', $x)) Next My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
caleb41610 Posted November 13, 2012 Posted November 13, 2012 Create an array with the desired strings, then loop through with $array[$i] as the data in the message box. Multi-Connection TCP Server
johnmcloud Posted November 13, 2012 Author Posted November 13, 2012 Yes, thanks I have a side-question for this, i want to apply that to a function for enable-disable checkbox Local $Checkbox_ $Checkbox_01 = GUICtrlCreateCheckbox("", 300, 101, 65, 17) $Checkbox_02 = GUICtrlCreateCheckbox("", 310, 101, 65, 17) $Checkbox_03 = GUICtrlCreateCheckbox("", 320, 101, 65, 17) $Checkbox_04 = GUICtrlCreateCheckbox("", 330, 101, 65, 17) $Checkbox_05 = GUICtrlCreateCheckbox("", 340, 101, 65, 17) $Checkbox_06 = GUICtrlCreateCheckbox("", 350, 101, 65, 17) $NoOfZeroes = 2 For $x = 1 To 6 GUICtrlSetState($Checkbox_ & StringFormat('%0' & $NoOfZeroes & 'i', $x)) Next But not work, tips? Thanks
PhoenixXL Posted November 13, 2012 Posted November 13, 2012 you are getting confused try looking at the Eval function My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
PhoenixXL Posted November 13, 2012 Posted November 13, 2012 Somewhat like this#include <GuiConstants.au3> GUICreate('') $Checkbox_1 = GUICtrlCreateCheckbox("", 300-40, 101, 65, 17) $Checkbox_2 = GUICtrlCreateCheckbox("", 310-35, 121, 65, 17) $Checkbox_3 = GUICtrlCreateCheckbox("", 320-30, 141, 65, 17) $Checkbox_4 = GUICtrlCreateCheckbox("", 330-25, 161, 65, 17) $Checkbox_5 = GUICtrlCreateCheckbox("", 340-20, 181, 65, 17) $Checkbox_6 = GUICtrlCreateCheckbox("", 350-15, 201, 65, 17) $NoOfZeroes = 2 For $x = 1 To 6 GUICtrlSetState(Eval('Checkbox_' & $x), $GUI_CHECKED) Next GUISetState() While GUIGetMsg()<>-3 Sleep(10) WEnd My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
johnmcloud Posted November 13, 2012 Author Posted November 13, 2012 (edited) I dind't know the Eval function, but like this: $NoOfZeroes = 2 For $x = 1 To 6 GUICtrlSetState(Eval("$Checkbox_" & StringFormat('%0' & $NoOfZeroes & 'i', $x)), $GUI_CHECKED) Next Seems not work EDIT: My mistake, work I have put the $ Wrong: Eval("$Checkbox_" Correct: Eval("Checkbox_" Edited November 13, 2012 by johnmcloud
johnmcloud Posted November 13, 2012 Author Posted November 13, 2012 My really last question about For...Next In a scenario like: IniWrite("Test, "MyKey", "17", "7") IniWrite("Test, "MyKey", "18", "8") IniWrite("Test, "MyKey", "19", "9") IniWrite("Test, "MyKey", "20", "10") IniWrite("Test, "MyKey", "21", "11") IniWrite("Test, "MyKey", "22", "12") How i can concatenate the two For...Next? Thanks for your time PhoenixXL
PhoenixXL Posted November 13, 2012 Posted November 13, 2012 (edited) If there is a sequence of the Numbers use it inside the Looporelse make an Array and execute the Functions using the IndexExample#include <GuiConstants.au3> GUICreate('') $Checkbox_1 = GUICtrlCreateCheckbox("", 300 - 40, 101, 65, 17) $Checkbox_2 = GUICtrlCreateCheckbox("", 310 - 35, 121, 65, 17) $Checkbox_3 = GUICtrlCreateCheckbox("", 320 - 30, 141, 65, 17) $Checkbox_4 = GUICtrlCreateCheckbox("", 330 - 25, 161, 65, 17) $Checkbox_5 = GUICtrlCreateCheckbox("", 340 - 20, 181, 65, 17) $Checkbox_6 = GUICtrlCreateCheckbox("", 350 - 15, 201, 65, 17) Local $nArray[6][2] = [ ["17","7"], _ ["18","8"], _ ["19","9"], _ ["20","10"], _ ["21","11"], _ ["22","12"] _ ] $NoOfZeroes = 2 For $x = 1 To 6 GUICtrlSetState(Eval("$Checkbox_" & StringFormat('%0' & $NoOfZeroes & 'i', $x)), $GUI_CHECKED) IniWrite("Test.ini", "MyKey",$nArray[$x-1][0],$nArray[$x-1][1]) Next GUISetState() While GUIGetMsg() <> -3 Sleep(10) WEndUse Tidy[CTRL + T] to make the Syntax look Clean Edited November 13, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
johnmcloud Posted November 13, 2012 Author Posted November 13, 2012 (edited) Are two sequence of number, so i think i can avoid to write every number in the array EDIT: This time i have resolved by myself Static $iCount = 10 For $x = 1 To 6 $iCount += 1 ConsoleWrite($x & " " & $iCount & @CRLF) Next Thanks again Edited November 13, 2012 by johnmcloud
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