AndyS01

Preprocessor to expand my @ macros

4 posts in this topic

I need to hook in a preprocessor that runs before run/compile time, but I can't find any help on this.  I already have some AutoIT code to read a file and replace my @ThisFileName macros with the actual source file being reprocessed.  This macro will be used to emit the filename of the source file or my library UDFs.  So, I want to run it when parsing each source file and each include file.

I don't know how to hook my code into the run/build process.  I was kind of looking for a tutorial or an example of installing the hooks.

Share this post


Link to post
Share on other sites



You will want to use one of these directives:

Quote

;===============================================================================================================
; RUN BEFORE AND AFTER definitions
; The following directives can contain: these variables
;   %in% , %out%, %outx64%, %icon% which will be replaced by the fullpath\filename.
;   %scriptdir% same as @ScriptDir and %scriptfile% = filename without extension.
;   %fileversion% is the information from the #AutoIt3Wrapper_Res_Fileversion directive
;   %scitedir% will be replaced by the SciTE program directory
;   %autoitdir% will be replaced by the AutoIt3 program directory
#AutoIt3Wrapper_Run_Stop_OnError=               ;(Y/N) Stop when Returncode <> 0
#AutoIt3Wrapper_Run_Before_Admin=               ;(Y/N) Run subsequent Run_Before statements with #RequireAdmin. Default=N
#AutoIt3Wrapper_Run_After_Admin=                ;(Y/N) Run subsequent Run_After statements with #RequireAdmin. Default=N
#AutoIt3Wrapper_Run_Before=                     ;process to run before compilation - multiple records will be processed in sequence
#AutoIt3Wrapper_Run_After=                      ;process to run after compilation - multiple records will be processed in sequence

 

On a new line, type #auto and see what's there. Then hit F1 on the directive chosen for help on Wrapper directives (and much more information).


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The 'run before' refers to when you're compiling (F7), not when you're running (F5)

Edited by AndyS01

Share this post


Link to post
Share on other sites

So, no.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • AGlassman
      M4Au3 - M4 Based Macro Preprocessor for AutoIt
      By AGlassman
      I have been searching for a general purpose AutoIt macro preprocessor for some time. I've looked at all the existing implementations I could find, and researched two in detail:

      Shaggi's implementation of the C Preprocessor "mcpp" ()

      kjactive's Au3PreProcessor ().

      But none of these are general enough in scope, or powerful enough in their macro expansion capabilities, to allow the rapid development of domain specific commands or the encapsulation of complex AutoIt constructs that I'm looking for.

      So, I am currently building a prototype AutoIt preprocessor (tentatively named "M4Au3") based on the GNU M4 macro processor (http://www.gnu.org/software/m4/). My goal is to provide a well defined set of built-in macros that extend the existing AutoIt "@Macro" syntax (but accept arguments) and to allow user defined macros in the same style, e.g. "@MyMacro( Arg1, Arg2 )".

      If anyone has already tried this approach, or something similar to it, I would be very interested in your results and suggestions.