Look at what Kip has done with his preprocessor (and a history of others before him), the possibilities are seemingly endless. By creating a preprocessor for AutoIt (not the kind that simply improves execution speed), we can do more with the language than what is officially available to us. The question central to this thread is:
What cool and fun things can we do with AutoIt?
I'm always trying out new languages when I get an opportunity. With seeing more and more of other languages always comes envy of other language features. I am quite sure that anyone who reads this and knows another language will go "True, i've always wanted [...] in AutoIt". There are possible through a preprocessor which produces (even neatly looking) AutoIt code to reach this goal.
I've some simple ideas to get the thread started.
When keyword
inspired by await
$finished = False When PixelGetColor(100, 100) == 0xFF00FF MouseClick("Left", 100, 100) $finished = True EndWhen While Not $finished Sleep(100) WEnd
This can be compiled to:
$finished = False AdlibRegister("__implDetail__When01", 100) While Not $finished Sleep(100) WEnd Func __implDetail__When01() If PixelGetColor(100, 100) == 0xFF00FF Then MouseClick("Left", 100, 100) $finished = True EndIf EndFunc
The trick is to determine the right amount of sleep it needs automagically (it's a private implementation detail after all). Perhaps 100ms is a good default choice, but some will need to define it themselves.
Inline functions (maybe even called delegates)
Inspired by Lua inline functions.
Actual code:
How this works is that any time you use Func() it is replaced with a function name (as string), and the function statements are preprocessed into a new function with that name.
Moar!





