- NSIS Discussion
- VARIABLE PROBLEM plz HELP
Archive: VARIABLE PROBLEM plz HELP
jcao
13th October 2005 21:33 UTC
VARIABLE PROBLEM plz HELP
Can anyone tell me how to allow variables within !system?
currently the following line of script doesn't work:
-------------------------------------------------------
!system '""${NSISDIR}\makensis.exe" "$parentDir\NSIS Install Scripts\CreateUIServerEXE.nsi""'
-------------------------------------------------------
The error output is the following:
-------------------------------------------------------
Can't open script "$parentDir\NSIS Install Scripts\CreateUIServerEXE.nsi"
!system: returned 1
-------------------------------------------------------
I have checked using Message boxes that the variable "parentDir" actually contains "C:/installer" however when inserted as an argument for !system, only the variable name appears! But, this is not true for the variable NSISDIR!
If I change the line to NOT include variables then I get NO complaints from the compiler, however I need a variable path and NOT a static path.
can anyone help?
-JC
Afrow UK
13th October 2005 22:40 UTC
!system is a compile-time instruction. Variables like $parentDir is for run-time. Hopefully you can now see the problem without me having to explain it.
-Stu
jcao
14th October 2005 13:28 UTC
-Gotcha, thanks!
So, what would be the solution to my problem? I would like to use the windows command.exe to execute the makefile.exe and compile a certain script on a directory that varies.
*Is there another way to compile the external *.nsi script within the current *.nsi script?
-JC
iceman_k
14th October 2005 13:54 UTC
!system '""${NSISDIR}\makensis.exe" "${parentDir}\NSIS Install Scripts\CreateUIServerEXE.nsi""'
Then when you invoke makensis, provide /DparentDir=c:\foo\bar as a command line argument.
jcao
14th October 2005 14:29 UTC
That doesn't work because /DparentDir=$VARIABLE is not possible. What happens is that the name of the $VARIABLE [not the contents] will be displayed when executing the !system command :S
The following code should demonstrate what I'm trying to do. However it doesn't work, !system will not make use of runtime variables and compiler time variables will NOT be set to runtime variables...
;----------------- CREATE UISERVER.EXE
push $EXEDIR
call GetParentDir
pop $R0 ;parent directory now stored in $R0
var /global parentDir
strcpy $parentDir $R0
!system '""${NSISDIR}\makensis.exe" "$parentDir\NSIS_Install_Scripts\CreateUIServerEXE.nsi""'
;----------------- END CREATION OF UISERVER.EXE
iceman_k
14th October 2005 15:36 UTC
You are mixing runtime and compiletime commands.
$VARIABLE is only available at runtime.
!system is only available at compiletime.
If you really need $VARIABLE, use Exec, ExecWait or the nsExec plugin instead of !system.
jcao
14th October 2005 16:33 UTC
exec and execwait didn't work for me either same problem as !system.
iceman_k
14th October 2005 17:07 UTC
Works for me. See attached example of Exec working with $parentDir.
p.s. You may have too many quotes in your command line. Try simplifying it.
Afrow UK
14th October 2005 17:39 UTC
Do you want to compile this script at compile time or at run time!??
-Stu
jcao
14th October 2005 18:57 UTC
It doesn't matter wether I compile the script at compile time or run time. I just want to create the UIServer.exe before I package it into an installer becaue currently the launcher is a *.bat file and I need it to be a *.exe file.
Afrow UK
14th October 2005 19:04 UTC
Are you sure it doesn't matter? Run time is when the user runs your installer! I don't think the average user will have makensis (NSIS) installed on his computer!
If you want it done on your system then you want it done on compile time with !system. If $parentDir is just the parent directory of the NSIS script location, then just use .. instead of $parentDir.
-Stu
jcao
14th October 2005 19:12 UTC
Nice! Afrow that worked finally!
No more need for a function to find the $parentDir.
thank you
-JC
iceman_k
14th October 2005 19:20 UTC
You still seem to be confused about runtime vs compiletime.