Jump to content

SciTE AutoComplete and CallTips for UDFs


WhiteStar
 Share

Recommended Posts

Hi Melba23

First off... THANKS for all the great UDF's you've made... Been using them and learning heaps from your code for AutotIT.

I whipped together a little script that you may find handy enough to include in the zip file for people. It sets up the calltips etc for Scite.

;  ADMINISTRATOR ACCESS required to excecute operations in Program Files structures !
#RequireAdmin
; Determine Scite Installation to update user defined CallTips/Hovertips for new functions
Local $SciteApp = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\SciTE.exe","")
Local $ScitePath = StringTrimRight($SciteApp, 10)
Local $calltippsPath = $ScitePath & '\api\au3.user.calltips.api'
; next, get correct key pending on architecture
If @OSArch = "X86" Then
    Local $AutoITapp = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutoIt3.exe","")
    Local $AutoITpath = StringTrimRight($AutoITapp, 12)
ElseIf @OSArch = "X64" Then
    Local $AutoITapp = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutoIt3_x64.exe","")
    Local $AutoITpath = StringTrimRight($AutoITapp, 16)
Else
    MsgBox(0, '', 'An error occured: Could not determine OS Architecture')
EndIf
; next place new UDF into Includes
If FileExists($AutoITpath&"\Include\GUIExtender.au3") Then FileCopy($AutoITpath&"\Include\GUIExtender.au3", $AutoITpath&"\Include\GUIExtender.au3"&".bak", 1)
FileCopy(@ScriptDir&"\GUIExtender.au3", $AutoITpath&"\Include\GUIExtender.au3", 1)
; if the Beta is installed, update that as well
If FileExists($AutoITpath&"\Beta\Include\") Then
    If FileExists($AutoITpath&"\Beta\Include\GUIExtender.au3") Then FileCopy($AutoITpath&"\Beta\Include\GUIExtender.au3", $AutoITpath&"\Beta\Include\GUIExtender.au3"&".bak", 1)
    FileCopy(@ScriptDir&"\GUIExtender.au3", $AutoITpath&"\Beta\Include\GUIExtender.au3", 1)
EndIf
;
; New CallTips to be added
Local $newCalltips = _
'_GUIExtender_Init($hWnd, $iOrient = 0) Initialises the GUI containing the sections and sets orientation #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Section_Start($iSection_Coord, $iSection_Size) Marks the start point of GUI section #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Section_End() Marks the end point of GUI section #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Section_Action($iSection, $sText_Extended = "", $sText_Retracted = "", $iX = 0, $iY = 0, $iW = 0, $iH = 0, $iType = 0, $iEventMode = 0) Creates controls to action extension or retraction of GUI sections #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Action($iMsg) Used in GUIGetMsg loops to detect clicks on section action buttons and $GUI_EVENT_RESTORE events #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Restore() Used to reset GUI after a MINIMIZE and RESTORE #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Section_Extend($iSection, $fExtend = True) Actions section extension or retraction programatically or via section action buttons #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Section_State($iSection) Returns current state of section #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Obj_Data($iCID, $oObj) Store additional info on embedded objects #include <GUIExtender.au3>' & @CRLF & _
'_GUIExtender_Clear() Called on GUI deletion to clear the data array ready for a new GUI to be initialised #include <GUIExtender.au3>'
;
; Append in new call tips, safely.
If FileExists($calltippsPath) Then FileCopy($calltippsPath, $calltippsPath & '.bak', 1)
Local $fh = FileOpen($calltippsPath, 1)
If FileWrite($fh, $newCalltips) Then
    MsgBox(0, '', 'Success new CallTips have been added')
Else
    MsgBox(0, '', 'An error occured')
EndIf
FileClose($fh)

~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

Link to comment
Share on other sites

  • Moderators

WhiteStar,

Thanks you for your compliments and the script. However, I notice that the script places the GUIExtender UDF into the normal (and Beta) AutoIt include folder. I would caution against doing this as you will lose any additional includes when you update. Far better to use a user-defined folder to store all your UDFs - AutoIt makes this very easy to do: ;)

Step 1: Create a new folder to hold the additional UDFs - as previously mentioned I would recommend that you do NOT put this folder in the AutoIt install folder (or it will get overwritten when you upgrade).

Step 2: Tell AutoIt about this folder.

- 2a. If you have SciTE4AutoIt3 you can use SciTEConfig - look for the User Include Dir input about 2/3 way down the dialog.

- 2b. If not (and why not? You can download it from here) you need to modify the registry directly as explained on the "Include" page of the Help file:

