Old 9th August 2012, 05:29   #1
Deleted #21
Guest
 
Posts: n/a
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

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

  Reply With Quote
Old 9th August 2012, 05:46   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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
MSG is offline   Reply With Quote
Old 9th August 2012, 06:39   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Quote:
Originally Posted by MSG View Post
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...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th August 2012, 14:22   #4
Zinthose
Senior Member
 
Join Date: May 2009
Posts: 152
I personally prefer to use AutoIt for compile time scripting when NSIS is impractical or to complicated.
Zinthose 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