Autohotkey config

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
CapsLock::Ctrl
LControl::^+0
RControl::^+1
RunOrActivate(Target, WinTitle = "")
{
; Get the filename without a path
SplitPath, Target, TargetNameOnly
Process, Exist, %TargetNameOnly%
If ErrorLevel > 0
PID = %ErrorLevel%
Else
Run, %Target%, , , PID
If WinTitle <>
{
SetTitleMatchMode, 2
WinWait, %WinTitle%, , 3
WinActivate, %WinTitle%
}
Else
{
WinWait, ahk_pid %PID%, , 3
WinActivate, ahk_pid %PID%
}
}
~MButton & LButton::
Alt & LButton::
CoordMode, Mouse ; Switch to screen/absolute coordinates.
MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin%
if EWD_WinState = 0 ; Only if the window isn't maximized
SetTimer, EWD_WatchMouse, 10
return
EWD_WatchMouse:
GetKeyState, EWD_LButtonState, LButton, P
if EWD_LButtonState = U
{
SetTimer, EWD_WatchMouse, off
return
}
GetKeyState, EWD_EscapeState, Escape, P
if EWD_EscapeState = D
{
SetTimer, EWD_WatchMouse, off
WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
return
}
CoordMode, Mouse
MouseGetPos, EWD_MouseX, EWD_MouseY
WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
SetWinDelay, -1
WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
EWD_MouseStartX := EWD_MouseX
EWD_MouseStartY := EWD_MouseY
return
!T::WinSet, Style, ^0xC00000, A
#Down::WinMinimize A
#Up::
WinGet MX, MinMax, A
If MX
WinRestore A
Else
WinMaximize A
Return
#Left::
WinRestore A
WinMove A, ,0,0,(A_ScreenWidth/2),A_ScreenHeight-30
Return
#Right::
WinRestore A
WinMove A, ,(A_ScreenWidth/2),0,(A_ScreenWidth/2),A_ScreenHeight-30
Return
#q::WinClose A
#f::RunOrActivate("C:\Program Files\Mozilla Firefox\firefox.exe")
#j::RunOrActivate("C:\Program Files\Pidgin\pidgin.exe")
#1::
IfWinExist ahk_class Emacs
{
WinActivate
}
else
{
Run "C:\Users\alecs\emacs-22.3\bin\runemacs.exe"
WinWait emacs@NIMBUS
WinActivate
}
Return
#IfWinActive, ahk_class MozillaUIWindowClass
{
!1::Send ^1
!2::Send ^2
!3::Send ^3
!4::Send ^4
!5::Send ^5
!6::Send ^6
!7::Send ^7
!8::Send ^8
!9::Send ^9
!0::Send ^0
return
}