Sign in to follow this  
Followers 0
clevername47

AutoIt3 Help Extender (for use with SciTE)

1 post in this topic

#1 ·  Posted (edited)

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
#NoTrayIcon
Const $HelpHeight  = 333
Const $PadAtBottom = 53
Const $DisableClick = 0
Const $ClickRectLeft   = 262
Const $ClickRectRight  = @DesktopWidth - 26
Const $ClickRectTop = 67
Const $ClickRectBottom = $HelpHeight - 9
Opt("WinTitleMatchMode",4)
Func escpressed()
    If WinActive("classname=SciTEWindow") or WinActive("AutoIt Help") Then
        WinClose("AutoIt Help")
    Else
        HotKeySet("{esc}")
        Send("{esc}")
        HotKeySet("{esc}","escpressed")
    EndIf
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}")
    EndIf
    If $p[1] >= $HelpHeight Then
        If WinActive("AutoIt Help") Then
            WinActivate("classname=SciTEWindow")
            $c = $DisableClick
        EndIf
    Else
        If WinActive("classname=SciTEWindow") Then
            WinActivate("AutoIt Help")
            $c = $DisableClick
        EndIf
        $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
        EndIf
    EndIf
    WinWaitClose("AutoIt Help", .1)
    If Not WinExists("classname=SciTEWindow") Then WinClose("AutoIt Help")
WEnd
WinSetState("classname=SciTEWindow", "", @SW_MAXIMIZE)
WinActivate("classname=SciTEWindow")

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

Share this post


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
Sign in to follow this  
Followers 0