![]() |
#1 |
Junior Member
Join Date: Feb 2013
Posts: 43
|
Reading from a file at compile time
This may be very simple thing but I couldn't find it anywhere.
I want to read some values from a file (config.json) into some variables when I compile my nsis script. How can I possibly do that? Another question is I want to hit a url without opening any browser window, I tried 'execshell ' it did the task but opened the url in default browser window which I dont want. what other options do I have? Thanks in advance. |
![]() |
![]() |
![]() |
#2 |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
use !system or !execute to run an (NSIS) exe, which reads the file using normal runtime commands and writes to an .nsh file that contains !define Foo "string 1" !define Bar "string 2". Then just !include that .nsh file in your real .nsi.
|
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Feb 2013
Posts: 43
|
Thanks. So I must use another exe. That will work. But I wish there was some other way , I really dont want to use an extra exe.
|
![]() |
![]() |
![]() |
#4 |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
You could even compile a second nsi file into that exe during compilation, to automate everything.
|
![]() |
![]() |
![]() |
#5 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Use the nsJSON plug-in in a small script (ParseJSON.nsi) which will read the json file and output an nsh file (with !defines):
Then you can put this in your main script:code: Personally I just use an nsh file containing !defines for compile time configuration for basic installers.code: Stu |
![]() |
![]() |
![]() |
|
Tags |
compile-time, nsis, url |
Thread Tools | Search this Thread |
Display Modes | |
|
|