More advanced dump log to file: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library) |
m (Updated author and download links, and changed format of some pages.) |
||
Line 82: | Line 82: | ||
-Stu (Afrow UK) | -Stu (Afrow UK) | ||
Page author: Afrow UK | Page author: [[User:Afrow UK|Afrow UK]] |
Revision as of 12:37, 23 April 2005
Description
This is based on the original Dump log to file function by KiCHiK, but instead, only log's lines containing the inputted string.
Usage
This will write any lines containing "error" that were dumped to the log window during installation to "mappackage_errors1.txt".
Push error Push "$EXEDIR\logs\mappackage_errors1.txt" Call AdvDumpLog
The Script
!define LVM_GETITEMCOUNT 0x1004 !define LVM_GETITEMTEXT 0x102D Function AdvDumpLog Exch $5 ;input file Exch Exch $9 ;string to search for Push $0 Push $1 Push $2 Push $3 Push $4 Push $6 Push $7 Push $8 Push $R0 FindWindow $0 "#32770" "" $HWNDPARENT GetDlgItem $0 $0 1016 StrCmp $0 0 error FileOpen $5 $5 "w" ;change to "a" if you do not want to overwrite StrCmp $5 "" error 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)" StrLen $8 $9 StrCpy $7 0 searchloop: IntOp $7 $7 - 1 StrCpy $R0 $4 $8 $7 StrCmp $R0 "" +3 StrCmp $R0 $9 0 searchloop FileWrite $5 "$4$\r$\n" IntOp $2 $2 + 1 Goto loop done: FileClose $5 System::Free $1 System::Free $3 Goto exit error: MessageBox MB_OK error exit: Pop $8 Pop $7 Pop $6 Pop $4 Pop $3 Pop $2 Pop $1 Pop $0 Exch $9 Exch Exch $5 FunctionEnd
-Stu (Afrow UK)
Page author: Afrow UK