Jump to content

Automatic help in SCiTe?


Recommended Posts

Lets agree, when reading the answers from all the regulars posting in this thread, it is fair to state that hardly anybody was aware of the existence of FuncPopUp, let alone using it.

So give me one good reason why I would maintain this since we now have the auto Func select and CallTips popping up filling in most of that gap?

oh, and you needing it isn't a good enough reason! ;)

Jos

Exactly, my needing.. I would send you a beer!

Man, thats bad that noone used it.. is it still avaiable in some older versions of scite avaiable on the net?

Link to comment
Share on other sites

#include <IE.au3>

Global $oIE = _IEAttach("AutoIt Help", "Embedded")
If Not IsObj($oIE) Then
    Exit MsgBox(0, "Error", "_IEAttach failed")
EndIf

_HelpNavigate("_IEAttach")

Func _HelpNavigate($Function)
    Local $AutoitInstallDir = StringReplace(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)), " ", "%20")
    Local $Chm = "AutoIt3.chm::/html/functions/"

    If StringLeft($Function, 1) = "_" Then
        $Chm = "UDFs3.chm::/html/libfunctions/"
    EndIf

    Local $Rtn = _IENavigate($oIE, "mk:@MSITStore:" & $AutoitInstallDir & $Chm & $Function & ".htm")

    Return SetError(@error, @extended, $Rtn)
EndFunc   ;==>_HelpNavigate

EDIT:

Of course there are exceptions to the rule, for example Function "Opt()" will not work because internally it's named AutoItSetOption.

There may be more.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • Moderators

Champak.

 

Sorry to jack

Then do not do it next time - start your own thread instead. :naughty:

As you have found, "Toggle all folds" only operates on top-level folds - but clicking on a [+] with Ctrl pressed does fold everything within that section (and I mean everything, including conditional structures, comment blocks, etc). So I usually put a #Region..#Endregion around the whole script which lets me completely contract it with one click. ;)

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

  • Developers

The below example is more or less how FuncPopup worked.

The difference is that FuncPopUp, like Autoit3help.exe, is using a call to HtmlHelp using the HH_DISPLAY_TOC options, which does a lookup in the TOC and doesn't have the issue figuring out the whole URL like the example below.

This works only for internal functions:

#include<guiconstants.au3>
Opt("WinSearchChildren", 1)
Global $WM_COPYDATA = 74
Global $AutoitInstallDir = StringReplace(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)), " ", "%20")
Global $Chm = "AutoIt3.chm::/html/functions/"
; Get SciTE DirectorHandle
$Scite_hwnd = WinGetHandle("DirectorExtension")
; Get My GUI Handle numeric
;mk:@MSITStore:path\filename.chm::\page.chm
; change SciTE window size
WinSetState("[CLASS:SciTEWindow]","",@SW_RESTORE)
WinMove("[CLASS:SciTEWindow]","",0,0,@DesktopWidth, @DesktopHeight / 3 * 2)
Global $oIE = ObjCreate("Shell.Explorer.2")
$h_helpgui = GUICreate("AutoIt3 Helpfile", @DesktopWidth, @DesktopHeight / 3, 0, @DesktopHeight / 3 * 2)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, @DesktopWidth, @DesktopHeight / 3)
$oIE.navigate("mk:@MSITStore:" & $AutoitInstallDir & "AutoIt3.chm::/html/introduction.htm")
GUISetState(@SW_SHOW, $h_helpgui)
$h_helpgui_dec = Dec(StringTrimLeft($h_helpgui, 2))
;Register COPYDATA message.
GUIRegisterMsg($WM_COPYDATA, "MY_WM_COPYDATA")
GUISetState()
;Send Scite Director my GUI handle so it will report info back from SciTE
SendSciTE_Command($h_helpgui_dec, $Scite_hwnd, "identity: " & $h_helpgui_dec)
; Get current word fom SciTE each .5 second
Global $SciTE_Current_Word = ""
AdlibRegister("GetCurrentWord", 500)
;
Do
    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE
Exit
;
; Send command to SciTE
Func SendSciTE_Command($My_Hwnd, $Scite_hwnd, $sCmd)
    ;ConsoleWrite('-->' & $sCmd & @lf )
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
EndFunc   ;==>SendSciTE_Command
;
;
; Received Data from SciTE
Func MY_WM_COPYDATA($hWnd, $msg, $wParam, $lParam)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr', $lparam)
    $SciTECmdLen = DllStructGetData($COPYDATA, 2)
    Local $CmdStruct = DllStructCreate('Char[255]', DllStructGetData($COPYDATA, 3))
    $SciTECmd = StringLeft(DllStructGetData($CmdStruct, 1), $SciTECmdLen)
    ;ConsoleWrite('<--' & $SciTECmd & @lf )
    If StringLeft($SciTECmd, 17) = "macro:stringinfo:" Then
        $SciTE_New_Current_Word = StringMid($SciTECmd, 18)
        If $SciTE_New_Current_Word <> $SciTE_Current_Word Then
            $SciTE_Current_Word = $SciTE_New_Current_Word
            ConsoleWrite('*** SciTE currectword = ' & $SciTE_New_Current_Word & @LF)
            $RC = $oIE.navigate("mk:@MSITStore:" & $AutoitInstallDir & $Chm & $SciTE_New_Current_Word & ".htm")
            ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $RC = ' & $RC & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
        EndIf
    EndIf
EndFunc   ;==>MY_WM_COPYDATA
;
Func GetCurrentWord()
    SendSciTE_Command($h_helpgui_dec, $Scite_hwnd, "askproperty:CurrentWord") ; Runs command.14
EndFunc   ;==>GetCurrentWord

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Sorry to jack, I have a question about scite, when I press toggle all folds, the functions within regions don't collapse. Is there a way to make ALL things fold, or better yet, specify all regions and functions?

 

Its not exactly, what you want, but to toggle region only (#region .. #endregion), you can do so:

Add a new command in your SciTEUser.properties.

# 36 Un/Fold #Region

command.name.36.$(au3)=Toggle Fold #Region

command.36.*.au3=dostring local text = editor:GetText() tReg = {} pos, iEnd = text:find('#[Rr][Ee][Gg][ii][Oo][Nn]')

if pos ~= nil then table.insert(tReg, pos) while true do

pos, iEnd = text:find('#[Rr][Ee][Gg][ii][Oo][Nn]', iEnd)

if pos == nil then break end table.insert(tReg, pos) end

for i=1, #tReg do editor:GotoPos(tReg) editor.CurrentPos = tReg

scite.MenuCommand(IDM_EXPAND) end end

command.mode.36.*=subsystem:lua

command.shortcut.36.*.au3=Ctrl+Alt+R

Best Regards BugFix  

Link to comment
Share on other sites

Then do not do it next time - start your own thread instead. :naughty:

 Don't you hate when people do that lol.

Thank you very much, that idea works perfectly.

BugFix, with your suggestion, does that add an option in one of the taskbar menus? And if so, could I just change "region" to "function" or anything else, and it will toggle whatever else I may want to toggle?

Link to comment
Share on other sites

  • Developers

@Champak,

When you would have tried you know that this line adds the extra option in the Tools dropdown menu: command.name.36.$(au3)=Toggle Fold #Region

Just read trough the code and try to understand what it does.

You would see that it will find all occurrences or #Region, does a "Goto the position of the word" and performs a toggle Fold.

So changing this to do a fold on other words is just a matter of doing a proper Regex.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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