View Single Post
Old 13th April 2018, 10:29   #7
OliverM
Junior Member
 
Join Date: Apr 2018
Posts: 6
I removed everything not needed in my script and tried again with NSIS 3.03 - the messagebox pop up before the first page is displayed (is this really correct?) - perhaps you can find the issue - this is my script that I'm trying to run - add only one example file (sync.txt) as content - and perhaps you can also tell me if this will also work in silent mode - i guess it will not work - that would be my next question

code:

!define MULTIUSER_EXECUTIONLEVEL Highest
!define MULTIUSER_MUI
!define MULTIUSER_INSTALLMODE_COMMANDLINE

!include "MUI2.nsh"
!include "MultiUser.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "nsDialogs.nsh"

;Basic Config
Name "MyTest"
BrandingText "MyTest"
OutFile "MyTest.exe"
InstallDir "$PROGRAMFILES\MyTest"
InstallDirRegKey HKCU "Software/MyTest" "InstallDir"


;Version Information
VIProductVersion "1.0.0.0"
VIAddVersionKey "ProductName" "MyTest"

;Request application privileges for Windows Vista
RequestExecutionLevel admin



;Design
!define MUI_HEADERIMAGE
!define MUI_HEADER_TRANSPARENT_TEXT
!define MUI_FINISHPAGE_TITLE_3LINES

!define MUI_FINISHPAGE_SHOWREADME ""
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION createdesktopshortcut
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ConfigureFinishPage

;Install Pages
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE

# settings to start application
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_Text "Start #Productname#"
!define MUI_FINISHPAGE_RUN "$INSTDIR\ASGRD.exe"
!insertmacro MUI_PAGE_FINISH

;Uninstall Pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;Set Language
!insertmacro MUI_LANGUAGE "English"


;--------------------------------
;Set checkbox in show finish page

Function ConfigureFinishPage
!if "${MUI_SYSVERSION}" >= 2.0
MessageBox MB_OK $mui.FinishPage.ShowReadme
StrCpy $1 $mui.FinishPage.ShowReadme
!else
GetDlgItem $1 $MUI_HWND 0x4B3
!endif

${GetOptions} $CMDLINE "/NoShortcut" $0

${If} $0 == "=1"
${NSD_Uncheck} $1
${EndIf}
FunctionEnd

;--------------------------------
;Installer Functions

Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY
!insertmacro MULTIUSER_INIT

FunctionEnd

;--------------------------------
;CreateDesktopShortcut Functions
Function createdesktopshortcut
CreateShortCut "$DESKTOP\MyTest.lnk" "$INSTDIR\sync.txt"
FunctionEnd

;--------------------------------

Section "!Core components" Section_CoreInstall
SectionIn RO
SetOutPath $INSTDIR

;AddFiles
File sync.txt

;Start Menu
CreateDirectory "$SMPROGRAMS\MyTest"

;Registry
WriteRegStr HKCU "Software/MyTest" "InstallDir" $INSTDIR

SectionEnd


OliverM is offline   Reply With Quote