Quote:
Originally Posted by Baobhan-Sith
1. - your logfile definition seems off; try this:
Code:
_FILE := "C:\Users\XXX\AppData\Local\PokerStars\PokerStars.log.0"
(replace XXX with your Windows login name)
2. - the coords seem off as well; you have to grab the coords relative to the active table/window, and the table has to be default size. Open a table -> "Table Options" -> "Reset To Default Size" -> then grab "in active window" coords with the WindowSpy version that came with autohotkey (yours apparently only shows "on screen" coords)
Hey thank you for your post Boabhan I have now changed the log file code and also set my table to default size, I also used the windowspy given to me by AHK and I think i found the coords, but when i ran the script it pushed raise... lol do you know why?
Here is the updated script :
Code:
#NoEnv
#Persistent
SetBatchLines -1
CheckTime := 500 ; Check every n MilliSeconds
sitin_x := 677
sitin_y := 517
timebank_x := 740
timebank_y := 453
_FILE := "C:\Users\ben\AppData\Local\PokerStars\PokerStars.log.0"
;_FILE := "E:\sitout.txt"
SysGet, border, 32
SysGet, caption, 4
SetTimer, FILE_CHECK, %CheckTime%
return
FILE_CHECK:
If (_NEWLINES := CheckFile(_FILE))
{
;msgbox, %_NEWLINES%
Loop, Parse, _NEWLINES, `n
{
if(regExMatch(a_loopfield, "MSG_0x000A-T\s\w{8}\s(\w{8})\s", m))
{
;msgbox, %m1%
PostStarsClick(sitin_x, sitin_y, ("0x" . m1))
}
else if (regExMatch(a_loopfield, "MSG_0x0023-T\s\w{8}\s(\w{8})", m))
{
;msgbox, %m1%
PostStarsClick(timebank_x, timebank_y, ("0x" . m1))
}
}
;msgbox, %m1%
}
Return
CheckFile(File) {
; THX Sean for File.ahk : http://www.autohotkey.com/forum/post-124759.html
Static CF := "" ; Current File
Static FP := 0 ; File Pointer
Static OPEN_EXISTING := 3
Static GENERIC_READ := 0x80000000
Static FILE_SHARE_READ := 1
Static FILE_SHARE_WRITE := 2
Static FILE_SHARE_DELETE := 4
Static FILE_BEGIN := 0
BatchLines := A_BatchLines
SetBatchLines, -1
If (File != CF) {
CF := File
FP := 0
}
hFile := DllCall("CreateFile"
, "Str", File
, "Uint", GENERIC_READ
, "Uint", FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE
, "Uint", 0
, "Uint", OPEN_EXISTING
, "Uint", 0
, "Uint", 0)
If (!hFile) {
CF := ""
FP := 0
SetBatchLines, %BatchLines%
Return False
}
DllCall("GetFileSizeEx"
, "Uint", hFile
, "Int64P", nSize)
If (FP = 0 Or nSize <= FP) {
FP := nSize
SetBatchLines, %BatchLines%
DllCall("CloseHandle", "Uint", hFile) ; close file
Return False
}
DllCall("SetFilePointerEx"
, "Uint", hFile
, "Int64", FP
, "Uint", 0
, "Uint", FILE_BEGIN)
VarSetCapacity(Tail, Length := nSize - FP, 0)
DllCall("ReadFile"
, "Uint", hFile
, "Str", Tail
, "Uint", Length
, "UintP", Length
, "Uint", 0)
DllCall("CloseHandle", "Uint", hFile)
VarSetCapacity(Tail, -1)
FP := nSize
SetBatchLines, %BatchLines%
Return Tail
}
relStarsClientPoint(id, ByRef x, ByRef y)
{
global border
global caption
rw := 792
rh := 546
WinGetPos, , , w, h, ahk_id%id%
w := w - (2*border)
h := h - (2*border) - caption
x := Floor( (x / rw ) * w )
y := Floor( (y / rh) * h )
}
;Juks rocks
PostLeftClick(x, y, table_id, activate=0) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
; window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}
PostStarsClick(x, y, id)
{
relStarsClientPoint(id, x, y)
PostLeftClick(x, y, id)
}
when I am getting the coords do i Just hover my mouse over where the "sit back in" button would appear and "time bank" box appears and get the coords that way?
CheckTime := 500 ; Check every n MilliSeconds
sitin_x := 677
sitin_y := 517
timebank_x := 740
timebank_y := 453
Basically I dont need the timebank just auto sit back in, however it just hits the raise button
The screen shot above shows the coords where my mouse cursor was (sitting on top of the sit me back in button)
Last edited by OditeRussia; 10-12-2012 at 12:14 PM.