Old 22nd May 2019, 23:50   #1
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 334
Question 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
...

HTML Code:
!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:
HTML Code:
0000000
1
2
3
4
5
6
7
8
9
10
11
.
.
.
9999999

but i want this Output:
HTML Code:
0000000
0000001
0000002
0000003
0000004
0000005
0000006
0000007
0000008
0000009
0000010
0000011
.
.
0088532
.
.
9999999
r2du-soft is offline   Reply With Quote
Old 23rd May 2019, 01:44   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,100
While StrLen is shorter than what you want, just do StrCpy $num "0$num".

OR

IntFmt $num "%.7u" $num

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump