About

The corresponding thread on 2+2 is here

The script shows the notes of the player you're hovering over with the mouse in a tooltip. To use the script, you will first have to select Preferences from the try menu and enter the required data.

To be able to show the notes, you need to be playing at the table so that hand histories are being written. You can hover over the tray icon to check which tables are being recognized.

This script requires RolandsFunctions, Version2.

; StarsNotes
; date: 15:23 08 June 2007
; AHK version: 1.0.46.16
; author: Roland
; email: roland@overcards.com
; many thanks to easye for the prefered seat stuff

#NoEnv
#SingleInstance force
#Include %a_scriptDir%
#Include Functions.ahk ;must be version 2

SetWorkingDir %a_scriptDir%
OnExit, exitSub

version=1.07

Menu, Tray, noStandard
Menu, Tray, Add, &About, About
Menu, Tray, Default, &About
Menu, Tray, Add
Menu, Tray, Add, &Preferences, Prefs
Menu, Tray, Add
Menu, Tray, Add, E&xit, Exit
Menu, Tray, Tip, StarsNotes v%version%

ini=StarsNotes.ini
IniRead, hhDir, % ini, Prefs, hhDir, % a_space
IniRead, notesFile, % ini, Prefs, notesFile, % a_space
IniRead, seat_pref_use, % ini, PreferredSeat, seat_pref_use, % a_space
IniRead, sn_user, % ini, PreferredSeat, sn_user, % a_space
IniRead, seat_pref_2max, % ini, PreferredSeat, seat_pref_2max, % a_space
IniRead, seat_pref_6max, % ini, PreferredSeat, seat_pref_6max, % a_space
IniRead, seat_pref_8max, % ini, PreferredSeat, seat_pref_8max, % a_space
IniRead, seat_pref_9max, % ini, PreferredSeat, seat_pref_9max, % a_space
IniRead, seat_pref_10max, % ini, PreferredSeat, seat_pref_10max, % a_space
data()

Gosub tableCheck
SetTimer, timer, 200
SetTimer, tableCheck, 3000
Gosub Prefs
return

tableCheck:
tables:=tablesStars(), rec:="StarsNotes v" version "`n"
Loop, Parse, tables, `,
  { if !lastHHStars(a_loopfield, hhDir)
      continue
    WinGetTitle, t, ahk_id%a_loopfield%
    StringLeft, t, t, InStr(t, " -")-1
    listAdd( rec, t, "`n" )
  } Menu, Tray, Tip, % rec
return

exitSub:
exitApp

About:
TrayTip, StarsNotes v%version%
  , Author: Roland`nEmail: roland@overcards.com,, 1
return

Prefs:
Gui, +toolwindow
Gui, Font,, Comic Sans MS
Gui, Margin, 5, 5

Gui, Add, Groupbox, w310 h120, Paths
Gui, Add, Text, xp+5 yp+20, Hand history directory: 
Gui, Add, Edit, vhhDir w270 r1 section, % hhDir
Gui, Add, Button, vb_hhDir ys h20 ghhDir, ...
Gui, Add, Text, xs, Notes file:
Gui, Add, Edit, vnotesFile w270 section r1, % notesFile
Gui, Add, Button, vb_notesFile ys h20 gnotesFile, ...

Gui, Add, Groupbox, x5 h175 w310, Preferred Seat
Gui, Add, Text, w300 xp+5 yp+20, 
  ( LTrim join`s
    These options are ONLY necessary if
    you have set up the Preferred Seat option in Stars.
  )
Gui, Add, CheckBox, vseat_pref_use checked%seat_pref_use%, Use Preferred Seat 
Gui, Add, Text, section, Stars Screen Name:
Gui, Add, Edit, vsn_user ys r1 w100, % sn_user
Gui, Add, Text, xs, Preferred Seat # (as entered in Stars Option):
Gui, Add, Text, yp+20 section, 1-on-1:
Gui, Add, Edit, vseat_pref_2max w30, % seat_pref_2max
Gui, Add, Text, ys xp+50, 6Max:
Gui, Add, Edit, vseat_pref_6max w30, % seat_pref_6max
Gui, Add, Text, ys xp+50, 8Max:
Gui, Add, Edit, vseat_pref_8max w30, % seat_pref_8max
Gui, Add, Text, ys xp+50, 9Max:
Gui, Add, Edit, vseat_pref_9max w30, % seat_pref_9max
Gui, Add, Text, ys xp+50, 10Max:
Gui, Add, Edit, vseat_pref_10max w30, % seat_pref_10max
Gui, Add, Button, xs-5 yp+40 default section h20, Submit
Gui, Add, Button, ys h20, &Cancel
Gui, Show,, StarsNotes - Preferences
return

hhDir:
Gui, +ownDialogs
FileSelectFolder, f, *%a_programFiles%\
  ,, Select the directory with your hand histories:
ifEqual, f,, return
GuiControl,, hhDir, % f
return 

notesFile:
Gui, +ownDialogs
FileSelectFile, f, 1, % a_programFiles
  , Select the notes file:, *.txt
ifEqual, f,, return
GuiControl,, notesFile, % f
return

Exit:
exitApp

ButtonSubmit:
Gui, Submit, noHide
IniWrite, % hhDir, % ini, Prefs, hhDir
IniWrite, % notesFile, % ini, Prefs, notesFile
IniWrite, % seat_pref_use, % ini, PreferredSeat, seat_pref_use
IniWrite, % sn_user, % ini, PreferredSeat, sn_user
IniWrite, % seat_pref_2max, % ini, PreferredSeat, seat_pref_2max
IniWrite, % seat_pref_6max, % ini, PreferredSeat, seat_pref_6max
IniWrite, % seat_pref_8max, % ini, PreferredSeat, seat_pref_8max
IniWrite, % seat_pref_9max, % ini, PreferredSeat, seat_pref_9max
IniWrite, % seat_pref_10max, % ini, PreferredSeat, seat_pref_10max
Gui destroy
return

ButtonCancel:
GuiClose:
GuiEscape:
Gui destroy
return

timer:
win:=mouseGetWin()
if !IsIn(win, tablesStars())
  exit()
player:=PlayerByMousePositionStars()
ifEqual, player, % playerPrev, return
playerPrev:=player
if ( player="noHH" || player="" )
  exit()
tooltip % notesStars(player, notesFile)
return

exit() {
tooltip
exit
}

notesStars(player, file) {
FileRead, notes, % file
notes.="`r`n[username="
RegExMatch(notes, "mis)\[username=" player "\](.*?)\[username=", m)
return trimSpace(m1)
}

trimSpace(str) {
return regExReplace(regExReplace(str
  , "\s*$"), "^\s*")
}

playerByMousePositionStars() {
local win,hh,wx,wy,ww,wh,mx,my,x,y,gt,seat,sn
CoordMode, Mouse, Screen
win := MouseGetWin()
If ! IsIn(win, tablesStars())
  return
hh := LastHHStars(win, hhdir)
If ( hh="" )
  return "noHH"
WinExist("ahk_id" win)
WinGetPos, wx, wy, ww, wh
MouseGetPos, mx, my
x := mx-wx
y := my-wy
SeatsNamesStars(hh, win)
gt := Is6maxHHStars(hh)
  ? "6max"
  : ( IsStudHHStars(hh) ? "stud" : (Is9maxHHStars(hh) ? "9max" : "" ))
seat := Seat(x, y, ww, wh, gT )
If seat_pref_use
  {
    sn := sn_user
    seat_user := seat%sn%%win%
    seat_total := Is6maxHHStars(hh)
      ? 6
      : ( IsStudHHStars(hh) ? 8
      : ( Is9maxHHStars(hh) ? 9 : 10 ))
    seat_pref := Is6maxHHStars(hh)
      ? seat_pref_6max
      : ( IsStudHHStars(hh) ? seat_pref_8max
      : ( Is9maxHHStars(hh) ? seat_pref_9max : seat_pref_10max ))
    seat_adj := seat_user - seat_pref
    seat := seat + seat_adj
    if seat > %seat_total%
      seat := seat - seat_total
    if seat < 1
      seat := seat + seat_total
  }
return sn%seat%%win%
}

seat(x, y, ww, wh, gT) {
global
Loop % ( gt="6max" ? 6 : ( gt="stud" ? 8 : ( gt="9max" ? 9 : 10 ) ) ) {
    If ( x>relXStars(Xpos%gT%%a_index%, ww)
      && y>relYStars(Ypos%gT%%a_index%, wh)
      && x<relXStars(Xpos%gT%%a_index%, ww)+relWStars(93, ww)
      && y<relYStars(Ypos%gT%%a_index%, wh)+relHStars(33, wh) )
        return a_index
  }
}

data() {
global
listX = 562,699,700,592,447,270,121,14,10,152
listY = 58,116,277,389,436,436,389,277,116,58
listX6max = 699,694,487,228,16,12
listY6max = 116,303,366,366,304,118
listXStud = 593,681,695,529,189,25,28,126
listYStud = 88,236,344,398,398,344,236,86
listX9max = 563,701,694,487,354,228,16,12,154
listY9max = 63,118,303,366,443,366,304,118,62

Loop, Parse, listX, `,
  Xpos%a_index% := a_loopfield
Loop, Parse, listY, `,
  Ypos%a_index% := a_loopfield
Loop, Parse, listX6max, `,
  Xpos6max%a_index% := a_loopfield
Loop, Parse, listY6max, `,
  Ypos6max%a_index% := a_loopfield
Loop, Parse, listXStud, `,
  XposStud%a_index% := a_loopfield
Loop, Parse, listYStud, `,
  YposStud%a_index% := a_loopfield
Loop, Parse, listX9max, `,
  Xpos9max%a_index% := a_loopfield
Loop, Parse, listY9max, `,
  Ypos9max%a_index% := a_loopfield
}


CategoryAutoHotKey

StarsNotes (last edited 2008-01-17 23:39:03 by 63-149-120-179)