-
AHK scripts
I was just looking at this old post http://www.flopturnriver.com/pokerfo...rz-173568.html and got a bit excited when I saw a code that Rage2100 had posted, because so far I have made 2 scripts for my fold button, this being my latest attempt:
#WinActivateForce
;esc - fold,
;fold - esc
esc::
MouseGetPos,,,win
WinActivate, ahk_id %win%
SendInput {Click 188,365}
return
The problem I am finding with this is that when I hit my esc key it drags the mouse arrow down to the fold button. After reading that code of Rage's it looked as though using ControlClick might be a better option, would using this stop the mouse arrow from being dragged to the button?. I use to use FTCash and when you hit the key for that it would do it and you wouldn't even see the mouse arrow move.
Thanks
-
Hello, and welcome to FTR.
Yes, you are correct, ControlClick will click at specified co-ordinates without moving the mouse pointer. So, try this:
Code:
Esc::
MouseGetPos,,,win
ControlClick, x188 y365, ahk_id %win%
return
-
Thanks.
I only wish I would of stopped by here sooner, I might have had some hair left. I just tested it and it is awesome, thank you so much.
Also just realised now looking at your avatar, where I know it from, its Speedball, makes me want to fire up my Mega Drive :) .
-
How difficult is it to make a script for the bet slider, were it increases/decreases the bet size by a small bb?. I have tried in the past but they havent turned out to great and planned on using you script to see if I could make one out of that.
Edit: just tried this for the bet slider using your code:
wheelup::
MouseGetPos,,,win
ControlClick, x381 y472, ahk_id %win%
return
wheeldown::
MouseGetPos,,,win
ControlClick, x358 y472, ahk_id %win%
return
But it didn't work :( . This is my best effort:
WheelUp::
MouseGetPos,,,win
WinActivate, ahk_id %win%
SendInput {Click 381,472}
SendInput {WheelUp}
return
WheelDown::
MouseGetPos,,,win
WinActivate, ahk_id %win%
SendInput {Click 358,472}
SendInput {WheelDown}
return
This works reasonably ok, but the bet slider seems to move to fast and it doesn't increase in small bb's it just increases in what the Ongame client allows.
-
I don't play at Ongame, but I will try and help you out.
A better way than moving the bet slider would be to grab the value from the bet box, and increase it by one SB or one BB.
Could you let me know the class name for the bet box at Ongame? If you open "Window Spy", which comes with AutoHotkey, and move your mouse over the bet box, it will tell you all of the information about it.
It will be something like:
>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<
ClassNN: whatever the class name is
If no class name appears, could you tell me the co-ordinates of the bet box instead?
-
This is what Win Spy said:
http://i37.photobucket.com/albums/e5...1977/table.jpg
Sorry about the hard to see size, I have been trying to put the image in the thread but the forum says i cant post img . I was just going to copy+paste what Win Spy said but obv when you move the mouse all the info changes to. Posting is a nightmare on here it wont let me use url either and every post I make it asks me to input a code :)
-
Ok, it looks like the bet box doesn't show a class name, so you will have to copy the contents of the bet box to the clipboard, add a value to it, and then paste the new value back into the bet box.
Near the top of your script, add the following. You will need to add in the co-ordinates of the call and raise buttons, and the bet box.
Code:
SetFormat, Float, 0.2 ;Set to 2 decimal places
BB=0.04 ;BB size
SB=0.02 ;SB size
BT=0 ;Set bet total to zero
FBX=188 ;Fold button position X
FBY=365 ;Fold button position Y
CBX= ;Check/call button position X
CBY= ;Check/call button position Y
RBX= ;Raise button position X
RBY= ;Raise button position Y
BetBoxX= ;Bet box position X
BetBoxY= ;Bet box position Y
Then, for your hotkeys, add the following. Wheel Up should then increase the bet by one BB, and Wheel Down should decrease the bet by one SB. Then just set up another hotkey for the raise button, as you did previously for the fold button. Please note that the value that gets copied to the clipboard will be from the active window. I'm not sure how Ongame queues the tables, so you may have to add some other lines of code to get it working 100% how you want it to.
Code:
Esc::
MouseGetPos,,,win
ControlClick, x%FBX% y%FBY%, ahk_id %win%
return
WheelUp::
Click, %BetBoxX%, %BetBoxY%
Send {HOME}+{END}^c
BT:= clipboard
BT+=BB
Send {HOME}+{END}{Del}%BT%
return
WheelDown::
Click, %BetBoxX%, %BetBoxY%
Send {HOME}+{END}^c
BT:= clipboard
BT-=SB
Send {HOME}+{END}{Del}%BT%
return
Let me know how you get on.
-
Thanks for that, it works a treat, I changed the bit for the wheelup/wheeldown from click to control click cause it was dragging my cursor again, and thought that might be the reason why I cant get my hotkeys to work, so I just went back to your original code and again couldn't get any of my hotkeys to work. This is what the script looks like so far:
Code:
SetFormat, Float, 0.2 ;Set to 2 decimal places
BB=0.04 ;BB size
SB=0.02 ;SB size
BT=0 ;Set bet total to zero
FBX=203 ;Fold button position X
FBY=437 ;Fold button position Y
CBX=330 ;Check/call button position X
CBY=437 ;Check/call button position Y
RBX=457 ;Raise button position X
RBY=437 ;Raise button position Y
BetBoxX=487 ;Bet box position X
BetBoxY=467 ;Bet box position Y
Esc::
MouseGetPos,,,win
ControlClick, x%FBX% y%FBY%, ahk_id %win%
return
f1::
MouseGetPos,,,win
ControlClick, x%FBX% y%FBY%, ahk_id %win%
return
f2::
MouseGetPos,,,win
ControlClick, x%FBX% y%FBY%, ahk_id %win%
return
WheelUp::
ControlClick, %BetBoxX%, %BetBoxY%
Send {HOME}+{END}^c
BT:= clipboard
BT+=BB
Send {HOME}+{END}{Del}%BT%
return
WheelDown::
ControlClick, %BetBoxX%, %BetBoxY%
Send {HOME}+{END}^c
BT:= clipboard
BT-=SB
Send {HOME}+{END}{Del}%BT%
return
I have tried different combinations for the hotkeys I tried it as it was ControlClick, x%FBX% y%FBY%, ahk_id %win% then this
ControlClick, x203%FBX% y437%FBY%, ahk_id %win% then this
ControlClick, x203 y437, ahk_id %win%
-
I'm not sure why your hotkeys don't work. Have you got another script running that uses the same hotkeys? Or maybe the poker client uses certain hotkeys of its own. Anyway, the code for increasing and decreasing the bet size using ControlClick is below.
Code:
WheelUp::
MouseGetPos,,,win
ControlClick, x%BetBoxX% y%BetBoxY%, ahk_id %win%
Send {HOME}+{END}^c
BT:= clipboard
BT+=BB
Send {HOME}+{END}{Del}%BT%
return
WheelDown::
MouseGetPos,,,win
ControlClick, x%BetBoxX% y%BetBoxY%, ahk_id %win%
Send {HOME}+{END}^c
BT:= clipboard
BT-=SB
Send {HOME}+{END}{Del}%BT%
return
-
Damn sorry about that, I forgot all about that on Ongame they have F1,F2 and F3 as hotkeys, that will be why it kept making that funny lil noise :) .
Just thought of a little snag, is there a way to make the script so you can play different stakes at the same time, cause I tried this for 4NL and 10NL but it didn't work:
Code:
SetFormat, Float, 0.2 ;Set to 2 decimal places
BB=0.04, 0.1 ;BB size
SB=0.02, 0.05 ;SB size
BT=0 ;Set bet total to zero
BetBoxX=487 ;Bet box position X
BetBoxY=467 ;Bet box position Y
WheelUp::
MouseGetPos,,,win
ControlClick, x%BetBoxX% y%BetBoxY%, ahk_id %win%
Send {HOME}+{END}^c
BT:= clipboard
BT+=BB
Send {HOME}+{END}{Del}%BT%
return
WheelDown::
MouseGetPos,,,win
ControlClick, x%BetBoxX% y%BetBoxY%, ahk_id %win%
Send {HOME}+{END}^c
BT:= clipboard
BT-=SB
Send {HOME}+{END}{Del}%BT%
return
-
The script needs to know what value to use for the BB and SB, so you cannot have two different values for each.
To play at two different stakes at the same time, you would need tell the script which BB value to use for each table. You could do this by using the window title and trimming it down to leave 0.04 or 0.10, or whatever stake that particular table was.
Have a play around with variables and trimming them down, etc. Use WinGetTitle to grab the window name, and then use commands like StringGetPos, StringTrimLeft, and StringTrimRight to trim off the table name and all the other unwanted parts. I've given a few examples below.
Code:
F10::
WinGetTitle, title, A
MsgBox, %title%
return
F11::
WinGetTitle, title, A
StringGetPos, pos, title, $, R
MsgBox, %title%
return
F12::
WinGetTitle, title, A
StringGetPos, pos, title, $, R
StringTrimLeft, title, title, %pos%
MsgBox, %title%
return