tsunami

log in
history

My AutoHotkey script

Luke Breuer
2010-11-03 19:42 UTC
tags: labreuer

; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments.  They are not executed.

; This script has a special filename and path because it is automatically
; launched when you run the program directly.  Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it.  You can have as many .ahk
; files as you want, located in any folder.  You can also run more than
; one ahk file simultaneously and each will get its own tray icon.

; SAMPLE HOTKEYS: Below are two sample hotkeys.  The first is Win+Z and it
; launches a web site in the default browser.  The second is Control+Alt+N
; and it launches a new Notepad window (or activates an existing one).  To
; try out these hotkeys, run AutoHotkey again, which will load this file.

SetTitleMatchMode, RegEx

GroupAdd, PowerShell, PoSh
GroupAdd, SSMS, Microsoft SQL Server Management Studio
GroupAdd, Explorer, ^xplorer
GroupAdd, Firefox, .*Mozilla Firefox
GroupAdd, IRC, ^XChat
GroupAdd, IM, ahk_class gdkWindowToplevel
                 
return

#e:: GroupActivate, Explorer ;Run, "c:\Program Files\zabkat\xplorer2\xplorer2_UC.exe"
#p:: GroupActivate, PowerShell
#s:: GroupActivate, SSMS
#f:: GroupActivate, Firefox
#x:: GroupActivate, IRC
#i:: GroupActivate, IM



#IfWinActive Microsoft SQL Server Management Studio
    ^w::^F4
#IfWinActive

#IfWinActive ahk_class wndclass_desked_gsk
    ^w::^F4
#IfWinActive

;#IfWinActive ahk_class LibronixDLS_Application
;    !d::^g
;#IfWinActive


#IfWinActive ahk_class ThunderRT6FormDC
CtrlStarted = 0
    ~Ctrl:: 
        if (CtrlStarted)
            return
        SetTimer, CtrlDown, 50
        CtrlStarted = 1
        return
    ~Ctrl UP::
        if (!CtrlStarted)
            return
        SetTimer, CtrlDown, off
        CtrlStarted = 0
        return
    
    CtrlDown: 
        ClickCheck(0)
        return

ShiftStarted = 0
    ~Shift:: 
        if (ShiftStarted)
            return
        SetTimer, ShiftDown, 50
        ShiftStarted = 1
        return
    ~Shift UP::
        if (!ShiftStarted)
            return
        SetTimer, ShiftDown, off
        ShiftStarted = 0
        return
    
    ShiftDown: 
        ClickCheck(1)
        return
        
    ClickCheck(requiredState)
    {
        MouseGetPos, , , id, hwnd, 2
        ControlGet, isChecked, Checked, , , ahk_id %hwnd%
        WinGetClass className, ahk_id %hwnd%
        
        if (className != "ThunderRT6CheckBox")
            return
        
        if (isChecked = requiredState)
            ControlClick, , ahk_id %hwnd%

        ; duplicated, for ES2 sort, where one needs to go [x] 1 -> [x] 1D -> [ ]
        ControlGet, isChecked, Checked, , , ahk_id %hwnd%
        
        if (isChecked = requiredState)
            ControlClick, , ahk_id %hwnd%

        return
    }

    ^q::
        SendInput ^q
        WinWait, View SQL Options,,1
        if ErrorLevel
            SoundBeep
        else
            SendInput {Enter}
        return
        
    Esc::
        WinGetActiveTitle, title
        if title = View SQL
            WinClose 
        else
            SendInput {Esc}
        return
    
#IfWinActive


;;
;; expand width by 10 pixels
;;
#IfWinActive, ahk_class ConsoleWindowClass
^UP::
Sleep 100
SendInput ! p
SendInput {TAB}{TAB}
SendInput {UP}{UP}{UP}{UP}{UP}{UP}{UP}{UP}{UP}{UP}
SendInput {TAB}
SendInput {DOWN}{DOWN}
Send {ENTER}
Send {ENTER}
return
#IfWinActive

;;
;; shrink width by 10 pixels
;;
#IfWinActive, ahk_class ConsoleWindowClass
^DOWN::
Sleep 100
SendInput ! p
SendInput {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}
Send {ENTER}
Send {ENTER}
return
#IfWinActive