Here is a completed example script:
Code:
/*
HEM Shortcuts
Features:
- Replayer hotkeys
- XButton1 and 2 (side buttons) to skip through hands
- Mouse wheel to step through the action
- Middle button to start/stop the replayer
- right mouse button + scroll wheel changes speed
- h - to open the hand history viewer
- c - to copy the HH to clipboard
- m - marks (or unmarks if previously marked) a hand
- Escape to close window
- On the mini hand history review (both ingame and from hand review)
- Esc - closes window
- m - marks/unmarks hand
- c - copies hand to clipboard
- up/down cycles through hands
- on the notes window
- ESC
- this overrides the default behaviour (save) so that now
- if the text is blank, it clicks cancel - i.e. no changes are saved
the result is if you leave a note blank, it wont be saved with a note icon
- if there is text, then 'save' is clicked.
- alt-s forces a save (to save a blank with the icon)
- alt-x clears, and saves (so the note and icon are both blanked)
- alt-F1-F4 this changes the note icon to a specified note. Currently i have
this set to icons 1, 4, 6 and 8 (black, green, yellow and red), but it's easy
to add and change as required.
- Window movement of notes window and hand history window to a new location
and focuses the window (on notes txt box) after move
KnownIssues:
-
Notes:
-
ToDo:
- quick copy to clipboard shortcut in the hand list
- quick upload to weaktight.com
*/
; SETUP AND CONFIGURATION WHAT HO
; --------------------------------------------------------
;Script configuration
#NoEnv
#SingleInstance force
#Include %a_scriptDir%
SendMode Input
SetWorkingDir %a_scriptDir%
; Changes these to pixel x/y and width/height for the handhistory and notes windows
HANDHISTORY_X := 1210
HANDHISTORY_Y := 120
NOTES_X := 1210
NOTES_Y := 120
NOTES_W := 230
NOTES_H := 340
; Frequency to check for new windows to move them
SetTimer MoveWindowsLoop, 250
; Identifiers for each window.
GroupAdd, Replayer, Holdem Manager Replayer
GroupAdd, MiniHistories, , 2+2 ; Mini history titles change depending on if it's ingame or in replayer. We use the 2+2 button as an identifier.
GroupAdd, Notes, , asdfas ; In my version, the hidden text "asdfas" identifies all note window. Not sure if this is the case for versions, and may break in the future!
; note id consts
TOTAL_NOTES := 23
NOTES_PER_ROW := 8
ICON_WIDTH := 20
ICON_HEIGHT := 20
;Menu Tray, Icon, hemshortcuts.ico ;make yourself a nice little icon and put it in the same location as the ahk script
return
; HOTKEYS
; --------------------------------------------------------
; Hotkeys for the replayer
#IfWinActive, ahk_group Replayer
Right::
XButton2::
replayerChangeHand()
return
Left::
XButton1::
replayerChangeHand(true)
return
Up::
MButton::
replayerStartStop()
return
WheelUp::
replayerMoveAction()
return
WheelDown::
replayerMoveAction(true)
return
RButton & WheelDown::
replayerChangeSpeed(true)
return
RButton & WheelUp::
replayerChangeSpeed()
return
h::
replayerClickHistory()
return
c::
replayerClickHistory()
historyCopyText()
historyClose()
WinActivate, ahk_group Replayer
return
m::
replayerClickHistory()
historyMark()
historyClose()
WinActivate, ahk_group Replayer
return
Esc::
WinClose, ahk_group Replayer
return
; MINI-HAND HISTORY HOTKEYS
; --------------------------------------------------------
#IfWinActive, ahk_group MiniHistories
Esc::
historyClose()
return
RButton & XButton1::
m::
historyMark()
return
c::
historyCopyText()
return
Up::
historyChangeHand()
return
Down::
historyChangeHand(true)
return
; NOTES HOTKEYS
; --------------------------------------------------------
#IfWinActive, ahk_group Notes
Esc::
if (noteGetText()) {
noteSave()
} else {
noteCancel()
}
return
!s::
noteSave()
return
!x::
noteClear()
noteSave()
return
!F1::
selectNoteIcon(1)
return
!F2::
selectNoteIcon(4)
return
!F3::
selectNoteIcon(6)
return
!F4::
selectNoteIcon(8)
return
#IfWinActive, ahk_class PokerStarsTableFrameClass
!h::
hudClickLastHand(190, 40)
return
!m::
hudClickLastHand(190, 40)
historyMark()
historyClose()
return
; NOTES HOTKEYS
; --------------------------------------------------------
; WINDOW MOVEMENT
MoveWindowsLoop:
WinGet, id, ID, ahk_group MiniHistories
if (id) {
if (!movedhistory) {
movedhistory := true
WinMove ahk_id %id%,, %HANDHISTORY_X%, %HANDHISTORY_Y%
WinActivate, ahk_id %id%
}
} else {
movedhistory := false
}
WinGet, id, ID, ahk_group Notes
if (id) {
if (!movednotes) {
movednotes := true
WinMove ahk_id %id%,, %NOTES_X%, %NOTES_Y%, %NOTES_W%, %NOTES_H%
WinActivate, ahk_id %id%
}
} else {
movednotes := false
}
return
; REPLAYER FUNCTIONS
; All functions assume the active window is the replayer
; --------------------------------------------------------
; jumps either forward or back a hand
replayerChangeHand(goback=false) {
SetTitleMatchMode, 3
button := goback ? "<" : ">"
ControlGet, v, Visible, , ||
if (v) {
ControlClick, ||
ControlClick, %button%
ControlClick, GO
} else {
ControlClick, %button%
}
SetTitleMatchMode, 1
}
; Starts/stops the replayer
replayerStartStop() {
SetTitleMatchMode, 3
ControlGet, v, Visible, , ||
if (v) {
ControlClick, ||
} else {
ControlClick, GO
}
SetTitleMatchMode, 1
}
; Moves forwards and backwards in the action of the hand
replayerMoveAction(goback=false) {
if goback
ControlClick X186 Y596
else
ControlClick X474 Y597
}
; ; Changes the playback speed - set down to reduce speed.
replayerChangeSpeed(down=false) {
if down
ControlSend, WindowsForms10.msctls_trackbar32.app.0.33c0d9d1, {Down}, A
else
ControlSend, WindowsForms10.msctls_trackbar32.app.0.33c0d9d1, {Up}, A
}
; Opens the hand history viewer
replayerClickHistory() {
If (!WinExist("ahk_group MiniHistories")) {
MouseGetPos, x, y
Click, 64, 105
MouseMove, x, y, 0
WinWait, ahk_group MiniHistories, , 2
}
}
; MINI HANDHISTORY FUNCTIONS
; --------------------------------------------------------
; Clicks the "txt" button to copy text to clipboard
historyCopyText() {
SetControlDelay -1
clipboard := ""
ControlClick, Txt, ahk_group MiniHistories
ClipWait, 2
}
; Closes the history window
historyClose() {
WinClose, ahk_group MiniHistories
}
; Toggles the hand mark
historyMark() {
SetControlDelay -1
ControlClick, Button4, ahk_group MiniHistories
}
; Moves to the next or previous hand
historyChangeHand(prev=false) {
d := prev ? "{Down}" : "{Up}"
ControlFocus, ComboBox1, A
Send % d
}
; NOTES FUNCTIONS
; All functions assume note is active window
; --------------------------------------------------------
; Get the note text from window
noteGetText() {
ControlGetText, txt, RichEdit20A1, A
return txt
}
; Clicks the cancel button
noteCancel() {
SetControlDelay -1
ControlClick, Cancel, A
}
; Clicks the save button
noteSave() {
SetControlDelay -1
ControlClick, Save, A
}
; Clicks the clear button
noteClear() {
SetcontrolDelay -1
ControlClick, Clear
}
; Selects a specific note icon. Function takes icon - this
; should be a numerical value from 1 up to 23.
selectNoteIcon(icon) {
global TOTAL_NOTES, NOTES_PER_ROW, ICON_WIDTH, ICON_HEIGHT
SetcontrolDelay -1
ControlClick, Button4, A
y := 2 + ((icon - 1) // NOTES_PER_ROW) * ICON_HEIGHT
x := 2 + (mod(icon - 1, NOTES_PER_ROW)) * ICON_WIDTH
ControlClick, Button5, A,,,, x%x% y%y%
}
; Opens the hand history viewer
hudClickLastHand(x, y) {
If (!WinExist("ahk_group MiniHistories")) {
CoordMode Mouse, Relative
MouseGetPos, origx, origy
Click, %x%, %y%
MouseMove, origx, origy, 0
WinWait, ahk_group MiniHistories, , 2
}
}
This will need to be altered. Lines 208 and 212 look like this:
hudClickLastHand(190, 40)
the 190 and 40 need to be changed. These are X and Y co-ordinates for the "click" location. Let's say this is what your HEM table looks like:
Take a look at this example image:
http://www.holdemmanager.net/images/...ot10_large.jpg
The place you want the click is where it lists the last 3 hands in the black box near the top. Clicking on the top hand (where it says the player name, 00Oljlilill) will open up the instant handhistory window.
We need that click spot x-y co-ordinates. Load up AHK window spy program, and hover over the place you want to click on an active game window. In the box you will see the relative x-y locations of the mouse pointer. It will say something like:
Code:
>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen: 1122, 403 (less often used)
In Active Window: 190, 40
that 190, 40 is what we need. Put that in the script.
That's about as explicit as i can get :=)