Old 20th April 2004, 23:58   #1
keitsi
Junior Member
 
Join Date: Apr 2004
Location: Finland
Posts: 4
How to pass variables to MyFunction?

After hour of messing around with variables / searching forums / reading manual I found no way to pass a variable to custom function.. Is that true?? (guess not, I'm just being blind)

Like,
code:

Function DoYourThings
DoSomeStuffTo ${variable}
DoSomeOtherStuffTo ${variable}
FunctionEnd



Then in some section:
code:

Call DoYourThings "c:\temp\blahzor.txt"



And the DoYourThings-function receives "c:\temp\blahzor.txt" and some variable that can be accessed. Simple :P
Of course that does not work, Call won't accept parameters.

Also, I was not able to declare a changable variable as public, to do the same thing a harder way, like this:

code:

var SOMEVAR

Function DoYourThings
DoSomeStuffTo ${SOMEVAR}
DoSomeOtherStuffTo ${SOMEVAR}
FunctionEnd

Section "SomeSection"
StrCpy "$SOMEVAR" "c:\temp\blahzor.txt"
Call DoYourThings
SectionEnd



This does not work either, DoYourThings-function can't access SOMEVAR

keitsi is offline   Reply With Quote
Old 21st April 2004, 02:11   #2
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Defined variables are those which have only a "$" before its name:

PHP Code:
Var Test

Section
MessageBox MB_OK $TEST
SectionEnd 
Defines with a variable name value are like normal constant defines, but everytime when the variable set as the define's value, the define's value changes, so it's dependant of another variable's value:

PHP Code:
!define TEST $0

Section
MessageBox MB_OK 
${TEST}
SectionEnd 

My Wiki Pages

Working now on:
New projects. (language: any)
deguix 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