![]() |
#1 |
Junior Member
Join Date: Feb 2015
Posts: 6
|
Return value from !system
Hi all,
LTL, FTP here. I'm trying to figure out how to get hold of the return value from a system command executed at compile-time, using the !system command. I've checked out the documentation at http://nsis.sourceforge.net/Docs/Chapter5.html#system but I'm being a bit dense about figuring out the 'symbol' bit, and there isn't a code example. The format is, as the doc says: code: What exactly is 'symbol' and how do I define it, and get the value from it? Any help appreciated! Thanks. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
|
With e.g. !system "some.exe" = 0 script will only compile if some.exe returns 0. But afaik you can't get the exit code and use it for flow control if that's what you want.
PostEnd: |
![]() |
![]() |
![]() |
#3 | |
Junior Member
Join Date: Feb 2015
Posts: 6
|
Quote:
Many thanks for your help! |
|
![]() |
![]() |
![]() |
#4 |
Senior Member
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
|
For the record, there is way: you could run a batch file that runs the exe, checks errorlevel and outputs the result in a text file; then you get it with !searchparse.
PostEnd: |
![]() |
![]() |
![]() |
#5 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
It essentially does a !define symbol [return_value], thus ${symbol} can then be used in your script at compile time.code: Only works with NSIS 3.0+. Stu |
![]() |
![]() |
![]() |
#6 |
Junior Member
Join Date: Feb 2015
Posts: 6
|
|
![]() |
![]() |
![]() |
#7 |
Senior Member
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
|
I didn't know there were changes to !system. Nice.
PostEnd: |
![]() |
![]() |
![]() |
#8 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
This and !makensis was added mostly to help people sign the uninstaller, it allows you to do some %temp% cleanup before aborting with a error message...
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
|
Tags |
!system, compile-time, nsis |
Thread Tools | Search this Thread |
Display Modes | |
|
|