Numbers with 4 digitals - Forum

Forum Navigation
You need to log in to create posts and topics.

Numbers with 4 digitals

Hello

I have a small problem. I need to make a loop that will start from 1 to 9999. And I need to get everytime not 1,2,3,4,5, .....197,198,199, ......1456,1457 but the numbers 4 digital 0001,0002,0003,0004,0005, .....0197,0198,0199, ......1456,1457.

Do you know any way to do that?

Best regards

Loop 1 9999 [cont]

Setvar "000[cont]" [newcont]

StrLen "[newcont]" [Size]

Math "[Size] - 1" 0 [Size]

StrCopy [newcont] [Size] -4 [newcont]

Consolelog "[newcont]"

Endloop

I haven't tried it because I'm not on the PC but it should work

Oops, I didn't read that it was vn win. Sorry.

Find the equivalent commands in visual neo win and replace. For example substr instead of strcopy and it should work

Hi, @sakismor, I think this is that you need:

Create:
Text object ==> and in Text Propierties write ==> [NUMBER]

PushButton ==> and in Button Properties > Actions > Left Click ==> paste this:

.=================================================

Loop "1" "9999" "[ACTUAL-NUMBER]"
StrLen "[ACTUAL-NUMBER]" "[LONG-ACTUAL-NUMBER]"
If "[LONG-ACTUAL-NUMBER]" "<" "4"
Math "4-[LONG-ACTUAL-NUMBER]" "0" "[NUMBER-ZEROS]"
SetVar "[NUMBER]" "[ACTUAL-NUMBER]"
Loop "1" "[NUMBER-ZEROS]" "[ADD-ZERO]"
SetVar "[NUMBER]" "!0[NUMBER]"
EndLoop
Else
SetVar "[NUMBER]" "[ACTUAL-NUMBER]"
EndIf
.*******************

.HERE YOUR CODE (I have added a Delay to watch slow how is Number increasing)
Delay "200"
.*******************
EndLoop

.=================================================

Also I upload PUB and Capture

Uploaded files:
  • You need to login to have access to uploads.