Archive: How to pass variables to MyFunction?


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,


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


Then in some section:

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:


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

:cry:

Defined variables are those which have only a "$" before its name:


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:


0


Section
MessageBox MB_OK${TEST}
>SectionEnd
>