Marlo Posted May 9, 2010 Share Posted May 9, 2010 (edited) Helloooooooooo, it's been a while since I coded anything in AutoIt but today I came across a use for it. Anyway I just need to know if there's anyway I can get AutoIt to enumerate numbers from 01 to 09 instead of 1 to 9. For example: For $I = 01 To 50 ;the first 9 numbers I want prefixed with a 0 and and from there just count normally so... ;01, 02, 03, 04, 05, 06, 07, 07, 08, 09, 10, 11, ..., 49, 50 ;I want to do this because I will be working with strings. Next I know how I could work around it by manually adding the 0 for the first nine I'm hoping there's a cleaner way. Kind regards ~Marlo Edited May 9, 2010 by Marlo Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
Yoriz Posted May 9, 2010 Share Posted May 9, 2010 Local $sString For $I = 1 To 50 ;the first 9 numbers I want prefixed with a 0 and and from there just count normally so... ;01, 02, 03, 04, 05, 06, 07, 07, 08, 09, 10, 11, ..., 49, 50 ;I want to do this because I will be working with strings. $sString &= StringFormat("%02s", $I) & "," Next ConsoleWrite(StringTrimRight($sString,1) & @CR) GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
Marlo Posted May 9, 2010 Author Share Posted May 9, 2010 Avast! brilliant mate, thanks a million <3 Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
duzers Posted May 21, 2010 Share Posted May 21, 2010 hello, How I do this with GUICtrlCreateInput and GUICtrlCreateUpdown? thx Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 21, 2010 Share Posted May 21, 2010 Read the control with GuiCtrlRead() and then pass the value to StringFormat() as above. 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...
duzers Posted May 21, 2010 Share Posted May 21, 2010 Read the control with GuiCtrlRead() and then pass the value to StringFormat() as above. Yes, but I can autochange Input with fix number when I click UP/DOWN. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 21, 2010 Share Posted May 21, 2010 You would have to read the contents of the Input control attached to the UpDown, apply the formatting to it, then write back to the input. You can't set it to do that (leading zeroes) without intervention: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $input, $updown, $msg, $sData GUICreate("My GUI UpDown", -1, -1, -1, -1, $WS_SIZEBOX) $input = GUICtrlCreateInput("2", 10, 10, 100, 20) $updown = GUICtrlCreateUpdown($input) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case Else If $sData <> GUICtrlRead($input) Then $sData = GUICtrlRead($input) $sData = StringFormat("%03d", $sData) GUICtrlSetData($input, $sData) EndIf EndSwitch WEnd MsgBox(0, "Updown", GUICtrlRead($input)) 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