User UDFs and CallTips

Previous Top Next

Overview

The ability to create your own UDFs or download UDFs created by other users is one of the major advantages of AutoIt.  However, SciTE will not recognize the functions within these UDFs in the same way it does the equivalent functions in the standard UDFs - so when entered in a scripts they will not appear in the AutoComplete combo that appears.  Neither will you get the helpful syntax CallTips when entering parameters.  However, with a little effort these additional UDFs can be made to behave just like the standard ones.

Storage

Just adding these personal and downloaded UDFs to the existing "Include" folder which contains the standard UDFs distributed with AutoIt could result losing all of them when upgrading. Fortunately AutoIt offers the option to use a user-defined folder to store additional UDFs. Begin by creating a new folder to hold these additional UDFs - it is recommended NOT to put this folder in the AutoIt install folder. Then tell AutoIt about this folder by using SciTEConfig to create the "Include" value in the "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" registry key. SciTEConfig will also add these lines:
openpath.$(au3)=$(autoit3dir)\include;Your_Folder_Path
openpath.beta.$(au3)=$(autoit3dir)\beta\include;Your_Folder_Path
to your SciTEUser Options file so that the <Open Include> tool (if selected) will see these new UDFs.

User CallTip Manager

A management utility is included with SciTE4AutoIt3 which enables you manage the UDFs you have added very easily - see here.  However, read on if you wish to add the UDF functions manually to the relevant files.

Syntax Highlighting

Installing SciTE adds a special file to the user profile "au3.UserUdfs.properties" - this stores the function names from the UDFs to add to the proper color highlihting.  The contents look like this:
au3.keywords.user.udfs=_function1 _function2 _function3 \       
     _function4 _function5 _function6 _function7
Note that the entries are all in lowercase and all lines other than the first begin with a TAB character.  You can open this file via the <Options> menu in SciTE.

CallTips/AutoComplete

Another special file added to the user profile is "au3.user.calltips.api" - this stores the AutoComplete and CallTip data for each function.  The data is stored in a single line for each function like this:         _Function($param1, $param2, $param3) Explanation of function (Requires: #Include UDF.au3) Of course you need to change the Function, $param and UDF words to the correct values for the UDF function you want to include. Again you can open this file via the <Options> menu in SciTE.

Save

Once you have added the new functions, save all files, close and restart SciTE - your personal and downloaded UDFs are now as accessible as the standard set. You will have AutoComplete when you start typing the UDF function name in a script and a syntax CallTip as you enter the parameters.