Au3Stripper

Previous Top Next

Introduction:

A few things to note before use:

·     Ensure the script is working correctly before using Au3Stripper.
·     Ensure the Au3Stripped script is extensively tested
·     Do not complain if using Au3Stripper prevented the script from working correctly

What Au3Stripper does:

Au3Stripper will read your script and the include files you have added and create a new source file.  As it works it will do all or some of the following depending on the parameters you have chosen:

·     Strip all unused UDF's (Funcs) and/or unused Global/Local Variables from your main script and all included files.

·     PreExpand Global Const Variables.

·     Rename Variables

·     Rename Func names

·     Warn you that the script is likely to have difficulties running if a parameter cannot be determined before run-time.  This usually occurs if:

·    A function takes a literal string parameter defining a function or variable.  In this case the resulting string might not be able to be correctly linked to the correct variable or function name during the process.  This only affects certain AutoIt3 functions:

AdlibRegister()
AdlibUnRegister()
Call()
Eval()
Execute()
GUIRegisterMsg()
GUISetOnEvent()
GUICtrlSetOnEvent()
TrayItemSetOnEvent()
HotKeySet()
IsDeclared()
ObjEvent()

·    A parameter contains an Ampersand (&) - as the parameter is concatenated from other variables/strings it too might not be correctly linked. 

·     Produce an Au3Stripper.log which contains all information about the conversion process in case of problems.

Supported commandline or compiler directive options:

The following parameters can be passed on the command line or within the script via the #Au3Stripper_Parameters= directive:
  
/TraceLog
/TL
Create Au3Stripper.Log with a trace of all actions.
/debug
Create Au3stripper.Log and a sourcecode resultfile per iteration: Au3Stripper-Iteration-?.au3.
/PreExpand
/PE
Replace any reference to a Global Const variable with its actual value.
/StripOnly
/SO
Set the options to:/SF=1 /SV=1 which is now also the default when no parameters are specified.
/StripUnusedFunc=0/1
/SF=0/1
Strip unused Funcs (Default = 1)
/StripUnusedVars=0/1
/SV=0/1
Strip unused Global and Local variable declarations (Default = 1)
/MergeOnly
/MO
Will produce a scriptfile as AUT2EXE includes in the Compiled EXE. This allows you to find the proper linenumber when errors are reported.
Note: Make sure you remove the #pragma lines or else the linenumbers will be off by the that number of records
/MaxIterations
/MI
Sets the maximum Iterations Au3Stripper will perform. Default is 5.
/RenameMinimum
/RM
Generates a much smaller file by substituting function and variable names with unique 2+-character names
/ShowConsoleInfo=0/1/9
/SCI=0/1/9
0 = (Default) Minimal output to the console - only warnings and errors.
1 = Show more progress information
9 = Show all debug lines as found in the Au3Stripper.log.
/rsln
Replace @ScriptLineNumber with the actual line number in the merged source. This is for debug purposes with compiled scripts. All master lines will show 2 numbers in the format xxx/yyy where xxx is the original master script line number and yyy the merged script line number.
/Beta
Use the ...\AutoIt\Beta\Include files if installed

The directives used within the script to control Au3Stripper are as follows:
#AutoIt3Wrapper_Run_Au3Stripper=y    Run Au3Stripper before compilation (Default=n)
#Au3Stripper_Parameters=                    Use the parameters as listed above
#Au3Stripper_Off                                  Stop the Stripping process below this line
#Au3Stripper_On                                  Start the Stripping process below this line
#Au3Stripper_AlwaysStrip_Off               Stop the Stripping ALL LINES process
#Au3Stripper_AlwaysStrip_On               Start the Stripping ALL LINES from here
#Au3Stripper_Ignore_Funcs=                 Do not Strip these functions. FuncNames may end with an * to indicated matching FuncNames starting with the specified string.
#Au3Stripper_Ignore_Variables=            Do not Strip these variables. VarNames may end with an * to indicated matching VarNames starting with the specified string.

Running Au3Stripper

Au3Stripper can be run:

Manually. 

Add these lines to the UserOptions file accessed via the <Options> menu within SciTE:
command.46.*.au3="$(SciteDefaultHome)\au3Stripper\Au3Stripper.exe" "$(FilePath)"
command.name.46.au3=Au3Stripper
command.save.before.46.*.au3=1
command.is.filter.46.*.au3=1
Au3Stripper will now appear as a <Tools> menu item. Note the command number may have to be adjusted - see here for more details.

Batch:

Au3Stripper.exe Scriptname.au3

From within SciTE:

If the #AutoIt3Wrapper_Run_Au3Stripper=y directive is added to the script then AutoIt3Wrapper will do the following: