Archive: Variable in a string


Variable in a string
  Hello !


I search how to put a variable in a string please.

I explain, I have this:

Var EtudeName
ReadINIStr $R1 $DESKTOP\Data.ini "Data" "EtudeName"
StrCpy $EtudeName $R1
;----Here I have $EtudeName == Tomcat 6.0----
File "C:\Program Files\Admin builder\$EtudeName.zip"

But it don't work !
The command File said that it doesn't find the file "C:\Program Files\Admin builder\$EtudeName.zip"
It is normal because I want to have "C:\Program Files\Admin builder\Tomcat 6.0.zip"

I tried with '$EtudeName' or with "$EtudeName", ... I tried everything but...

Please help... =(


You're confusing compile time and run time. The compiler needs to know the file path at compile time to compress the file therefore you can't give it a run time variable. Instead you want to use LogicLib and selectively call the correct File instruction depending on the value of $EtudeName.

Stu


(sorry for my english I'm French,I posted this question on Todae but no response... =( )

Oooooooooh thanks for your answer !!! =)

So I have to use the LogicLib ?

I don't really understand all I'm sorry...

I have to do what with the LogicLib ? How can I do that I want to do ?

I don't want the code but just can you explain me a little bit more please ?

I'm in Internship in an entreprise (In French "stage en entreprise"^^) and I have my deadline the 19th August... :/

The C language miss me... snif


As he said, the File command is evaluated at compile time (that means when the installer is being compiled). I think you want to read the INI at the *user's* computer, so you cannot do different File commands for different INI values (obviously).

ReadINIStr $EtudeName $DESKTOPData.ini "Data" "EtudeName"

>${If} $EtudeName == "Tomcat 6.0"
File "C:\Program Files\Admin builder\Tomcat 6.0.zip"
>${ElseIf} $EtudeName == "Tomcat 5.0"
File "C:\Program Files\Admin builder\Tomcat 5.0.zip"
>${ElseIf} $EtudeName == "Tomcat 5.1"
File "C:\Program Files\Admin builder\Tomcat 5.1.zip"
>(etc, etc)
{$EndIf}
Note: Because you want to install a different file for every value in that ini, your installer will probably end up being rather big.

(If you want to read the INI on the *compiler's* computer, then you cannot use ReadINIStr because you have to use compile-time commands. There is no standard compiletime command to read INI strings. You can use a vbscript, or an exe file you created yourself, or whatever.)

Ah OK !

I will try something, Thanks for help !

If the thing I want to do don't works I will be back here =)

Thanks !


Now it's okay ! I don't really use your "method" but now it's work !

it's really hard to tell you how I did it in English but in any case it works great !

Thanks for your help !


And just a little last thing.

I have a full path:

"C:\Documents and Settings\arelliaud\Bureau\Installeur\Install\Java\JRE.exe"

And, in my script I want to utilise "File"

So can I do File /r "C:\Documents and Settings\arelliaud\Bureau\Installeur\Install\Java\JRE.exe" ?

I don't think so... It do really strange things in compil time !

And I have no choice, I have to put the full path like this =(


Nooooo It's okay !

Thanks for all ! =)


Hellow !

I've already a new last question pleaaaase =(

If my boolean is at 1 I have to compil with "File "${FILEJAVA}""

But if my boolean is at 0 I don't want to compil with "File "${FILEJAVA}"" because if my boolean is at 0, ${FILEJAVA} doesn't exist ! So: error.

How can I do please ? =(


ReadINIStr     $Bool_Java         $PLUGINSDIRSelectElements.ini     "Field 9"  "State"

;With a manipulation I put the value of $Bool_Java in the !define BOOL_JAVA
;There's no problem with this ;)

!define BOOL_JAVA 0

Section "Java" Java_JRE

!if ${BOOL_JAVA} == 1
Goto begin
!else
Goto end
!endif

begin:
SetOutPath $TEMP
File "${FILEJAVA}"

; Installation JRE
nsExec::ExecToStack '$TEMP${JAVA}

end:
SectionEnd
>

Again you're confusing compile time and run time. Everything beginning with a ! are compile time instructions. Read the docs. Just wrap the entire section in an !if/!endif.

Stu


Ow yeeeeeeeeeees ! It's working ! =)

Thank you !

I read the doc but I've found a lot of things but not this... :(

Thx a lot !