Archive: Problem with scirpt "Getsize'


Problem with scirpt "Getsize'
Hi,

I try create program who check file size. But I doing something wrong. Some one help me?

Section
!include LogicLib.nsh
!include "FileFunc.nsh" /* contains ${VersionCompare} */

${GetSize} "$INSTDIR\test12.exe" $0

!include "FileFunc.nsh"
!include "WordFunc.nsh" /* contains ${VersionCompare} */

${GetSize} "$INSTDIR\test.exe" $0
${VersionCompare} "$0" "19103744" $1

/*
$1 now contains one of:
1: Existing $INSTDIR\test12.exe size is HIGHER than 19103744
2: Existing $INSTDIR\test12.exe size is LOWER than 19103744
0: Existing $INSTDIR\test12.exe size IS 19103744
*/
${If} $1 == '1'
MessageBox MB_YESNO|MB_ICONQUESTION $(Message1) IDYES _yes

_yes:
MessageBox MB_YESNO|MB_ICONQUESTION $(Message3) IDYES _yes
${EndIf}
${If} $1 == '2'
MessageBox MB_OK '$(Message2)'/SD IDOK
Abort
${EndIf}
${If} $1 == '0'
${EndIf}
SectionEnd


You cannot include logiclib, filefunc or wordfunc.nsh inside a section.


I delete Section ;) But still have this same error:

"!insertmacro: GetSizeCall
!insertmacro: macro "GetSizeCall" requires 5 parameter(s), passed 2!" I don't know what is wrong.


How can you not know what's wrong? It clearly states that you need to supply 5 parameters. So you want to find out what the parameter format for GetSize is. You can find this in filefunc.nsh, or even in the NSIS manual.
http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.3


I still learn so excuse me :) I try correct but still have error

!include LogicLib.nsh
!include "FileFunc.nsh" /* contains ${VersionCompare} */



; Find file size "$INSTDIR" in kilobytes

${GetSize} "$INSTDIR" "/M=test12.exe /S=0K /G=0" $0 $1 $2
; $0="19103744" kb


${VersionCompare} "$0" "19103744" $1

/*
$1 now contains one of:
1: Existing $INSTDIR\test12.exe version is HIGHER than 19103744
2: Existing $INSTDIR\test12.exe version is LOWER than 19103744
0: Existing $INSTDIR\test12.exe version IS 19103744


${If} $1 == '1'
MessageBox MB_YESNO|MB_ICONQUESTION $(Message1) IDYES _yes
/* IDNO assumed here, as that's the only other option */
Abort /* abort installation */

_yes:
MessageBox MB_YESNO|MB_ICONQUESTION $(Message3) IDYES _yes
/* continue with installation */
${EndIf}

${If} $1 == '2'
MessageBox MB_OK '$(Message2)'/SD IDOK
Abort
${EndIf}

${If} $1 == '0'
${EndIf}

And i have "Invalid command: ${VersionCompare}" Check nsis documentations and everything is good ;/


VersionCompare is defined in wordfunc.nsh, so you'll have to include that.


Work :) Thanks for help and patience.


No problem, glad to help.