Added stepping hotkeys for eclipse on a linux vm

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

;#z::Run www.autohotkey.com

;^!n::
;IfWinExist Untitled - Notepad
;	WinActivate
;else
;	Run Notepad
;return

#a::Send Administrator{Tab}Administrator

F1::Send jaimie{Tab}jaimie

!z::
CoordMode, Mouse, Screen
MouseMove, (A_ScreenWidth // 2), (A_ScreenHeight // 2)
return

<^>!]::Send {End}
<^>![::Send {Home}

+<^>!]::Send +{End}
+<^>![::Send +{Home}

; Note: From now on whenever you run AutoHotkey directly, this script
; will be loaded.  So feel free to customize it to suit your needs.

; Please read the QUICK-START TUTORIAL near the top of the help file.
; It explains how to perform common automation tasks such as sending
; keystrokes and mouse clicks.  It also explains more about hotkeys.

;stepping instructions for eclipse
#IfWinActive  ahk_class SWT_Window0
<^>!1:: Send {F5}
<^>!2:: Send {F6}
<^>!3:: Send {F7}
<^>!4:: Send {F8}
#IfWinActive

;stepping instructions for eclipse on linux vm
#IfWinActive  ahk_class QWidget
<^>!1:: Send {F5}
<^>!2:: Send {F6}
<^>!3:: Send {F7}
<^>!4:: Send {F8}
#IfWinActive

;stepping instructions for firebug
#IfWinActive Firebug
<^>!1:: Send {F11}
<^>!2:: Send {F10}
<^>!3:: Send +{F11}
<^>!4:: Send {F8}
#IfWinActive

;stepping instructions for firefox
#IfWinActive ahk_class MozillaWindowClass
<^>!1:: Send {F11}
<^>!2:: Send {F10}
<^>!3:: Send +{F11}
<^>!4:: Send {F8}
#IfWinActive

;stepping instructions for chrome
#IfWinActive ahk_class Chrome_WidgetWin_1
<^>!1:: Send {F11}
<^>!2:: Send {F10}
<^>!3:: Send +{F11}
<^>!4:: Send {F8}
#IfWinActive

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

;#z::Run www.autohotkey.com

;^!n::
;IfWinExist Untitled - Notepad
;	WinActivate
;else
;	Run Notepad
;return

#a::Send Administrator{Tab}Administrator

F1::Send jaimie{Tab}jaimie

!z::
CoordMode, Mouse, Screen
MouseMove, (A_ScreenWidth // 2), (A_ScreenHeight // 2)
return

<^>!]::Send {End}
<^>![::Send {Home}

+<^>!]::Send +{End}
+<^>![::Send +{Home}

; Note: From now on whenever you run AutoHotkey directly, this script
; will be loaded.  So feel free to customize it to suit your needs.

; Please read the QUICK-START TUTORIAL near the top of the help file.
; It explains how to perform common automation tasks such as sending
; keystrokes and mouse clicks.  It also explains more about hotkeys.

;stepping instructions for eclipse
#IfWinActive  ahk_class SWT_Window0
<^>!1:: Send {F5}
<^>!2:: Send {F6}
<^>!3:: Send {F7}
<^>!4:: Send {F8}
#IfWinActive

;stepping instructions for firebug
#IfWinActive Firebug
<^>!1:: Send {F11}
<^>!2:: Send {F10}
<^>!3:: Send +{F11}
<^>!4:: Send {F8}
#IfWinActive

;stepping instructions for firefox
#IfWinActive ahk_class MozillaWindowClass
<^>!1:: Send {F11}
<^>!2:: Send {F10}
<^>!3:: Send +{F11}
<^>!4:: Send {F8}
#IfWinActive

;stepping instructions for chrome
#IfWinActive ahk_class Chrome_WidgetWin_1
<^>!1:: Send {F11}
<^>!2:: Send {F10}
<^>!3:: Send +{F11}
<^>!4:: Send {F8}
#IfWinActive


(commit or discard the untracked or modified content in submodules)    AutoHotkey.ahk    submodules/vim_ahk (modified content, untracked content), from darwin16

; Tips {{{
; #: win
; !: alt
; ^: ctrl
; +: shift
; &: and
; <: only left, >: only right
; *: wildecard
; ~: pass through
; }}}

; Auto-execute section {{{
; Auto execute section is the region before any return/hotkey

; Windows size
TMargin := 5
BMargin := 5
LMargin := 5
RMargin := 5 ; sidebar = 150px
MinSize := 0.7

; For Terminal/Vim
GroupAdd Terminal, ahk_class PuTTY
GroupAdd Terminal, ahk_class mintty ; cygwin
GroupAdd Terminal, ahk_class TMobaXtermForm
GroupAdd Terminal, ahk_class TFormDetachedTab
GroupAdd Terminal, ahk_class ConsoleWindowClass
GroupAdd Terminal, ahk_exe powershell.exe
GroupAdd Terminal, ahk_exe vim.exe
GroupAdd TerminalVim, ahk_group Terminal
GroupAdd TerminalVim, ahk_class Vim

; Vim mode
VimIcon := 1
#Include %A_LineFile%\..\submodules\vim_ahk\vim.ahk

; Auto correct
#Include %A_LineFile%\..\AutoCorrect.ahk

Return
; }}}

;; Basic Settings, HotKeys, Functions {{{
; Settings

#UseHook On ; Make it a bit slow, but can avoid infinitude loop
            ; Same as "$" for each hotkey
#InstallKeybdHook ; For checking key history
                  ; Use ~500kB memory?

#HotkeyInterval 1000 ; Hotkey inteval (default 2000 milliseconds).
#MaxHotkeysPerInterval 100 ; Max hotkeys perinterval (default 50).

; For HHKB
;vkFFsc079::RAlt
;vkFFsc07b::LAlt
vkFFsc079::RCtrl
vkFFsc07b::LCtrl

;; Ref for IME: http://www6.atwiki.jp/eamat/pages/17.html
;; Get IME Status. 0: Off, 1: On
;VIM_IME_GET(WinTitle="A"){
;  ControlGet, hwnd,HWND , , , %WinTitle%
;  if(WinActive(WinTitle)){
;    ptrSize := !A_PtrSize ? 4 : A_PtrSize
;    VarSetCapacity(stGTI, cbSize:=4+4+(PtrSize*6)+16, 0)
;    NumPut(cbSize, stGTI, 0, "UInt") ; DWORD cbSize;
;    hwnd := DllCall("GetGUIThreadInfo", Uint, 0, Uint, &stGTI)
;        ? NumGet(stGTI, 8+PtrSize, "UInt") : hwnd
;  }
;
;  Return DllCall("SendMessage"
;      , UInt, DllCall("imm32\ImmGetDefaultIMEWnd", Uint, hwnd)
;      , UInt, 0x0283  ;Message : WM_IME_CONTROL
;      ,  Int, 0x0005  ;wParam  : IMC_GETOPENSTATUS
;      ,  Int, 0)      ;lParam  : 0
;}
;
;; Get input status. 1: Converting, 2: Have converting window, 0: Others
;VIM_IME_GetConverting(WinTitle="A", ConvCls="", CandCls=""){
;  ; Input windows, candidate windows (Add new IME with "|")
;  ConvCls .= (ConvCls ? "|" : "")                 ;--- Input Window ---
;    .  "ATOK\d+CompStr"                           ; ATOK
;    .  "|imejpstcnv\d+"                           ; MS-IME
;    .  "|WXGIMEConv"                              ; WXG
;    .  "|SKKIME\d+\.*\d+UCompStr"                 ; SKKIME Unicode
;    .  "|MSCTFIME Composition"                    ; Google IME
;  CandCls .= (CandCls ? "|" : "")                 ;--- Candidate Window ---
;    .  "ATOK\d+Cand"                              ; ATOK
;    .  "|imejpstCandList\d+|imejpstcand\d+"       ; MS-IME 2002(8.1)XP
;    .  "|mscandui\d+\.candidate"                  ; MS Office IME-2007
;    .  "|WXGIMECand"                              ; WXG
;    .  "|SKKIME\d+\.*\d+UCand"                    ; SKKIME Unicode
; CandGCls := "GoogleJapaneseInputCandidateWindow" ; Google IME
;
;  ControlGet, hwnd, HWND, , , %WinTitle%
;  if(WinActive(WinTitle)){
;    ptrSize := !A_PtrSize ? 4 : A_PtrSize
;    VarSetCapacity(stGTI, cbSize:=4+4+(PtrSize*6)+16, 0)
;    NumPut(cbSize, stGTI, 0, "UInt")   ;   DWORD   cbSize;
;    hwnd := DllCall("GetGUIThreadInfo", Uint, 0, Uint, &stGTI)
;      ? NumGet(stGTI, 8+PtrSize, "UInt") : hwnd
;  }
;
;  WinGet, pid, PID, % "ahk_id " hwnd
;  tmm := A_TitleMatchMode
;  SetTitleMatchMode, RegEx
;  ret := WinExist("ahk_class " . CandCls . " ahk_pid " pid) ? 2
;      :  WinExist("ahk_class " . CandGCls                 ) ? 2
;      :  WinExist("ahk_class " . ConvCls . " ahk_pid " pid) ? 1
;      :  0
;  SetTitleMatchMode, %tmm%
;  Return ret
;}
;
;; Set IME, SetSts=0: Off, 1: On, return 0 for success, others for non-success
;VIM_IME_SET(SetSts=0, WinTitle="A"){
;  ControlGet, hwnd, HWND, , , %WinTitle%
;  if(WinActive(WinTitle)){
;    ptrSize := !A_PtrSize ? 4 : A_PtrSize
;    VarSetCapacity(stGTI, cbSize:=4+4+(PtrSize*6)+16, 0)
;    NumPut(cbSize, stGTI, 0, "UInt") ; DWORD  cbSize;
;    hwnd := DllCall("GetGUIThreadInfo", Uint, 0, Uint, &stGTI)
;        ? NumGet(stGTI, 8+PtrSize, "UInt") : hwnd
;  }
;
;  Return DllCall("SendMessage"
;    , UInt, DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hwnd)
;    , UInt, 0x0283  ;Message : WM_IME_CONTROL
;    ,  Int, 0x006   ;wParam  : IMC_SETOPENSTATUS
;    ,  Int, SetSts) ;lParam  : 0 or 1
;}

; }}}

; Terminal/Vim {{{
; ESC + IME
#IfWInActive, ahk_group TerminalVim
Esc:: ; Just send Esc at converting.
  if(VIM_IME_GET(A)){
    if(VIM_IME_GetConverting(A)){
      Send, {Esc}
    }else{
      VIM_IME_SET()
    }
  }else{
    Send, {Esc}
  }
Return

^[:: ; Go to Normal mode (for vim) with IME off even at converting.
  if(VIM_IME_GetConverting(A)){
    Send, {Esc}
    Sleep 1 ; wait 1 ms (Need to stop converting)
  }
  if(VIM_IME_GET(A)){
    VIM_IME_SET()
    Send, {Esc}
  }else{
    Send, {Esc}
  }
Return

^m::Send, ^m ; Use Ctrl-m as is
#IfWInActive

; Paste
#IfWInActive, ahk_group Terminal
!v::
  ;StringSplit, strout, clipboard, `n
  ;If(strout0>1 or InStr(clipboard, "sudo")>0){
  ;  MsgBox, 308, Clipboard, %clipboard%`n`n Do you want to paste?
  ;  IfMsgBox, No
  ;  {
  ;    Return
  ;  }
  ;}
  ;SendInput %clipboard%
  ;Return
  Sleep,200
  MouseClick, Right, 50, 50, 1
Return

#IfWInActive
#IfWInActive, ahk_class Vim
!v::Send, {Alt}ep
#IfWInActive

; Command Promp, PowerShell, Bash on Ubuntu on Windows {{{
#IfWinActive ahk_class ConsoleWindowClass
^v::Send, ^q
!v::
  SendInput %clipboard%
Return
#IfWInActive
; }}} Command Prompt

; Other than Terminal/Vim
#IfWInNotActive, ahk_group TerminalVim
^[::Send, {Esc}             ; Always C-[ to ESC, like vim
^d::Send, {Del}             ; Always Delete with C-d
#IfWInNotActive
; }}} Terminal/Vim

; Power Point {{{
#IfWInActive, ahk_class PP12FrameClass

; Subscript/Superscript
^=::Send, ^tb{Enter}
^+=::Send, ^tp{Enter}
; For JP keyboards
;^-::Send, ^tb{Enter}
;^+-::Send, ^tp{Enter}

; Fonts
^!+s::Send, ^tfsymbol{Enter}
^!+a::Send, ^tfarial{Enter}
^!+h::Send, ^tfhelvetica{Enter}
#IfWInActive
; }}} Power Point

; Word {{{
#IfWInActive, ahk_class OpusApp
^=::Send, ^tb{Enter}
^+=::Send, ^tp{Enter}
; for JP keyboards
;^-::Send, ^tb{Enter}
;^+-::Send, ^tp{Enter}
#IfWInActive
; }}} Word

; Explorer {{{
#IfWInActive, ahk_class CabinetWClass
; Next/Previous page
^i::Send, !{Right}
^o::Send, !{Left}
#IfWInActive
; }}} Explorer

; CLCL {{{
;#IfWInActive, ahk_class CLCLMain
#IfWInActive, CLCL ; both window/title do not working...
j::
  Msgbox, clcl_down
  Send, {Down}
Return

K::Send, {Up}
#IfWInActive
; }}} Explorer

; Everthing {{{
#IfWInActive, ahk_class EVERYTHING
Return::
  Send, {Enter}
  Sleep, 200
  IfWinActive, ahk_class EVERYTHING
  {
    Send,{Enter}
    Sleep, 500
  }
  WinActivate, ahk_class EVERYTHING
  Sleep, 200
  Send, {Esc}
Return

#IfWInActive
; }}} Everything

; Fiefox {{{
;#IfWinActive ahk_exe firefox.exe
;^j::Send, ^j
;#IfWInActive
; }}} Firefox

; Global Settings {{{
#if
; Basic Settings {{{

; Suspend
;Esc & Tab::
;  Suspend, Toggle
;  Return
; For Alt-Ctrl Swap (swapped by KeySwap)
LCtrl & Tab::AltTab
Alt & Tab::
  if GetKeyState("Shift","P"){
    Send, ^+{taB} ; dosen't work ()
  }else{
    Send, ^{Tab}
  }
Return

;!m::Send, ^m
;^m::Send, !m
;>^m::Send, !m
;Ctrl & Left::Send, !{Left}
;Ctrl & Right::Send, !{Right}

; Virtual desktop
^!+h::Send, #^{Left}
^!+l::Send, #^{Right}

; Cortana
!^f::Send, #s

; CLCL
#c::Send, !c

; Other basic settings
!Space::Send, {vkF3sc029} ; IME by A-Space
^Space::Send, {vkF3sc029} ; IME by C-Space
;{vkF3sc029}               ; 変換
;{vk1Dsc07B}               ; 無変換
!^a::Send, !{Space}n       ; Minimize window
!4::Send, !{F4}           ; Close window
^4::Send, !{F4}           ; Close window
!d::Send, {Del}           ; Always Delete with A-d
;^o::Send,!{Left}          ; Go to previous page
;^i::Send,!{Right}         ; Go to nexe page
^Space::!`                ; IME

^h::Send, {BS}            ; Always BS with C-h
;^h::
;  While GetKeyState("h","p"){
;    Send {BS}
;    TrayTip,Start:,%n%,10,,
;    Sleep 50
;  }
;  return

;^j::Send,{Enter}      ; C-j to Enter

; For HHKB
; ESC to ` like normal keyboard (ESC is placed on the left of 1 in HHKB)
!1::!`                ; IME
; }}} Basic Settings

; Cursor, Mouse, Window move/size {{{
; Cursor {{{
!^h::Send, {Left}
!^j::Send, {Down}
!^k::Send, {Up}
!^l::Send, {Right}
; }}} Cursor

; Mouse {{{
; Mouse Move
^+h::MouseMove, -10, 0, 0, R
^+j::MouseMove, 0, 10, 0, R
^+k::MouseMove, 0, -10, 0, R
^+l::MouseMove, 10, 0, 0, R

; Click
^+n::MouseClick, Left
^+p::MouseClick, Right
; Right click on current window

; Mouse wheel
!^m::MouseClick, WheelDown, , , 2
!^,::MouseClick, WheelUp, , , 2
; }}} Mouse

; Window move {{{

; Move a little
^+y::
  WinGetPos, X, Y, , , A ;A for Active Window
  WinMove, A, ,X-20, Y,
Return

^+u::
  WinGetPos, X, Y, , , A
  WinMove, A, , X, Y+20
Return

^+i::
  WinGetPos, X, Y, , , A
  WinMove, A, , X, Y-20
Return

^+o::
  WinGetPos, X, Y, , , A
  WinMove, A, , X+20, Y
Return

; Move to a different screen
!^+y:: Send, #+{Left}
!^+u:: Send, #+{Down}
!^+i:: Send, #+{Up}
!^+o:: Send, #+{Right}

; }}} Window move

; Window size {{{

; Almost full
^!Enter::
!+Enter::
  ;WinGetPos, X, Y, W, H, Program Manager ; Full Desktop
  ;Msgbox, Pos At %X% %Y% %W% %H%
  SysGet, MWA, MonitorWorkArea ; w/o Taskbar
  ;Msgbox, %MWALeft% %MWATop% %MWARight% %MWABottom%
  WinMove, A, , MWALeft+LMargin, MWATop+TMargin
    , MWARight-MWALeft-LMargin-RMargin
    , MWABottom-MWATop-TMargin-BMargin
Return

; Minsize
^!+Enter::
  SysGet, MWA, MonitorWorkArea ; w/o Taskbar
  WinMove, A, , MWALeft+LMargin, MWATop+TMargin
    , (MWARight-MWALeft-LMargin-RMargin)*Minsize
    , (MWABottom-MWATop-TMargin-BMargin)*Minsize
Return

; Half size
!+h::
  SysGet, MWA, MonitorWorkArea ; w/o Taskbar
  WinMove, A, , MWALeft+LMargin, MWATop+TMargin
    , (MWARight-MWALeft-LMargin-RMargin)*0.5
    , MWABottom-MWATop-TMargin-BMargin
Return

!+j::
  SysGet, MWA, MonitorWorkArea ; w/o Taskbar
  WinMove, A, , MWALeft+LMargin
    , MWATop+(MWABottom-MWATop)*0.5
    , MWARight-MWALeft-LMargin-RMargin
    , (MWABottom-MWATop-TMargin-BMargin)*0.5
Return

!+k::
  SysGet, MWA, MonitorWorkArea ; w/o Taskbar
  WinMove, A, , MWALeft+LMargin, MWATop+TMargin
    , MWARight-MWALeft-LMargin-RMargin
    , (MWABottom-MWATop-TMargin-BMargin)*0.5
Return

!+l::
  SysGet, MWA, MonitorWorkArea ; w/o Taskbar
  WinMove, A, , MWALeft+(MWARight-MWALeft)*0.5
    , MWATop+TMargin
    , (MWARight-MWALeft-LMargin-RMargin)*0.5
    , MWABottom-MWATop-TMargin-BMargin
Return

; Resize
!+y::
  WinGetPos, X, Y, W, H, A
  WinMove, A, ,X, Y, W-20, H
Return

!+u::
  WinGetPos, X, Y, W, H, A
  WinMove, A, ,X, Y, W, H+20
Return

!+i::
  WinGetPos, X, Y, W, H, A
  WinMove, A, ,X, Y, W, H-20
Return

!+o::
  WinGetPos, X, Y, W, H, A
  WinMove, A, ,X, Y, W+20, H
Return

; }}} Window size
; }}} Cursor, Mouse, Window move
; }}} Global Settings


Create mute-hangout.ahk

Create mute-hangout.ahk


[chore] unassign unused variables

[chore] unassign unused variables

; Autohotkey configuration file
; AHK Version v.1.1.32.00
; Franklin Chou (franklin.chou@nelsonmullins.com)
; 22 Mar. 2020
; Tested to work on Lenovo X1 Yoga, Gen. 4

#SingleInstance Force
#Persistent

GLOBAL_DEBUG_MODE := 0
Return

CapsLock::Ctrl
LCtrl::Return
; LCtrl::CapsLock

; DEBUG TOOLS -----------------------------------------------------------------

#c::
  If(GLOBAL_DEBUG_MODE > 0) {
    WinGetClass, title, A
    MsgBox %title%
  }
Return

f12::
  If(GLOBAL_DEBUG_MODE > 0) {
    Reload
  }
Return

; SYSTEM ----------------------------------------------------------------------

; Access different windows of the same group
!`::
  WinGet, process_name, ProcessName, A ; get the active window's process name
  process_windows := GetWindowsOfProcess(process_name)

  n_process_windows := process_windows.Length()

  index := 1 ; AHK arrays are 1 indexed
  While(GetKeyState("Alt", "P")) {
    If (GetKeyState("``", "P")) {
      If (index < n_process_windows) {
        index := index + 1
      } Else {
        index := 1
      }
      active_id := process_windows[index]
      WinActivate, ahk_id %active_id%
    }
  }

  index := ""
  process_windows := ""
  n_process_windows := ""
Return

; Get the window ids of all the processes under that process name
GetWindowsOfProcess(process_name) {
  ids := Array()
  WinGet, window_ids, List ; get the IDs for all running windows
  Loop %window_ids% {
    id := window_ids%A_Index%
    WinGetTitle, title, ahk_id %id%
    WinGet, a_process_name, ProcessName, ahk_id %id%
    ; only include windows with visible title
    If (title && a_process_name = process_name) {
      ids.Push(id)
    }
  }
  Return, ids
}

; TIMEKEEPER ------------------------------------------------------------------

; Shift focus to the timekeeper app
#!e::
  timekeeper_app := WinExist("ahk_class WindowsForms10.Window.8.app.0.262fb3d")
  If(timekeeper_app > 0) {
    WinActivate, ahk_id %timekeeper_app%
  } Else {
    Run, DTE.exe, C:\Program Files (x86)\DTEAxiom
  }
Return

; Start the timer on the selected item in the daily view
#IfWinActive ahk_class WindowsForms10.Window.8.app.0.262fb3d
  >+s::
    WinGetActiveTitle, active_title
    match_result := RegExMatch(active_title, "^Entries for")
    ; each item in the dropdown is approximately 25 pixels
    ; so item 4 (Start Timer) is 100 pixels down from the context menu
    drop_down := 100
    If(match_result > 0) {
      WinMove, 100, 100
      MouseMove, 100, 280
      Send {RButton}
      Sleep, 10 ; need to sleep to allow submenu time to come up
      MouseMove, 170, 300 + drop_down
      Send {LButton}
    }
Return

; MSOFFICE --------------------------------------------------------------------

; Let the print screen key open the application options key (for spell check)
; Word and Outlook
#If WinActive("ahk_class OpusApp") || WinActive("ahk_class rctrl_renwnd32")
  PrintScreen::AppsKey
Return

; This ridiculous keymapping is care of Lenovo
; which maps F12 to some bloatware keyboard manager utility
#If WinActive("ahk_class OpusApp") || WinActive("ahk_class XLMAIN")
  F12::
    Send {F12}
Return

; WORD ONLY -------------------------------------------------------------------

; Cycle through types of markup
#If WinActive("ahk_class OpusApp")
  >+m::
    Send !r
    Sleep, 10
    Send td
    Send {Down}
    Send {Enter}
Return

; Bring up the tab stop modification dialogue
#If WinActive("ahk_class OpusApp")
  >+t::
    Send !h
    Send pg
    Send !t
Return

; Autohotkey configuration file
; AHK Version v.1.1.32.00
; Franklin Chou (franklin.chou@nelsonmullins.com)
; 22 Mar. 2020
; Tested to work on Lenovo X1 Yoga, Gen. 4

#SingleInstance Force
#Persistent

GLOBAL_DEBUG_MODE := 0
Return

CapsLock::Ctrl
LCtrl::Return
; LCtrl::CapsLock

; DEBUG TOOLS -----------------------------------------------------------------

#c::
  If(GLOBAL_DEBUG_MODE > 0) {
    WinGetClass, title, A
    MsgBox %title%
  }
Return

f12::
  If(GLOBAL_DEBUG_MODE > 0) {
    Reload
  }
Return

; SYSTEM ----------------------------------------------------------------------

; Access different windows of the same group
!`::
  WinGet, process_name, ProcessName, A ; get the active window's process name
  process_windows := GetWindowsOfProcess(process_name)

  n_process_windows := process_windows.Length()

  index := 1 ; AHK arrays are 1 indexed
  While(GetKeyState("Alt", "P")) {
    If (GetKeyState("``", "P")) {
      If (index < n_process_windows) {
        index := index + 1
      } Else {
        index := 1
      }
      active_id := process_windows[index]
      WinActivate, ahk_id %active_id%
    }
  }

  index := ""
Return

; Get the window ids of all the processes under that process name
GetWindowsOfProcess(process_name) {
  ids := Array()
  WinGet, window_ids, List ; get the IDs for all running windows
  Loop %window_ids% {
    id := window_ids%A_Index%
    WinGetTitle, title, ahk_id %id%
    WinGet, a_process_name, ProcessName, ahk_id %id%
    ; only include windows with visible title
    If (title && a_process_name = process_name) {
      ids.Push(id)
    }
  }
  Return, ids
}

; TIMEKEEPER ------------------------------------------------------------------

; Shift focus to the timekeeper app
#!e::
  timekeeper_app := WinExist("ahk_class WindowsForms10.Window.8.app.0.262fb3d")
  If(timekeeper_app > 0) {
    WinActivate, ahk_id %timekeeper_app%
  } Else {
    Run, DTE.exe, C:\Program Files (x86)\DTEAxiom
  }
Return

; Start the timer on the selected item in the daily view
#IfWinActive ahk_class WindowsForms10.Window.8.app.0.262fb3d
  >+s::
    WinGetActiveTitle, active_title
    match_result := RegExMatch(active_title, "^Entries for")
    ; each item in the dropdown is approximately 25 pixels
    ; so item 4 (Start Timer) is 100 pixels down from the context menu
    drop_down := 100
    If(match_result > 0) {
      WinMove, 100, 100
      MouseMove, 100, 280
      Send {RButton}
      Sleep, 10 ; need to sleep to allow submenu time to come up
      MouseMove, 170, 300 + drop_down
      Send {LButton}
    }
Return

; MSOFFICE --------------------------------------------------------------------

; Let the print screen key open the application options key (for spell check)
; Word and Outlook
#If WinActive("ahk_class OpusApp") || WinActive("ahk_class rctrl_renwnd32")
  PrintScreen::AppsKey
Return

; This ridiculous keymapping is care of Lenovo
; which maps F12 to some bloatware keyboard manager utility
#If WinActive("ahk_class OpusApp") || WinActive("ahk_class XLMAIN")
  F12::
    Send {F12}
Return

; WORD ONLY -------------------------------------------------------------------

; Cycle through types of markup
#If WinActive("ahk_class OpusApp")
  >+m::
    Send !r
    Sleep, 10
    Send td
    Send {Down}
    Send {Enter}
Return

; Bring up the tab stop modification dialogue
#If WinActive("ahk_class OpusApp")
  >+t::
    Send !h
    Send pg
    Send !t
Return


Fix vim starting directory.

Fix vim starting directory.

;-==============================================================================
;          File: autohotkey.ahk
;        Author: Pedro Ferrari
;       Created: 09 Apr 2014
; Last Modified: 17 May 2014
;   Description: Autohotkey configuration file
;===============================================================================
; Preamble {{{

#NoEnv
#NoTrayIcon
SendMode Input
SetTitleMatchMode, 2   ; Window title can contain WinTitle anywhere

; Reload this script
^#r::
    Msgbox, 4,, Do you want to reload autohotkey script?
    IfMsgBox Yes
    {
        Reload
    }
    Return

 ; }}}
; Window handling {{{

LeftHalfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=(areaBottom-areaTop)

	WinRestore, A
	WinMove, A, , 0, 0,%w%,%h%
}

RightHalfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=(areaBottom-areaTop)

	WinRestore, A
	WinMove, A, , w, 0, w, h
}

TopHalfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=(areaRight-areaLeft)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , 0, 0, w, h
}

BottomHalfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=(areaRight-areaLeft)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , 0, h, w, h
}

TopLeftQuarterfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , 0, 0,%w%,%h%
}

BottomLeftQuarterfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , 0, h, w, h
}

TopRightQuarterfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , w, 0, w, h
}

BottomRightQuarterfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , w, h, w, h
}

MiddleWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , w/2, h/2, w, h
}

; Mapppings
^#Left::  LeftHalfWindow()  ; Default in Windows 8 is #Left
^#Right:: RightHalfWindow() ; Default in Windows 8 is #Right
^#Up::   TopHalfWindow()
^#Down:: BottomHalfWindow()
^#1:: TopLeftQuarterfWindow()
^#2:: BottomLeftQuarterfWindow()
^#3:: TopRightQuarterfWindow()
^#4:: BottomRightQuarterfWindow()
^#5:: MiddleWindow()

; }}}
; Run or activate app and kill process {{{

RoA(WinTitle, Target, WorkingDir = "%A_WorkinDir%", Size = "max") {
    IfWinExist, %WinTitle%
    {
		WinActivate, %WinTitle%
    }
	else
    {
		Run, %Target%, %WorkingDir% ,%Size%
        WinWait, %WinTitle%, , 2
        WinActivate, %WinTitle%
    }
}
^#i:: RoA("Pentadactyl", "C:\Program Files (x86)\Mozilla Firefox\firefox.exe")
^#m:: RoA("Mozilla Thunderbird", "thunderbird")
^#v:: RoA("GVIM", "gvim", "C:\OD\Users\Pedro\vimfiles")
^#s:: RoA("Skype", "C:\Program Files (x86)\Skype\Phone\Skype.exe",,"")
^#e:: RoA("Excel", "excel")
^#w:: RoA("Word", "winword")
^#t:: RoA("cmd.exe", "cmd",,"")
^#p:: RoA("Paint", "mspaint",,"")

; Kill active window process (useful to close apps like Skype)
; FIXME: Doesn't close system tray icon ;
^#k::
    WinGet, PID, PID, % "ahk_id " WinExist("A")
    Process, Close, %PID%
    Return

; }}}
; Toggle hidden files {{{

#IfWinActive ahk_class CabinetWClass
    ^h::
    RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
    If HiddenFiles_Status = 2
        RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
    Else
        RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
    Send, {F5}
    Return
#IfWinActive

; }}}
; Active window screenshot {{{

^#Printscreen::
    FormatTime,CurrentTime,%A_Now%,dd-MM-yyyy_HH-mm-ss
    image_name=%A_desktop%\screenshot-%CurrentTime%.png
    Send !{Printscreen}  ; Alt-Print takes screenshot of active window in W 8.1
    RoA("Paint", "mspaint","")
    Send ^v
    Send ^s
    WinWait Save As
    WinActivate
    Send %image_name%{enter}
    Sleep 100
    WinWaitClose Save As
    Send !{F4}
    Return

; }}}
; Miscellaneous {{{

; Close applications Unix/Mac style
^q:: Send !{F4}

; Empty recycle bin
^#b::
    Msgbox, 4,, Do you want to empty the recycle bin?
    IfMsgBox Yes
    {
        FileRecycleEmpty
        ; MsgBox, The recycle bin has been emptied.
    }
    Return

; Shutdown and reboot (using Win+shift combination) (note: we can do this in two
; steps with Alt-F4 and Ctrl-q)
#+p:: Shutdown, 8
#+r:: Shutdown, 2

; }}}

;-==============================================================================
;          File: autohotkey.ahk
;        Author: Pedro Ferrari
;       Created: 09 Apr 2014
; Last Modified: 17 May 2014
;   Description: Autohotkey configuration file
;===============================================================================
; Preamble {{{

#NoEnv
#NoTrayIcon
SendMode Input
SetTitleMatchMode, 2   ; Window title can contain WinTitle anywhere

; Reload this script
^#r::
    Msgbox, 4,, Do you want to reload autohotkey script?
    IfMsgBox Yes
    {
        Reload
    }
    Return

 ; }}}
; Window handling {{{

LeftHalfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=(areaBottom-areaTop)

	WinRestore, A
	WinMove, A, , 0, 0,%w%,%h%
}

RightHalfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=(areaBottom-areaTop)

	WinRestore, A
	WinMove, A, , w, 0, w, h
}

TopHalfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=(areaRight-areaLeft)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , 0, 0, w, h
}

BottomHalfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=(areaRight-areaLeft)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , 0, h, w, h
}

TopLeftQuarterfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , 0, 0,%w%,%h%
}

BottomLeftQuarterfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , 0, h, w, h
}

TopRightQuarterfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , w, 0, w, h
}

BottomRightQuarterfWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , w, h, w, h
}

MiddleWindow()
{
	SysGet, area, MonitorWorkArea
	w:=((areaRight-areaLeft)/2)
	h:=((areaBottom-areaTop)/2)

	WinRestore, A
	WinMove, A, , w/2, h/2, w, h
}

; Mapppings
^#Left::  LeftHalfWindow()  ; Default in Windows 8 is #Left
^#Right:: RightHalfWindow() ; Default in Windows 8 is #Right
^#Up::   TopHalfWindow()
^#Down:: BottomHalfWindow()
^#1:: TopLeftQuarterfWindow()
^#2:: BottomLeftQuarterfWindow()
^#3:: TopRightQuarterfWindow()
^#4:: BottomRightQuarterfWindow()
^#5:: MiddleWindow()

; }}}
; Run or activate app and kill process {{{

RoA(WinTitle, Target, WorkingDir = "%A_WorkinDir%", Size = "max") {
    IfWinExist, %WinTitle%
    {
		WinActivate, %WinTitle%
    }
	else
    {
		Run, %Target%, %WorkingDir% ,%Size%
        WinWait, %WinTitle%, , 2
        WinActivate, %WinTitle%
    }
}
^#i:: RoA("Pentadactyl", "C:\Program Files (x86)\Mozilla Firefox\firefox.exe")
^#m:: RoA("Mozilla Thunderbird", "thunderbird")
^#v:: RoA("GVIM", "gvim", "C:\OD\Users\Pedro")
^#s:: RoA("Skype", "C:\Program Files (x86)\Skype\Phone\Skype.exe",,"")
^#e:: RoA("Excel", "excel")
^#w:: RoA("Word", "winword")
^#t:: RoA("cmd.exe", "cmd",,"")
^#p:: RoA("Paint", "mspaint",,"")

; Kill active window process (useful to close apps like Skype)
; FIXME: Doesn't close system tray icon ;
^#k::
    WinGet, PID, PID, % "ahk_id " WinExist("A")
    Process, Close, %PID%
    Return

; }}}
; Toggle hidden files {{{

#IfWinActive ahk_class CabinetWClass
    ^h::
    RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
    If HiddenFiles_Status = 2
        RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
    Else
        RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
    Send, {F5}
    Return
#IfWinActive

; }}}
; Active window screenshot {{{

^#Printscreen::
    FormatTime,CurrentTime,%A_Now%,dd-MM-yyyy_HH-mm-ss
    image_name=%A_desktop%\screenshot-%CurrentTime%.png
    Send !{Printscreen}  ; Alt-Print takes screenshot of active window in W 8.1
    RoA("Paint", "mspaint","")
    Send ^v
    Send ^s
    WinWait Save As
    WinActivate
    Send %image_name%{enter}
    Sleep 100
    WinWaitClose Save As
    Send !{F4}
    Return

; }}}
; Miscellaneous {{{

; Close applications Unix/Mac style
^q:: Send !{F4}

; Empty recycle bin
^#b::
    Msgbox, 4,, Do you want to empty the recycle bin?
    IfMsgBox Yes
    {
        FileRecycleEmpty
        ; MsgBox, The recycle bin has been emptied.
    }
    Return

; Shutdown and reboot (using Win+shift combination) (note: we can do this in two
; steps with Alt-F4 and Ctrl-q)
#+p:: Shutdown, 8
#+r:: Shutdown, 2

; }}}