Jump to content

AutoIt3 Help Extender (for use with SciTE)

Recommended Posts

This script has improved my efficiency in writing AutoIt scripts greatly. It's for SciTE but you could probably use it with other editors pretty easily if they use the same help system.

To use:

-Compile it to KeyHH.exe (change some of the constants if you want)

-Rename KeyHH.exe in the AutoIt directory to _KeyHH.exe

-Drop the compiled KeyHH.exe in there, and use help from SciTE like normal

;AutoIt Help Extender
;Features of this script:
; -Tile windows when help is requested in SciTE
; -Automatically activate the proper window based on mouse position
; -Click on the IE control in the help viewer on certain conditions so you can scroll immediately (set $DisableClick = 1 to disable)
; -Close help on ESC if SciTE or help is active, otherwise just send ESC
; -Close help if SciTE closes
Const $HelpHeight  = 333
Const $PadAtBottom = 53
Const $DisableClick = 0
Const $ClickRectLeft   = 262
Const $ClickRectRight  = @DesktopWidth - 26
Const $ClickRectTop = 67
Const $ClickRectBottom = $HelpHeight - 9
Func escpressed()
    If WinActive("classname=SciTEWindow") or WinActive("AutoIt Help") Then
        WinClose("AutoIt Help")
EndFunc  ;==>escpressed

Run("_KeyHH.exe " & $CmdLineRaw)
WinWaitActive("AutoIt Help")
$s = HotKeySet("{ESC}", "escpressed")
WinSetState("classname=SciTEWindow", "", @SW_RESTORE)
WinMove("classname=SciTEWindow", "", 0, $HelpHeight, @DesktopWidth, @DesktopHeight - $HelpHeight - $PadAtBottom)
WinSetState("AutoIt Help", "", @SW_RESTORE)
WinMove("AutoIt Help", "", 0, 0, @DesktopWidth, $HelpHeight)
$c = $DisableClick
While WinExists("AutoIt Help")
    $p = MouseGetPos()
    If (WinActive("classname=SciTEWindow") Or WinActive("AutoIt Help")) And Not $s Then
        $s = HotKeySet("{ESC}", "escpressed")
    ElseIf $s and not (WinActive("classname=SciTEWindow") Or WinActive("AutoIt Help")) Then
        $s = not HotKeySet("{ESC}")
    If $p[1] >= $HelpHeight Then
        If WinActive("AutoIt Help") Then
            $c = $DisableClick
        If WinActive("classname=SciTEWindow") Then
            WinActivate("AutoIt Help")
            $c = $DisableClick
        $p = MouseGetPos()
        If $p[0] >= $ClickRectLeft And $p[1] >= $ClickRectTop And $p[0] <= $ClickRectRight And $p[1] <= $ClickRectBottom And Not $c And WinActive("AutoIt Help") Then
            MouseClick("left", $ClickRectRight, $ClickRectBottom, 1, 0)
            MouseMove($p[0], $p[1], 0)
            WinMove("classname=SciTEWindow", "", 0, $HelpHeight, @DesktopWidth, @DesktopHeight - $HelpHeight - $PadAtBottom)
            WinMove("AutoIt Help", "", 0, 0, @DesktopWidth, $HelpHeight)
            WinActivate("AutoIt Help")
            $c = 1
    WinWaitClose("AutoIt Help", .1)
    If Not WinExists("classname=SciTEWindow") Then WinClose("AutoIt Help")
WinSetState("classname=SciTEWindow", "", @SW_MAXIMIZE)

I tried putting this code in AutoIt3Help.au3 and compiling it into that exe, which is the one SciTE directly calls when you press F1. That approach didn't work nearly as well, and it had a lot of problems when there was already a help window open and you pressed F1 again.

Edit: Made a few minor changes

Edited by cameltoe47
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...