|
Page 1 of 1
|
[ 2 posts ] |
|
New AHK Script: TimeOut Helper
| Author |
Message |
|
Jayme
Joined: Fri Jul 25, 2008 9:46 pm Posts: 216 Location: SJO
|
 New AHK Script: TimeOut Helper
We will be featuring a new AHK script on our hompage soon called TimeOut Helper that automatically sits you back in if you miss a hand, as well as auto-clicks your time bank. Here is a copy of the script if you want to give it a shot: Code: #NoEnv #Persistent SetBatchLines -1
CheckTime := 500 ; Check every n MilliSeconds sitin_x := 532 sitin_y := 468
timebank_x := 520 timebank_y := 460
If A_OSVersion in WIN_VISTA { _FILE := A_AppData . "\PokerStars\PokerStars.log.0" IfNotExist %_FILE% stringreplace,_FILE,_FILE,Roaming,Local IfNotExist %_FILE% { msgbox, PokerStars.log.0 file was not found return } } else _FILE := A_ProgramFiles . "\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_TABLE_FORCE_SITOUT\s(\w{8})\s1", m)) { ;msgbox, %m1% ;PostStarsClick(sitin_x, sitin_y, ("0x" . m1)) id:="0x" . m1 winclose,ahk_id%id% winwait,Table ahk_class #32770,,1 { ControlFocus,Button1, Sleep, -1 ControlSend,Button1,{SPACE}, } } else if (regExMatch(a_loopfield, "MSG_TABLE_TIMEBANK\s(\w{8})\stime=", 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)
|
| Sun Mar 20, 2011 9:19 pm |
|
 |
|
nikyo
Joined: Fri May 20, 2011 5:36 pm Posts: 1
|
 Re: New AHK Script: TimeOut Helper
Not working for me. Error: Missing "}" on line 149  Code: Line# 135: } 138 { 142: If activate 143: WinActivate, ahk_id%table_id% 144: PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id% 145: PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id% 146: } --> 149: { 150: relStarsClientPoint(id, x, y) 151: PostLeftClick(x, y, id) 151: Exit
|
| Sat May 21, 2011 5:34 am |
|
 |
|
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|