Merchants Posted March 29, 2010 Posted March 29, 2010 (edited) i want this: 01 + 1 = 02 NOT 2#include <GUIConstantsEx.au3> Global $GUI[4] $GUI[0]= GUICreate("test", 300, 70) $GUI[1] = GuiCtrlCreateInput("01", 75, 22, 150, 20) $GUI[2] = GUICtrlCreateButton("+ 1", 230, 21, 50, 22) GUICtrlCreateLabel("Index 1:", 20, 25) GUISetState() While 1 $GUI[3] = GUIGetMsg($GUI[0]) Select Case $GUI[3] = $GUI_EVENT_CLOSE Exit Case $GUI[3] = $GUI[2] GUICtrlSetData($GUI[1], GUICtrlRead($GUI[1]) + 1) EndSelect WEnd Edited March 29, 2010 by Merchants
PsaltyDS Posted March 29, 2010 Posted March 29, 2010 StringFormat(). See help file. 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
Merchants Posted March 30, 2010 Author Posted March 30, 2010 StringFormat(). See help file.wel i have tryed search a stringformat but i can't find it can you help?
99ojo Posted March 30, 2010 Posted March 30, 2010 Hi, it's still in helpfile -> Index -> Stringformat. GUICtrlSetData($GUI[1], StringFormat ("0%d", GUICtrlRead($GUI[1]) + 1)) ;-)) Stefan
Malkey Posted March 30, 2010 Posted March 30, 2010 Using StringFormat() :- GUICtrlSetData($GUI[1], StringFormat ("%02d", GUICtrlRead($GUI[1]) + 1)) or using StringRight() - 99 maximum number :- GUICtrlSetData($GUI[1], StringRight("0" & (GUICtrlRead($GUI[1]) + 1),2)) wel i have tryed search a stringformat but i can't find it can you help? Well, you tried and failed to find the stringformat function in the AutoIt help file. That is unbelievably amazing.
99ojo Posted March 30, 2010 Posted March 30, 2010 (edited) Hi,if you want the leading 0 only for numbers < 10:@edit: Delete nasty code, use Malkeys....;-))Stefan Edited March 30, 2010 by 99ojo
Malkey Posted March 30, 2010 Posted March 30, 2010 99ojo Here is a StringFormat example for you to ponder. ConsoleWrite(StringFormat("2%03d-%02d-%02d\n", 10, 3, 30)) ; Displays 2010-03-30 Malkey
99ojo Posted March 30, 2010 Posted March 30, 2010 (edited) Here is a StringFormat example for you to ponder.I did now. There was a paste and copy typo error trying your 1st code example, which is absolutly correct. Stefan Edited March 30, 2010 by 99ojo
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