Old 7th January 2012, 10:47   #1
presleyDias
Junior Member
 
Join Date: Jan 2012
Posts: 2
call dumplog function when the installation is complere

hello, im working on a nsi script and i need to log the installer actions to a file,
i have the script to save the log file fromhttp://stackoverflow.com/questions/8...is-install-log,

the dumplog function works fine, but i need to call it at the end of installation,

my example code
code:

!include "MUI.nsh"
!define LVM_GETITEMCOUNT 0x1004
!define LVM_GETITEMTEXT 0x102D
Name "Modern UI Test 1.70"
OutFile "sectiontest.exe"
InstallDir "$PROGRAMFILES\Modern UI Test"
InstallDirRegKey HKCU "Software\Modern UI Test" ""

!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd


Section "last section" Sec12
StrCpy $0 "$INSTDIR\Query\Presleyinstall.log"
Push $0
Call DumpLog
SectionEnd



Function DumpLog
Exch $5
Push $0
Push $1
Push $2
Push $3
Push $4
Push $6

FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1016
StrCmp $0 0 exit
FileOpen $5 $5 "w"
StrCmp $5 "" exit
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
System::Alloc ${NSIS_MAX_STRLEN}
Pop $3
StrCpy $2 0
System::Call "*(i, i, i, i, i, i, i, i, i) i \
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
loop: StrCmp $2 $6 done
System::Call "User32::SendMessageA(i, i, i, i) i \
($0, ${LVM_GETITEMTEXT}, $2, r1)"
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
FileWrite $5 "$4$\r$\n"
IntOp $2 $2 + 1
Goto loop
done:
FileClose $5
System::Free $1
System::Free $3
exit:
Pop $6
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
Exch $5
FunctionEnd

LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
SectionEnd






here i have two sections but since the dump function call is in section 2, if the user doesnt select the section2, the dumplog function will not get called,

can any tell me how to call the dumplog function even if the section is not selected.
Attached Files
File Type: nsi sectiontestlogTest.nsi (2.3 KB, 184 views)
presleyDias is offline   Reply With Quote
Old 7th January 2012, 11:26   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Put it in a section without a name.

Stu
Afrow UK is offline   Reply With Quote
Old 11th January 2012, 08:47   #3
presleyDias
Junior Member
 
Join Date: Jan 2012
Posts: 2
hey, that worked thank you ...


Section
StrCpy $0 "$INSTDIR\Query\Presleyinstall.log"
Push $0
Call DumpLog
SectionEnd
presleyDias is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
installation, nsis

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