Old 13th April 2016, 17:38   #1
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 342
Set 1024 space in variable

hi
how can set 1024 space in a variable?
i know space code is: " " and for set 10 space in variable i can use:

HTML Code:
Var /Global E1
strcpy $E1 "          "
now if i want set to $E1 1024 space must use 1024 $\r$\n or 1024 " " ?
in vb6 i use from this code for set 1024 space in variable:

HTML Code:
E1 = Space$(1024)
in finally i how can set 1024 space in variable in nsis?

Last edited by r2du-soft; 13th April 2016 at 18:40.
r2du-soft is offline   Reply With Quote
Old 14th April 2016, 08:26   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 891
Loops are your friend:
Quote:
StrCpy $0 "" ;holds spaces
StrCpy $1 "0" ;holds count
loop:
StrCpy $0 "$0 "
IntOp $1 $1 + 1
IntCmp $1 1024 +1 loop
;$0 has 1024 spaces

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 15th April 2016, 15:34   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,296
A loop is only useful if you don't know exactly how many characters you want, if it is constant then just a simple StrCpy probably compresses really well.

But why do you even need 1000+ space characters in a string?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 16th April 2016, 00:54   #4
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 891
I've stopped asking that question because that person never says what it's needed for. Considering all the other questions that person has asked, this one should have been pretty straight forward to solve.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 16th April 2016, 11:17   #5
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 342
Quote:
Originally Posted by Anders View Post
A loop is only useful if you don't know exactly how many characters you want, if it is constant then just a simple StrCpy probably compresses really well.

But why do you even need 1000+ space characters in a string?
i ask this question for convert a vb code to nsis:
http://forums.winamp.com/showpost.ph...25&postcount=4
HTML Code:
txt = Space$(1024)
but am trying for convert that but every time is goes Fail


Quote:
Originally Posted by JasonFriday13 View Post
I've stopped asking that question because that person never says what it's needed for. Considering all the other questions that person has asked, this one should have been pretty straight forward to solve.
i asked the normal questions but sometimes no one answer my questions!!!
i like nsis language and i just want learn nsis language and convert my applications (VB) to nsis because i like that...and my problem for learn nsis is no educational nsis book from learning in iran!
r2du-soft is offline   Reply With Quote
Old 16th April 2016, 11:30   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,296
Quote:
Originally Posted by r2du-soft View Post
i ask this question for convert a vb code to nsis
That VB code fills the buffer with spaces as some sort of hack to preallocate memory. You don't need to do that in NSIS.

I have already told you, the System plug-in readme has a GetWindowText example, go look at it before asking about this again!

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