Old 13th October 2005, 20:33   #1
jcao
Junior Member
 
Join Date: Oct 2005
Posts: 9
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
jcao is offline   Reply With Quote
Old 13th October 2005, 21:40   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
!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
Afrow UK is offline   Reply With Quote
Old 14th October 2005, 12:28   #3
jcao
Junior Member
 
Join Date: Oct 2005
Posts: 9
-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
jcao is offline   Reply With Quote
Old 14th October 2005, 12:54   #4
iceman_k
NSIS Dev
 
iceman_k's Avatar
 
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
code:

!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.

Cheers,
Iceman_K

EclipseNSIS - An NSIS IDE for the Eclipse Platform | My contributions to the wiki
iceman_k is offline   Reply With Quote
Old 14th October 2005, 13:29   #5
jcao
Junior Member
 
Join Date: Oct 2005
Posts: 9
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

Last edited by jcao; 14th October 2005 at 13:57.
jcao is offline   Reply With Quote
Old 14th October 2005, 14:36   #6
iceman_k
NSIS Dev
 
iceman_k's Avatar
 
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
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.

Cheers,
Iceman_K

EclipseNSIS - An NSIS IDE for the Eclipse Platform | My contributions to the wiki
iceman_k is offline   Reply With Quote
Old 14th October 2005, 15:33   #7
jcao
Junior Member
 
Join Date: Oct 2005
Posts: 9
exec and execwait didn't work for me either same problem as !system.
jcao is offline   Reply With Quote
Old 14th October 2005, 16:07   #8
iceman_k
NSIS Dev
 
iceman_k's Avatar
 
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
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.
Attached Files
File Type: nsi dummy.nsi (166 Bytes, 154 views)

Cheers,
Iceman_K

EclipseNSIS - An NSIS IDE for the Eclipse Platform | My contributions to the wiki

Last edited by iceman_k; 14th October 2005 at 16:29.
iceman_k is offline   Reply With Quote
Old 14th October 2005, 16:39   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Do you want to compile this script at compile time or at run time!??

-Stu
Afrow UK is offline   Reply With Quote
Old 14th October 2005, 17:57   #10
jcao
Junior Member
 
Join Date: Oct 2005
Posts: 9
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.
jcao is offline   Reply With Quote
Old 14th October 2005, 18:04   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 14th October 2005, 18:12   #12
jcao
Junior Member
 
Join Date: Oct 2005
Posts: 9
Nice! Afrow that worked finally!
No more need for a function to find the $parentDir.

thank you

-JC
jcao is offline   Reply With Quote
Old 14th October 2005, 18:20   #13
iceman_k
NSIS Dev
 
iceman_k's Avatar
 
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
You still seem to be confused about runtime vs compiletime.

Cheers,
Iceman_K

EclipseNSIS - An NSIS IDE for the Eclipse Platform | My contributions to the wiki
iceman_k 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