Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   WRITE INI while compiling (http://forums.winamp.com/showthread.php?t=346901)

Deleted #21 9th August 2012 05:29

WRITE INI while compiling
 
Hi

I need help. I have a script, that installs a set of new files into a program. After the setup a INI file I updated by the new version number, that is set manually.
I want to change the script, but i do not know how to handle.
How is it possible to write the INI file during the compilation, before the files are packed into the setup?

Here is the script. Hope you can help:

code:
-------------------------------------------------------------------------
; Script generated with the Venis Install Wizard
!define APPNAME "Diagnose"
!define APPTYPE "Daten"
!define APPVERSION "3.2.3"
!define APPNAMEANDVERSION "${APPNAME} ${APPTYPE} ${APPVERSION}"

!include "Sections.nsh"

Var DIAGNOSEHOME

; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Diagnose\"
;InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "C:\Daten\Diagnose\generierte Setup-Files\Setup ${APPNAMEANDVERSION}.exe"
SetCompressor lzma

; Modern interface settings
!include "MUI.nsh"
!define MUI_ABORTWARNING


!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_RESERVEFILE_LANGDLL

Section "PUDIS Daten" Section1
; Eventuell vorhandene Installation entfernen
RMDir /r "$INSTDIR\Data"
RMDir /r "$INSTDIR\res"
; PUDIS Daten installieren
SetOverwrite on
SetOutPath "$INSTDIR"

File /r /x "*.metadata*" "C:\Daten\Diagnose\Rohdaten\Diagnose_Daten\*.*"

WriteINIStr $INSTDIR\DiagnoseSetting.INI Allgemein DatenVersNo "${APPVERSION}"

SectionEnd

Section -FinishSection
WriteRegStr HKLM "Software\${APPNAME}" "DATA_VERSION" "${APPVERSION}"
SectionEnd

; On initialization
Function .onInit
ReadRegStr $DIAGNOSEHOME HKLM "Software\DIAGNOSE" "PATH"
StrCmp $DIAGNOSEHOME "" ENDE DIAGNOSEYES
DIAGNOSEYES:
StrCpy $INSTDIR $DIAGNOSEHOME #
ENDE:
FunctionEnd

; eof

-------------------------------------------------------------------------


MSG 9th August 2012 05:46

You can create an nsis exe, or bat, or vbs script, that writes data to the ini. You can execute this exe/whatever during compilation using !execute or !system. See chapter 5 for details: http://nsis.sourceforge.net/Docs/Chapter5.html

Anders 9th August 2012 06:39

Quote:

Originally Posted by MSG (Post 2875931)
You can create an nsis exe, or bat, or vbs script, that writes data to the ini. You can execute this exe/whatever during compilation using !execute or !system. See chapter 5 for details: http://nsis.sourceforge.net/Docs/Chapter5.html

Batchfiles nor VBScript/WSH supports INI files.

You can fake a .ini file with !appendfile...

Zinthose 9th August 2012 14:22

I personally prefer to use AutoIt for compile time scripting when NSIS is impractical or to complicated.


All times are GMT. The time now is 17:24.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.