There is a special registry value that can be created at "HKEY_CURRENT_USERSoftwareAutoIt v3AutoIt" called "Include". It should be a REG_SZ (string) value.

CYA Note: Normal precautions are advised if modifying the registry. :graduated:

Step 3: Use the additional UDFs in the new folder just as you would the standard ones - the syntax is the same with no need to specify the path if you have followed Step 2 above.

And that is it! You can now have a whole folder of modified, downloaded or personal UDFs available to use as easily as the standard set and which will not be lost on upgrade. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks Melba !

I do use the Scite Editor (bit of a change from Notepad++ :graduated: which is what I've used for yrs.) and setup the user_include as you suggested. Excellent capability / function to keep thin gs up to date.

I agree with modding the registry, not something to do lightly or frivolously.

The only question I have left now is the call-tips, which the help file is not that clear on. While moving the UDF's out of the main application it does not address the call-tips / hovertips which are fairly important to preserve as well.

Ohh darn, maybe this should be another thread, as I hate hijacking a thread. If you want or anyone else, delete this & move it if needed.

Thanks in Advance

WS

~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

Link to comment
Share on other sites

  • Moderators

WhiteStar,

This is how you get your user include files to offer CallTips and AutoComplete - as you might expect, the full SciTE4AutoIt3 package makes it easy! :)

Calltips first. These are stored in C:\Program Files\AutoIt3\SciTE\api\au3.user.calltips.api. Just add a line to the page for each function you want to add:

_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.

Now the AutoComplete. Again a special file: C:\Program Files\AutoIt3\SciTE\Properties\au3.userudfs.properties, which should read as follows:

au3.keywords.user.udfs=_function1 _function2 _function3 _function4 \
        _function5 _function6 _function7

Note that the entries are all in lowercase.

Then save all files, close and restart SciTE. You will have AutoComplete when you start typing the UDF function name in a script and syntax CallTips as you enter the parameters! :graduated:

You may have adjust the path if you have installed SciTE elsewhere than the recommended option. These files are not overwritten when you update SciTE so all your hard work to set this up should be a once-only event. Personally I have a written a script to do all this automatically when I add/delete an include to/from my personal UDF folder, but as it is very tightly tailored to my own system I am not releasing it. But all it does in essence is the above, so you could easily write your own. ;)

M23

Edit: Added code tags to get the lines to display properly.

Another edit: To get backslashes into the paths and to clear out all of the rubbish that editing a post inserts into it. I do NOT like the updowngraded editor at all for editing posts. ;)

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi Melba23,

This is wahat i am unable to understand :graduated:

1. I added my function names on "au3.keywords.properties" and placed it on "C:\Program Files\AutoIt3\SciTE\Properties". Now when i type defined functions i get in different colors. But i wanted Calltips .. i don't how to make that ... i am sorry for being such an idiot can you tell me step by step how to make that? you have said that we need to do like below

_Function($param1, $param2, $param3) Explanation of function (Requires: #Include UDF.au3)

But where we have to add this line? in our defined function?

For Example,

If i have my function UDF called Bit.au3

my function in the UDF will be like this..

Func bitlock(@compname)

EndFunc

How do i need to add here?

Sory for the trouble

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

But where we have to add this line?

Which part of:

Calltips first. These are stored in C:\Program Files\AutoIt3\SciTE\api\au3.user.calltips.api. Just add a line to the page for each function you want to add

is not clear? :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Calltips first. These are stored in C:\Program Files\AutoIt3\SciTE\api\au3.user.calltips.api. Just add a line to the page for each function you want to add

Here you are saying right "just add a line to the page..." in which page do i need to add my function name and it requires "xxx.au3"

is my question clear?

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

is my question clear?

Limpid as the morning dew - but I thought my original (and repeated) answer was equally intelligible. I shall make a final attempt to explain what to do with sufficient clarity to penetrate the linguistic fog that appears to have clouded this simple process: :graduated:

Just add a line to the C:Program Files\AutoIt3\SciTE\api\au3.user.calltips.api file - creating it first if required.

Is that clear enough? ;)

M23

Edit: Added the \ - I hate this new editor!

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi Melba23,

This is more than clear! sorry for the trouble.. all this confusion happened to me is because when i opened my au3.calltips.api as notepad it was empty... so i thought we can not edit as notepad..so i thought there may be someother way to do so i just tried to get it... :graduated: but again i failed to double check and even i did not give another try ;) Anyway thanks a lot for your great help ! you rocks once again :)

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...