StealFunc is a function-oriented script (tool) to extract only the required functions from an ahk library .
It recursively processes the library file to only extract functions that are minimally needed.
From v0.1 , it has feature to scan a autohotkey script snippet and extract the foreign functions that are used in that script from another given script.
The script is presented as a function.
The first parameter 'function_list' stores a list of functions or a working ahk script snippet whose used function are to be extracted.
The second parameter 'function_file' is the file from which functions are going to be extracted.
The third parameter 'is_list' should be 1 if 'function_list' has a list of functions or 0 otherwise.
The script also has a gui added for user convenience and can be commented out anytime.
Below are the screenshots of the GUI in action.
As said above, function_list can be a list OR a valid snippet of an Autohotkey script.
EXAMPLE for function_list as a list -
EXAMPLE for function_list as a snippet -
The above valid code can serve as a input in the function_list parameter when you change the 3rd parameter is_list to 0.
The stealFunc function scans through the snippet and lists the used User-defined functions.
It then finds them in the Input script file (here the Gdip.ahk) and copies them out if they are found. It rescans and rescans all the
gdip.ahk functions so that the functions they are dependent on are also
The Snippet can be any valid AHK Script and the stealFunc function will always scan it and find the used functions in the Input script file.
Using the richEdit library, I am running the following code.
With stealFunc, you can extract only the function from the lib which are required to run RichEdit_Add. So the code goes -
The output you get is of 74 lines, much less than 2100 lines.
Using VA (VistaAudio), the following code steals the minimal function needed for the above code to work.
The output is 158 lined, certainly better than 880 lines.