Office Accelerator® Support

Conditional Commands

The conditional commands are simple commands that allow a script to implement the logic of traditional ‘If’ and ‘While’ conditionals.

Additional information on Labels can be found here.

GOTO_IF_EQUAL labelname, var1, var2

Goto the given labelname if var1 = var2.

GOTO_IF_NOT_EQUAL labelname, var1, var2

Goto the given labelname if var1 <> var2.

GOTO_IF_GT labelname, var1, var2

Goto the given labelname if var1 > var2.

GOTO_IF_GTE labelname, var1, var2

Goto the given labelname if var1 >= var2.

GOTO_IF_LT labelname, var1, var2

Goto the given labelname if var1 < var2.

GOTO_IF_LTE labelname, var1, var2

Goto the given labelname if var1 <= var2.

Implementing If Then

Psuedo-code

If a=b Then

    a = a + 1

End If

Script equivalent (not optimized)

GOTO_IF_EQUAL MyIf, a, b

GOTO MyEndIf

LABEL MyIf

    ADD a, a, 1

LABEL MyEndIf

Script equivalent (optimized)

GOTO_IF_NOT_EQUAL MyEndIf, a, b

    ADD a, a, 1

LABEL MyEndIf

Implementing If Then Else

Psuedo-code

If a=b Then

    a = a + 1

Else

    b = b + 1

End If

Script equivalent (not optimized)

GOTO_IF_EQUAL MyIf, a, b

GOTO MyElse

LABEL MyIf

    ADD a, a, 1

    GOTO MyEndIf

LABEL MyElse

    ADD b, b, 1

LABEL MyEndIf

Script equivalent (optimized)

GOTO_IF_NOT_EQUAL MyElse, a, b

    ADD a, a, 1

    GOTO MyEndIf

LABEL MyElse

    ADD b, b, 1

LABEL MyEndIf

Implementing Do While

Psuedo-code

Do while a < b

    a = a + 1

Wend

Script equivalent (not optimized)

LABEL MyDoWhile

GOTO_IF_LT MyInsideDo, a, b

GOTO MyWend

LABEL MyInsideDo

    ADD a, a, 1

    GOTO MyDoWhile

LABEL MyWend

Script equivalent (optimized)

LABEL MyDoWhile

GOTO_IF_GTE MyWend, a, b

    ADD a, a, 1

    GOTO MyDoWhile

LABEL MyWend