-- TIME_STAMP 2021-11-26 13:52:54 v 0.2 --[[ History v 0.2 added: Multiple UDF files for the same prefix i.e.: "udf.path._OL_=C:\Code\AutoIt\udf\OutlookEX 1.7.0.0\OutlookEX.au3|C:\Code\AutoIt\udf\OutlookEX 1.7.0.0\OutlookEX_Base.au3" changed: This script is now called from an executable *.au3 file. Therefore, the resulting command line for calling the respective help is passed to the calling program for execution. ]] local tAU3Help = {} do tAU3Help.pattFunc = '([Ff][Uu][Nn][Cc]%s+[%w_]+%s-%b())' tAU3Help.pattFuncName = '([Ff][Uu][Nn][Cc]%s+)([%w_]+)(%s-%b())' tAU3Help.t_names = {} tAU3Help.Split = function(self, _s, _delim) if not _s:find(_delim) then return {_s} end local t_res = {} for v in (_s.._delim):gmatch("(.-)".._delim) do table.insert(t_res, v) end return t_res end tAU3Help.GetItemHelp = function(self, _item) local prefix = _item:match('^(_%w+_)') if prefix ~= nil then if self:Extract(prefix) then if self.t_names[_item:upper()] then self:CallHelp(prefix, _item) return end end end self:CallHelp('AU3', _item) end tAU3Help.Extract = function(self, _prefix) self.t_names = {} local func, fname, err, s, a, e = '', '', 0 local t_udfpath = self:Split(props['udf.path.'.._prefix:upper()], '|') if #t_udfpath == 0 then return false end for i=1, #t_udfpath do local fh = io.open(t_udfpath[i]) if fh == nil then err = err + 1 else s = fh:read('*a') fh:close() e = 1 while e do a, e, func = s:find(self.pattFunc , e) if a then _, _, _, fname = func:find(self.pattFuncName) if fname:sub(1, _prefix:len()):upper() == _prefix:upper() then self.t_names[fname:upper()] = true end end end end end if err == #t_udfpath then return false end return true end tAU3Help.CallHelp = function(self, _prefix, _item) local path, cmd = props['chm.path.'.._prefix:upper()] if _prefix == 'AU3' then cmd = '"'..props['autoit3dir']..'\\Autoit3Help.exe" "'.._item..'"' else cmd = 'mk:@MSITStore:'..path..'::/funcs/'.._item..'.htm' end props['extender.result'] = cmd -- Runtime property, is queried by the calling Au3 script. end end tAU3Help:GetItemHelp(props['CurrentWord'])