WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > How to get what files to install on compile time?
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
Chilli24
Member

Registered: Jan 2005
From: Seattle, WA

Exclamation How to get what files to install on compile time?

Hi...I stopped using NSIS about an year ago. I know that then it was not possible to define in an .ini file which files the NSIS executable should contain.
So, my question is this: Is it possible to tell the NSIS compiler to get the files from an .ini file.
I want to have a generic setup script to install some patches for my application. And because different patches may contain different files, I do not want to be forced to reedit the script when those files change. I want just to edit an .ini file and the NSIS compiler should look at that file and get from there the files.
Thank you.

__________________
Program complexity grows until it exceeds the capability of the programmer who must maintain it.

Quick Link | Report this post to a moderator | IP: Logged

Chilli24 is offline Old Post 04-11-2006 09:11 AM
Click Here to See the Profile for Chilli24 Click here to Send Chilli24 a Private Message Find more posts by Chilli24 Add Chilli24 to your buddy list Edit/Delete Message Reply w/Quote
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

http://nsis.sourceforge.net/Invokin...on_compile-time

Create another NSIS installer which is executed at compile time to use ReadINIStr and write a list of NSIS File instructions in a seperate .nsi file which is later !include-d by the main .nsi script.

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 04-11-2006 09:33 AM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
Chilli24
Member

Registered: Jan 2005
From: Seattle, WA

Thank you. I will try that.

__________________
Program complexity grows until it exceeds the capability of the programmer who must maintain it.

Quick Link | Report this post to a moderator | IP: Logged

Chilli24 is offline Old Post 04-11-2006 09:43 AM
Click Here to See the Profile for Chilli24 Click here to Send Chilli24 a Private Message Find more posts by Chilli24 Add Chilli24 to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

If you're going to use Afrow's RecFind you'll make your life easy. :-)

1. Create the header

code:
!define PatchDir 'D:\Patch1' !define Header 'Patch1_Files.nsh' OutFile 'CreateHeader.exe' !include RecFind.nsh Section SetOutPath '$EXEDIR' FileOpen $R2 ${Header} w ${RecFindOpen} "${PatchDir}" $R0 $R1 ${RecFindFirst} FileWrite $R2 'File "${PatchDir}$R0\$R1"$\r$\n' ${RecFindNext} ${RecFindClose} FileClose $R2 SectionEnd

2. Create your Installation
code:
!define Header 'Patch1_Files.nsh' !system CreateHeader.exe !include ${Header}

This way you only need to edit the two defines each time you want to add a new patch. :-)

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Last edited by Red Wine on 04-11-2006 at 12:00 PM

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 04-11-2006 10:51 AM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

Nice script Red Wine!
Just one thing though,

!include ${Header}

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 04-11-2006 11:20 AM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
Chilli24
Member

Registered: Jan 2005
From: Seattle, WA

Thank you. I am glad that there is a solution for my problem. I will try to do this a.s.a.p

__________________
Program complexity grows until it exceeds the capability of the programmer who must maintain it.

Quick Link | Report this post to a moderator | IP: Logged

Chilli24 is offline Old Post 04-11-2006 11:49 AM
Click Here to See the Profile for Chilli24 Click here to Send Chilli24 a Private Message Find more posts by Chilli24 Add Chilli24 to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

@ Stu
hmm a typo! that's me! :-)

@ Chilli24
to include subdirs as well place the line bellow under ${RecFindOpen} "${PatchDir}" $R0 $R1:
FileWrite $R2 'SetOutPath "$$INSTDIR$R0"$\r$\n'

code:
Section SetOutPath '$EXEDIR' FileOpen $R2 ${Header} w ${RecFindOpen} "${PatchDir}" $R0 $R1 FileWrite $R2 'SetOutPath "$$INSTDIR$R0"$\r$\n' ${RecFindFirst} FileWrite $R2 'File "${PatchDir}$R0\$R1"$\r$\n' ${RecFindNext} ${RecFindClose} FileClose $R2 SectionEnd

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 04-11-2006 11:59 AM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

Just posted an article at wiki

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 04-11-2006 01:51 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
JasonFriday13
Senior Member

Registered: May 2005
From: Hawera, New Zealand

It is also possible to compile and run a premade script from your installer at compile time:

code:
!define PatchType 'Patch1_Files' !define PatchPath 'C:\${PatchType}' !system '"${NSISDIR}\makensis.exe" /D PatchDir "${PatchPath}" /D Header "${PatchType}" "CreateHeader.nsi"' !system 'CreateHeader.exe' Section !include '${PatchType}.nsh' SectionEnd
CreateHeader.nsi contains the code above by Red Wine, and remove the top two lines of the script as they are defined on the command line . Now all you have to change is the patch type at the top of my script .
[edit]Typo: 'bellow' is spelled 'below' [/edit]

__________________
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
Wiki Profile

Last edited by JasonFriday13 on 04-12-2006 at 01:01 AM

Quick Link | Report this post to a moderator | IP: Logged

JasonFriday13 is offline Old Post 04-11-2006 11:55 PM
Click Here to See the Profile for JasonFriday13 Click here to Send JasonFriday13 a Private Message Find more posts by JasonFriday13 Add JasonFriday13 to your buddy list Edit/Delete Message Reply w/Quote
JasonFriday13
Senior Member

Registered: May 2005
From: Hawera, New Zealand

Sorry, just found an error: forgot the extenstion on the command line.

code:
!define PatchType 'Patch1_Files' !define PatchPath 'C:\${PatchType}' !system '"${NSISDIR}\makensis.exe" /D PatchDir "${PatchPath}" /D Header "${PatchType}.nsh" "CreateHeader.nsi"' !system 'CreateHeader.exe' Section !include '${PatchType}.nsh' SectionEnd

Just ran out of time to edit my post, so I replied again.

__________________
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
Wiki Profile

Quick Link | Report this post to a moderator | IP: Logged

JasonFriday13 is offline Old Post 04-12-2006 03:04 AM
Click Here to See the Profile for JasonFriday13 Click here to Send JasonFriday13 a Private Message Find more posts by JasonFriday13 Add JasonFriday13 to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

@ Jason
I really appreciate your notice for my spelling, though, don't expect I will not do it again.:-)
If you don't mind, please contribute your extension on the above mentioned article
regards

__________________
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 04-12-2006 01:18 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
JasonFriday13
Senior Member

Registered: May 2005
From: Hawera, New Zealand

Will do. [edit] Done. [/edit]

__________________
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
Wiki Profile

Last edited by JasonFriday13 on 04-12-2006 at 10:41 PM

Quick Link | Report this post to a moderator | IP: Logged

JasonFriday13 is offline Old Post 04-12-2006 10:22 PM
Click Here to See the Profile for JasonFriday13 Click here to Send JasonFriday13 a Private Message Find more posts by JasonFriday13 Add JasonFriday13 to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 09:22 PM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > How to get what files to install on compile time?
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON