Skip to content
⌘ NSIS Forum Archive

Sum 7 zero with number 1

2 posts

r2du-soft#

Sum 7 zero with number 1

i need to sum a number with five characters of 0 with a 1 like this:


00000 + 1 = 00001
00001 + 1 = 00002
00002 + 1 = 00003
...

!include x64.nsh

ShowInstDetails show

Var num

Section

StrCpy $num "0000000"

SetDetailsPrint both
DetailPrint "$num"
SetDetailsPrint none

RE_Check:

${IF} $num < 9999999

IntOp $num $num + 1

SetDetailsPrint both
DetailPrint "$num"
SetDetailsPrint none

Goto RE_Check
${EndIF}

SectionEnd

Output IS:
0000000
1
2
3
4
5
6
7
8
9
10
11
.
.
.
9999999

but i want this Output:
0000000
0000001
0000002
0000003
0000004
0000005
0000006
0000007
0000008
0000009
0000010
0000011
.
.
0088532
.
.
9999999
Anders#
While StrLen is shorter than what you want, just do StrCpy $num "0$num".

OR

IntFmt $num "%.7u" $num