MHz Posted March 6, 2006 Share Posted March 6, 2006 (edited) Summary:This is a tool I use in Scite tools. It will read through the current opened script in Scite and store all the function Calltips (after the Func keyword) ready to be written to the Calltips file for quick and easy operation. This this script operates from a subfolder in the Scite directory. It requires the latest release of AutoIt or AutoIt Beta to compile or run. Scite4AutoIt3 is available here.Instructions:Make a subfolder in the Scite4AutoIt3 folder called "Tools" and add this file there called UserCalltips.exeThis is added to the user properties file# 45 User Calltip Generator command.45.$(file.patterns.au3)="$(SciteDefaultHome)\Tools\UserCalltips.exe" /in "$(FilePath)" command.subsystem.45.$(file.patterns.au3)=1 command.name.45.$(file.patterns.au3)=User Calltip Generator command.shortcut.45.$(file.patterns.au3)= command.save.before.45.$(file.patterns.au3)=2Script:expandcollapse popup#region - Constants ; Constants Global Const $IDNO = 7 ; GuiConstants Global Const $GUI_ENABLE = 64 Global Const $GUI_DISABLE = 128 Global Const $GUI_FOCUS = 256 Global Const $WS_HSCROLL = 0x00100000 Global Const $WS_VSCROLL = 0x00200000 Global Const $ES_AUTOVSCROLL = 64 Global Const $ES_AUTOHSCROLL = 128 Global Const $ES_READONLY = 2048 Global Const $ES_WANTRETURN = 4096 Global Const $GUI_SS_DEFAULT_EDIT = BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL) #endregion Global $file_read If $Cmdline[0] Then For $i = 1 To $Cmdline[0] Step 2 Switch $Cmdline[$i] Case '/?' MsgBox(0x40000, StringTrimRight(@ScriptName, 4) & ' Help', _ 'Switches are:' & @LF _ & @LF & '/in' _ & @LF & @TAB & '/in "ScriptFullPath"') Exit Case '/in' $file_read = $Cmdline[$i+1] Case Else MsgBox(0x40000, 'Incorrect switch used', 'Command used:' & @LF & $CmdlineRaw _ & @LF & @LF & 'Use /? for the switches available.' & @LF & @LF & _ 'For use as a Scite Tool, use:' & @LF & _ @TAB & '# 45 User Calltip Generator' & @LF & _ @TAB & 'command.45.$(file.patterns.au3)="$(SciteDefaultHome)\Tools\UserCalltips.exe" /in "$(FilePath)"' & @LF & _ @TAB & 'command.subsystem.45.$(file.patterns.au3)=1' & @LF & _ @TAB & 'command.name.45.$(file.patterns.au3)=User Calltip Generator' & @LF & _ @TAB & 'command.shortcut.45.$(file.patterns.au3)=' & @LF & _ @TAB & 'command.save.before.45.$(file.patterns.au3)=2' & @LF & _ @LF & 'Make a subfolder in the Scite4AutoIt3 folder called "Tools" and add this file there' & _ @LF & 'You can use Ctrl+C to copy these details to the clipboard') Exit EndSwitch Next EndIf If FileExists(@ScriptDir & '\..\api\au3.user.calltips.api') Then Global $handle_read, $line, $total, $return $handle_read = FileOpen($file_read, 0) While 1 $description = '' $line = FileReadLine($handle_read) If @error Then ExitLoop $line = StringStripWS($line, 3) If StringLeft($line, 1) = ';' Then ContinueLoop If StringLeft($line, 4) <> 'Func' Then ContinueLoop Else $description = FileReadLine($handle_read) $description = StringStripWS($description, 3) If StringLeft($description, 2) <> ';~' And StringLeft($description, 1) = ';' Then $description = StringStripWS(StringTrimLeft($description, 1), 3) Else $description = '' EndIf $line = StringReplace($line, '(', ' ( ') $line = StringReplace($line, ')', ' )') $line = StringReplace($line, '$', '') $total &= StringTrimLeft($line, 5) & ' ' & $description & @CRLF EndIf WEnd FileClose($handle_read) EndIf #region - Gui GUICreate('User CallTips', 700, 500) GUICtrlCreateEdit($total, 20, 20, 660, 440, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) GUICtrlSetBkColor(Default, 0xFFFFFF) $open = GUICtrlCreateButton('&Open API file', 20, 470, 100) $erase = GUICtrlCreateButton('&Erase API file', 160, 470, 100) $ow = GUICtrlCreateButton('&Append to API file', 300, 470, 100) $ok = GUICtrlCreateButton('&Write to API file', 440, 470, 100) $cancel = GUICtrlCreateButton('&Cancel', 580, 470, 100) GUICtrlSetState($cancel, $GUI_FOCUS) GUISetState() #endregion While 1 Switch GUIGetMsg() Case -3 Exit Case -100 To 0 ContinueLoop Case $open GUICtrlSetState($open, $GUI_DISABLE) Global $scite = @ScriptDir & '\..\Scite.exe' $api = StringReplace(@ScriptDir & '\..\api\au3.user.calltips.api', '\', '\\') RunWait($scite & ' "-open:' & $api & '"') Sleep(500) GUICtrlSetState($open, $GUI_ENABLE) Case $erase GUICtrlSetState($erase, $GUI_DISABLE) $handle_write = FileOpen(@ScriptDir & '\..\api\au3.user.calltips.api', 2) If $handle_write = -1 Then MsgBox(0x0, 'User CallTips', 'Write error') Exit EndIf FileClose($handle_write) Sleep(500) GUICtrlSetState($erase, $GUI_ENABLE) Case $ow GUICtrlSetState($ow, $GUI_DISABLE) $handle_write = FileOpen(@ScriptDir & '\..\api\au3.user.calltips.api', 1) If $handle_write = -1 Then MsgBox(0x0, 'User CallTips', 'Write error') Exit EndIf FileWrite($handle_write, $total) FileClose($handle_write) Sleep(500) GUICtrlSetState($ow, $GUI_ENABLE) Case $ok GUICtrlSetState($ok, $GUI_DISABLE) $handle_write = FileOpen(@ScriptDir & '\..\api\au3.user.calltips.api', 2) If $handle_write = -1 Then MsgBox(0x0, 'User CallTips', 'Write error') Exit EndIf FileWrite($handle_write, $total) FileClose($handle_write) Sleep(500) GUICtrlSetState($ok, $GUI_ENABLE) Case $cancel Exit EndSwitch WEndRemember to backup your Calltips file first before using this, as the changes are permanent. What you choose, you get.Edit:Scite will need a restart to see the New Calltips added to the file. If the line after Func Name() is the open script read is a comment, then that will be used as a Calltip description.Edit:Rephrased AutoIt version needed. Edited April 15, 2007 by MHz Link to comment Share on other sites More sharing options...
Dolemite50 Posted April 15, 2007 Share Posted April 15, 2007 I couldn't let this one go another day without a single response or thanks. So,..thanks! Link to comment Share on other sites More sharing options...
Gcommer Posted April 15, 2007 Share Posted April 15, 2007 This is a tool I use in Scite tools. It will read through the current opened script in Scite and store all the function Calltips (after the Func keyword) ready to be written to the Calltips file for quick and easy operation. This this script operates from a subfolder in the Scite directory. It requires the AutoIt Beta to compile or run. Scite4AutoIt3 is available here.Hate to sound so stupid, but what exactly does it do? and what are call tips? Link to comment Share on other sites More sharing options...
eltorro Posted April 15, 2007 Share Posted April 15, 2007 Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
MHz Posted April 15, 2007 Author Share Posted April 15, 2007 Hate to sound so stupid, but what exactly does it do? and what are call tips?As eltorro shows, a calltip is the popup that informs you of the function with it's parameters to help you as you type. The 2nd line in the popup has the general description of what the function does.The code posted reads through the open script and collects all function's with their parameters and can add it to the User Calltip file used in Scite4AutoIt3.@Dolemite50 and eltorro,Thanks Link to comment Share on other sites More sharing options...
Gcommer Posted April 15, 2007 Share Posted April 15, 2007 Oh, thanks very much! To think i didn't know what those really useful things i see all the time are called... Now that I know exactly what it does, then I think its pure genius! I've wanted to do this for a long time. Link to comment Share on other sites More sharing options...
quaizywabbit Posted April 15, 2007 Share Posted April 15, 2007 Very nice! [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
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