GSAK (Geocaching Swiss Army Knife)
Contents - Index

PreProcess (command)

PreProcess [<Shift=$variable>] [<Ctrl=$variable>] [<Alt=$variable>]

Note: This command is deprecated, it is recommend you use the $_StartShift, $_StartCtrl, and $_StartAlt system variables instead

Use in large macros where you immediately need to know the status of the Shift and/or Ctrl and/or Altl keys at the commencement of the macro - enter this command as the very first line in your macro. Otherwise just use the system variables $_Shift and/or $_Ctrl and/or $_Alt


Background

When running a macro, the first thing that GSAK needs to do is "pre process" it. This process reads every line of code and checks for certain syntax errors as well as converting some of the code so it is backwards compatible. With large macros this can mean there is a bit of a time lag before any line of code actually executes. 

This time lag can cause issues when using  the system variables $_ShiftKey and $_CtrlKey because the values of these system variables are unknown until we actually execute that line of code.So if the user holds down the Shift key when starting the macro, but releases it while pre processing is still happening (before any lines of code are executed) we don't have a correct representation of the Shift key. 

The PreProcess command addresses this issue. Use the PreProcess command to interrogate your Shift and Ctrl keys before any preprocessing is done. This effectively means you will know the status of these keys almost the instant the macro is started, regardless of how many lines your macro contains.

At this stage this command is provided only to resolve the issue of finding out the value of the shift and ctrl keys the instant the macro starts to run. However, we may find other uses for this command where we need to know the value of a variable or some condition at the instant the macro is called, rather than wait for the code to start executing.

The parameters are optional. If you enter the Shift parameter, then the $variable name you enter after the = will be created and given the value of the Shift key status at the time this command is run (within the preprocessor, so place this line of code at the very beginning of your macro). Similarly for the Ctrl parameter.

This command would only be needed for large macros (use 2000 lines as a guide) where it is apparent there is a time lag between running the pre processor and the first line of "normal" code.

For all other instances the use of $_Shift and $_Ctrl should be sufficient. You should especially use these system variables if you are evaluating these keys continually throughout the macro, and especially after displaying a form . Using the PreProcess command is a "once only" interrogation of the status of these keys. 

Alpha List         Category List

Copyright 2004-2019 CWE Computer Services  
Privacy Policy Contact