Authenticity Posted February 25, 2009 Posted February 25, 2009 expandcollapse popup#NoTrayIcon _Main() Func _Main() Local $sAutoIt = @ProgramFilesDir & '\autoit3' Local $sAutoItInclude = $sAutoIt & '\include' Local $sAutoItSciTE = $sAutoIt & '\scite\api\au3.user.calltips.api' If FileExists($sAutoItInclude) Then $sFiles = FileOpenDialog('User Defined CallTip Format', $sAutoItInclude, 'AutoIt3 (*.au3)', 7) Else $sFiles = FileOpenDialog('User Defined CallTip Format', '', 'AutoIt3 (*.au3)', 7) EndIf If Not @error Then Local $aFiles = StringSplit($sFiles, '|') Local $fFile = @error Local $sDestination = '' If Not FileExists($sAutoItSciTE) Then $sDestination = FileOpenDialog('Please insert the path to "au3.user.calltips.api"', '', 'api (*.api)', 3) If Not @error Then $sAutoItSciTE = StringReplace($sDestination, '|', '\') Else Return MsgBox(0x40, 'UDFF (AutoIt v3.3.0.0)', 'No file processed') EndIf EndIf If $fFile Then _FormatUserCallTip($aFiles[1], $sAutoItSciTE) Else For $i = 2 To $aFiles[0] _FormatUserCallTip($aFiles[1] & '\' & $aFiles[$i], $sAutoItSciTE) Next EndIf $sFiles = StringRegExpReplace($sFiles, '(.*?\|)', '', 1) MsgBox(0x40, 'UDFF (AutoIt v3.3.0.0)', 'File(s) processed:' & @LF & @LF & StringReplace($sFiles, '|', @LF)) Else MsgBox(0x40, 'UDFF (AutoIt v3.3.0.0)', 'No file processed') EndIf EndFunc Func _FormatUserCallTip($sInclude, $sCallTipPath) Local $aRequired = StringRegExp($sInclude, '.*\\(.*)', 1) Local $sRequired = $aRequired[0] Local $sFile = FileRead($sInclude) Local $sPattern = '(?>;\s*#FUNCTION#[^\r]*\r\n(?:\s*;[^\r]*\r\n)*)' Local $aMatches = StringRegExp($sFile, $sPattern, 3) If Not IsArray($aMatches) Then Return SetError(1, 0, -1) Local $UB = UBound($aMatches) Local $sUserCallTip = '', $sDescription, $sFunc_Syntax, $sFuncName For $i = 0 To $UB-1 $sFuncName = _SingMatch($aMatches[$i], 'Name[^:]*:\s*([^\r ]*)') $sDescription = _SingMatch($aMatches[$i], 'Description[^:]*:\s*([^\r]*)') $sFunc_Syntax = _SingMatch($aMatches[$i], 'Syntax[^:]*:\s*(?>[^\r]*)') $sFunc_Syntax = StringRegExpReplace($sFunc_Syntax, '(?=\()(\()([^\)]*)(\))', ' $1"$2"$3 ' & $sDescription) If Not StringRegExp($sFunc_Syntax, '^' & $sFuncName) Then $sFunc_Syntax = StringRegExpReplace($sFunc_Syntax, '(.*?' & $sFuncName & ')', $sFuncName) EndIf $sUserCallTip &= $sFunc_Syntax & ' (required: #include <' & $sRequired & '>)' & @CRLF Next If _WriteUDFFFormat($sCallTipPath, $sUserCallTip) Then Return SetError(2, 0, -1) Return SetError(0, 0, 0) EndFunc Func _SingMatch($sStr, $sMatch) Local $aMatch = StringRegExp($sStr, $sMatch, 1) If IsArray($aMatch) Then Return $aMatch[0] Return '' EndFunc Func _WriteUDFFFormat($sCallPath, $sCallFormat) Local $hFile = FileOpen($sCallPath, 1) If $hFile = -1 Then Return 1 FileWrite($hFile, $sCallFormat & @CRLF) FileClose($hFile) Return 0 EndFunc I've tried to keep it non-specific as much as possible.
Ascend4nt Posted February 27, 2009 Posted February 27, 2009 Authenticity, this sounds handy, but I wasn't quite able to figure out what's required by the programmer in their UDFs? It doesn't look like it pulls out Funcs.. could you provide the format? Or should I already know Thanks, Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Authenticity Posted February 27, 2009 Author Posted February 27, 2009 It's a tool not UDF it write CallTips by the conventional format: _FuncName ("$iParameter, $aParameter") Description goes here (required: #include <filename.au3>)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now