First off I should probably explain that a preprocessor is a program that you run your code through that will basically just do an advanced search and replace to your code using terms you provide using special syntax in your code. A common task that is preformed by preprocessor is defining constants, so at the top of your program you say replace all instances of the word PROGRAM_VERSION with 1.13 and then down where you output the program version just write PROGRAM_VERSION instead, then when you run your source through the preprocessor, it will generate a copy of your source except that all instances of PROGRAM_VERSION have been replaced with 1.13, then you run the generated source through ahk.
Obviously in ahk you can just use a variable to do that sort of thing but preprocessors can also do more advanced things.
The main things I can see uses for is macros, similar to the ones in c. While macros aren't the most elegant solution, and eventually should be replaced with features in the actual language (which is probably why they are more and more being depreciated in c++), they are extremely powerful tools, especially in a language as immature as ahk.
Here is a simple example:
I often take advantage of the Transform deref function to get the values of variables whos name I generate on the fly, like for arrays or something.
Code:
Array1 = A
Array2 = B
Array3 = C
ArrayNum = 3
loop, %ArrayNum%
{
Transform, ArrayCurrent, Deref, `%Array%A_Index%`%
MsgBox, Array%A_Index% = %ArrayCurrent%
}
Transform is lengthy and is can clutter up code, using the c preprocessor (for example) you could write:
Code:
#define SET(var1,var2) Transform, var1, Deref, `%var2`%
Array1 = A
Array2 = B
Array3 = C
ArrayNum = 3
loop, %ArrayNum%
{
SET(ArrayCurrent,Array%A_Index%)
MsgBox, Array%A_Index% = %ArrayCurrent%
}
This example doesn't give us huge amounts of benefit, but more complex macros can save a lot of time by generating complicated reusable code automatically.
I guess I should be clear that preprocessors are designed to help write code, not write programs. By that I mean it's there to get around annoying syntax or making complicated tasks simpler, but can't really do much in terms of adding power to the language, since in the end the script passed off to ahk will still have to work within the limits of the ahk language.