Archive: LogicLab loops


LogicLab loops
Hello,

I just discovered the logiclab header which looks like it will really help me to produce more readable code. So I tried to use it and have come into problems. Here is what I have done :

At the top of the file, I have the line

!include "LogicLib.nsh"

Later on I have the following function (cut down to a smaller example) :

Function ModifyShortcutFile

;we need to get the machine list and tokenise it
StrCpy $1 "DropPaq"
StrCpy $2 ".lnk"
StrCpy $LOOP_COUNT 0

${Do}
StrCpy $9 ""
${StrTok} $R0 ${MACHINE_LIST} "|" $LOOP_COUNT 1
IntOp $LOOP_COUNT $LOOP_COUNT + 1
${If} $R0 == ``
${ExitDo}
StrCpy $9 "$1 $R0$2"
DetailPrint "Accessing PDA for $R0 on file $9"

${Loop}

FunctionEnd

However when I attempt to compile this, I get the following error:

[exec] FunctionEnd
[exec] Function: "ModifyShortcutFile"
[exec] StrCpy $1 "DropPaq" () ()
[exec] StrCpy $2 ".lnk" () ()
[exec] StrCpy $LOOP_COUNT "0" () ()
[exec] !insertmacro: _Do
[exec] !insertmacro: end of _Do
[exec] StrCpy $9 "" () ()
[exec] !insertmacro: StrTok
[exec] Push: wellmate
[exec] Push: |
[exec] Push: $LOOP_COUNT
[exec] Push: 1
[exec] Call "StrTok"
[exec] Pop: $R0
[exec] !insertmacro: end of StrTok
[exec] IntOp: $LOOP_COUNT=$LOOP_COUNT+1
[exec] !insertmacro: _If
[exec] !insertmacro: end of _If
[exec] !insertmacro: _Goto
[exec] !insertmacro: end of _Goto
[exec] StrCpy $9 "$1 $R0$2" () ()
[exec] DetailPrint: "Accessing PDA for $R0 on file $9"
[exec] !insertmacro: _Loop
[exec] !error: Cannot use Loop without a preceding Do
[exec] Error in macro _Loop on macroline 4
[exec] Error in script "C:\Documents and Settings\Neil Benn\My Documents\svn_new\trunk\DropPaq/installer/CE/DropPaq CE.nsi" on line 254 -- aborting creation process

I can't work out what, I'm doing wrong - I took a look at the macro in StrTok which has an examaple of the LogicLab headers and I think I am doing the right thing but I'm not sure.

Apologies for the length of this post - I hope you can help and thanks for reading this far.

Cheers,

Neil


 ${If} $R0 == ``
${ExitDo}
${EndIf}

You don't have an '${EndIf}' before the ${Loop} - I guess you want that after the ${ExitDo} line.