Hidden Posted November 17, 2015 Posted November 17, 2015 Hey guys, I tried to sort this out myself but I'm having some issues (probably since I've never used this kind of thing before.What I'm trying to accomplish:Send the number 0001 to start with, and then simply keep adding one and continue sending, all the way to 9999. What I tried:$Number = 0001 While 1 = 1 Send($Number) $Number = $Number + 1 ;(I tried 0001 here as well) Sleep(1000) Send("{ENTER}") WEnd The result is that it keeps sending them like so:12345... Is there a way to make it take the 0's into account as well? So it comes out as:000100020003... Thank you in advance.
czardas Posted November 17, 2015 Posted November 17, 2015 Here ya go! For $i = 1 To 9999 $sNumStr = StringFormat("%04i", $i) ConsoleWrite($sNumStr & @CRLF) Next algiuxas 1 operator64 ArrayWorkshop
Hidden Posted November 17, 2015 Author Posted November 17, 2015 You are a champion, thank you for that, it works like a charm.For my brain to be at peace, can you please explain to me how "%04i" defines the format? Or is it simply a pre-set thing?
czardas Posted November 17, 2015 Posted November 17, 2015 It's a preset thing, but changing 4 to 5 will give you a clue. Look at StringFormat in the help file. Happy to help. operator64 ArrayWorkshop
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