Poker Forum

Over 1,246,000 Posts!

Subscribe to FTR web feed
Already Registered?      Username:    Password:   Remember      Forgot Password
  >    > 

Creating Basic AHK Scripts for Pokerz

  
 
LinkBack Thread Tools Display Modes
Robb
Old 08-06-2009, 10:39 PM     Post subject: Creating Basic AHK Scripts for Pokerz #1 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Props to Rage and Nakamura for the epic post A Beginner's Guide to Multitabling. They used AutoHotKey to program a couple of VERY nice table management scripts, which got me thinking.

I don't like the idea of paying $50 for something like Table Ninja, not because I don't think it's worth - it probably is. I just see all these software updates and messages in their support forums about the software not working after the latest FTP or Starz update. And the sites are always updating their stuff.

What if we can get some bare bones functionality for free in a script we write ourselves? AHK is great at pointing and clicking, so I made some betting scripts to go with Naka's and Rage's scripts which I use every time I play. Which brings me to the whole freakin' point:

Writing your own AHK script is easy

Step 1: Download AHK installer here.

Step 2: Install it.

Step 3: Create a blank text document in TextPad, or whatever plain text editor you'd like.

Step 4: Save the *.txt file as Temp.ahk. Windows will complain about file extension change, but say it's OK.

Step 5: Right click on the Temp file, and select edit. Make a simple script like the screen shot below.



Step 6: Save the file. Then Right click on it, and select "Run Script." A new tab will open in your default web browser and the main FTR forum screen will load.

Congrats, you've written an AHK script!

They call it AutoHOTKEY for a reason

Notice the Square Green "H" Icon in the system tray? That's your signal the script is active. Now change the single line of code to:

__________

^F::Run http://www.flopturnriver.com/phpBB2/forum/
__________


Save it. Right click on the Green "H" try icon and select "Reload this script." Nothing happens, but now press

Ctrl + F

and voila, a new FTR forum tab appears in your browser. By the way, this command also opens your browser if it's not already. Here's the most common hotkey prefixes:

^ [Control] button
+ [Shift] button
! [Alt] button
# [Windows] button

This script would make Ctrl + Shift + F a hotkey:
__________

^+F::Run http://www.flopturnriver.com/phpBB2/forum/
__________

A super basic betting script.

Preflop, mashing the ol' bet pot button produces a 3.5 BB + 1 BB / limper open-raise. The following script makes the middle "mouse wheel" button a hotkey that will auto open on default-sized tables at Full Tilt.

__________

MButton::
Click 750,450
Click 750,550
return
__________


WTF? you say. Well, the Click command simply moves the mouse to the specified coordinates in the active window and left-clicks. The "return" command closes the multiple steps in the script.

So where do the coordinates come from? We have to use WindowSpy. Right click on the Green "H" tray icon, and open the Spy. Then hover your mouse over any open window and the Spy gives you details about all sorts of stuff. We'll look for the coordinates. I opened a Full Tilt 2nl game using FTP's default size, so the script should work for you on Tilt if you resize your windows to default. Two screen shots below show I got the coordinates so you can use any size and table layouts you wish. Just make sure all your tables are the same size.

During game play, FTP activates a table. Hero moves the cursor over the active table and clicks the mouse wheel button. FTP registers a 3.5 BB opening bet, and you're on to your next table.

In this screenshot, my mouse is hovering on the "o" on the [POT] button. You can see the coordinates in the WindowSpy are roughly (750,450).


Here, I'm hovering on the [BET] button. You can see the coordinates in the WindowSpy are roughly (750,550) or about 100 pixels further down.


More betting script tips

For reasons I won't delve into, using the simple click command is clunky. You can see each cursor movement and click. This speeds it up noticeably making for seamless action on your tables.

__________

MButton::
SendInput {Click 750,450}
SendInput {Click 750,550}
return
__________


All right, I don't play default-sized tables since I have a small monitor. From now on, the coordinates I'll use are the ones I use on my tables. I hover over the fold button (been playing lots of full nit recently), so adding this line to my script moves the cursor back over the Fold button for me:

__________

MButton::
SendInput {Click 750,450}
SendInput {Click 750,550}
SendInput {Click 480,480,0}
return
__________

The "0" after the coordinates moves the cursor but does NOT click. Here's the game play action: I'm fold-fold-folding oh wait big slick! I press the mouse wheel button for my standard open and get back to fold-folding without moving the mouse at all since the script repositions the cursor after clicking. The SendInput version is so fast, you'll have to test it a while before you trust it. I suggest 2nl until you're happy with how it works.

Here's a script that changes the auto-open to 3 BB since many of us open for a bit less on the button:

__________

^MButton::
SendInput {Click 660,400}
SendInput {Click 660,420,0}
SendInput {WheelDown}

SendInput {Click 660,480}
SendInput {Click 480,480,0}
return
__________

The two new lines are in bold. The first makes the cursor hover in the betting dialog box so that the mouse wheel can increase or decrease the bet amount. The second new line moves the mouse wheel down one click. (You have to make sure your betting preferences are set in the FTP lobby to increment the bet by 1 BB when you roll the mouse wheel, or this script won't work.)

Replace the word "Down" with the word "Up," choose a new hotkey, and you have a script that will auto-open 4 BB for you. I use this one when I'm in the SB and make the first raise.

Warning! I haven't tested this one, yet, as my kids aren't in bed. But it SHOULD work!! I'll report back later after testing, but this bets a specific amount, in this case, $3. That's a pretty common flop cbet amount for me, so I'm making it's hotkey Ctrl + RightClick:

__________

^RButton::
SendInput {Click 660,400}
SendInput {Click 675,415,2}
SendInput 3.00
SendInput {Click 660,480,0}
return
__________

If you delete the ",0" in the 2nd to last line, this script would actually bet $3 for you. As it's written, it puts $3 in the betting text input box and moves the cursor over the [BET] button. If I'm happy with that amount, I can simply click myself. Otherwise, I can use the mouse wheel to increment the bet up or down.

Managing all the hotkeys
A single script file can set several hotkeys at once. Below is the entire script file that sets the following hot keys:

Mouse Wheel Button => auto-open 3.5
Ctrl + Mouse Wheel Button => auto-open 3.0
Shit + Mouse Wheel Button => auto-open 4.0
Ctrl + Right Click => Bet $3
Shift + Right Click => Bet $5

__________

MButton::
SendInput {Click 660,400}
SendInput {Click 660,480}
SendInput {Click 480,480,0}
return

^MButton::
SendInput {Click 660,400}
SendInput {Click 660,420,0}
SendInput {WheelDown}
SendInput {Click 660,480}
SendInput {Click 480,480,0}
return

+MButton::
SendInput {Click 660,400}
SendInput {Click 660,420,0}
SendInput {WheelUP}
SendInput {Click 660,480}
SendInput {Click 480,480,0}
return

^RButton::
SendInput {Click 660,400}
SendInput {Click 675,415,2}
SendInput 3
SendInput {Click 660,480,0}
return

+RButton::
SendInput {Click 660,400}
SendInput {Click 675,415,2}
SendInput 5
SendInput {Click 660,480,0}
return
__________

I working on some more stuff which I'll post below.

In conclusion, I'll just mention I'm an AHK noobie. Lots of folks on FTR did sick things with AHK before now. I linked to Rage's work above. Spoony uses some scripts for mapping Playstation controller keys to poker actions on Stars, and HalvSame wrote a script Custom Script BigPotGrabber to grab the HH's for "big" pots, which ISF loved.

So I'm not the expert. I just posted this due to a conversation that started in my operation thread. I searched and didn't find a "poker scripting basics" thread on FTR, so I thought I'd make one. If someone else has already done something, I would appreciate the link. Anyone
interested in learning more advanced scripting should practice some of these basics and then check out the tutorials on AutoHotKey.com.
 
Reply With Quote
Join the FTR Poker Forum to disable these banners and start posting!
kmind
Old 08-06-2009, 10:55 PM #2 (permalink)  
kmind's Avatar
Straight Flush

Join Date: Oct 2006
Location: Not Giving In
Posts: 4,240
kmind is on a distinguished road
Only skimmed so far but wanted to say THANKS ROB!
Reply With Quote
Micro2Macro
Old 08-06-2009, 11:07 PM #3 (permalink)  
Micro2Macro's Avatar
Moderator

Join Date: Jan 2009
Location: http://three-pair.com/
Posts: 4,460
Micro2Macro is a jewel in the roughMicro2Macro is a jewel in the roughMicro2Macro is a jewel in the rough
Also only skimmed, but as usual Robb is kicking ass in his posts.
"Once we reach a certain level of mastery, we see there are higher levels and challenges. If we are disciplined and patient, we proceed. At each higher level, new pleasures and insights await us--ones not even suspected when we started out. We can take this as far as we want--in any human activity there is always a higher level to which we can aspire."

Check out my blog here!

"You are a degenerate Gaam-balur"

http://www.philgalfond.com/lets-make-some-changes/
 
Reply With Quote
Parasurama
Old 08-06-2009, 11:38 PM #4 (permalink)  
Parasurama's Avatar
Full House

Join Date: Nov 2008
Location: DMT
Posts: 820
Parasurama
Robb must have an enormous cock, I mean like gigundus.

Which sock do you tuck it into Robb, right or left?
Reply With Quote
griffey24
Old 08-07-2009, 03:23 AM #5 (permalink)  
griffey24's Avatar
Straight Flush

Join Date: Sep 2006
Location: Toronto'ish
Posts: 4,611
griffey24 is on a distinguished road
Awesome dude, i'm gonna try this tomorrow! thanksss
Quote:
Originally Posted by Jay-Z
I'm a couple hands down and I'm tryin' to get back
I gave the other grip, I lost a flip for five stacks
 
Reply With Quote
HarleyGuy13
Old 08-07-2009, 03:30 AM #6 (permalink)  
HarleyGuy13's Avatar
Full House

Join Date: Sep 2008
Location: Oregon
Posts: 1,226
HarleyGuy13 is on a distinguished road
U fucking rock dude!
"You start the game with a full pot o’ luck and an empty pot o’ experience...
The object is to fill the pot of experience before you empty the pot of luck."

Quote:
Originally Posted by XxStacksxX View Post
Do you have testicles? If so, learn to bet like it
 
Reply With Quote
Robb
Old 08-07-2009, 04:15 AM #7 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Tired of dicking around waiting forDAMNever for HEM to initialize so you can click "auto import"?

Here's a script that opens Holdem Manager, starts the auto importing, then minimizes HEM to the system tray.

_________

SetTitleMatchMode 2
Run %A_ProgramFiles%\RVG Software\Holdem Manager\HoldemManager.exe
WinWait, www.holdemmanager.net, , 60
SetControlDelay -1
ControlClick, Start Auto Import
WinMinimize, Hold'em Manager
return
_________

This script presumes you've checked the "Launch HUD with AutoImport" HEM feature. Some notes:

1. "SetTitleMatchMode 2" tells the commands in the script to find partial title matches for the various window names.

2. The WinWait command actually stops the script until HEM is up and fully running, but the little "initializing" window is ALSO named "Hold'em Manager blah blah". The active HEM window has the web site URL in its title line, so setting the partial match (mode 2) allows the WinWait command to ignore the little "intializing" window and not try to press the "Start Auto Import" button until the real HEM gets up and running.

3. The "SetControlDelay -1" forces the Control command to initiate instantly, so that if you're moving the mouse around when HEM becomes active, you don't interfere with the mouse clicking action.

4. The last two lines are pretty much self-explanatory.

I tried to get FTP to open and click "login" but it's little initializing window is the same class and has the same name as the login window, so I haven't been successful. I was hoping to write a script that would load HEM, then FTP, then my scripts in order, using WinWait so that they load in series (rather than parallel) which imo is faster. I'll post my workaround if I can't figure out how to make it work right.
 
Reply With Quote
Robb
Old 08-07-2009, 05:01 AM #8 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
All right, so I learned to make the "open FTP and login" script work.

_________

SetTitleMatchMode 2
Run %A_ProgramFiles%\Full Tilt Poker\FullTiltPoker.exe
WinWait, Full Tilt,,15
WinGet, Number, PID, Full Tilt
WinWaitClose, ahk_pid %Number%
WinWaitActive, Full Tilt,,15
SendInput {Click 500,450}
_________


This script grabs the unique PID (process ID) for the "initializing" window, waits for THAT Full Tilt window to close, then looks for the second window named Full Tilt, which is the login box.

The "WinGet, Number, PID, Full Tilt" command locates the PID of the first window that appears with a "Full Tilt" title (partial match) and stores it in a variable called "Number."

The "WinWaitClose, ahk_pid %Number%" waits for the window with the PID stored in the variable "Number" to close before allowing the rest of the script to execute.

The click command just uses the cursor position in the active login window. I think it will work for everyone because the window size is fixed, but I could be wrong. You might have to Spy your way to the proper coordinates for the Click.

If you care about the techy details, the "15" specifies that the scripts will wait 15 seconds, then quit if the Window hasn't appeared, yet. Command options appear following the command name separated by commas, so a ",," in a line means the command has an option we're leaving blank. Just a place holder so we can specify the option we need.
 
Reply With Quote
Robb
Old 08-07-2009, 05:06 AM #9 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Oh, yeah, the above login script only works if you've set FTP to remember your username and password.
 
Reply With Quote
kmind
Old 08-07-2009, 06:20 AM #10 (permalink)  
kmind's Avatar
Straight Flush

Join Date: Oct 2006
Location: Not Giving In
Posts: 4,240
kmind is on a distinguished road
Fucking shit Robb, I've been wanting the open HEM and auto import thing for awhile and the auto-login thing is sweet. You are the man! I hope I can somehow contribute to this thread or yourself.
Reply With Quote
lolzzz_321
Old 08-07-2009, 11:48 AM #11 (permalink)  
lolzzz_321's Avatar
NO YOU

Join Date: Oct 2004
Location: My ice is polarized
Posts: 2,797
lolzzz_321 is a jewel in the roughlolzzz_321 is a jewel in the roughlolzzz_321 is a jewel in the roughlolzzz_321 is a jewel in the rough
Send a message via AIM to lolzzz_321
Quote:
Originally Posted by Robb
Oh, yeah, the above login script only works if you've set FTP to remember your username and password.
HIGHLY RECOMMEND TO NOT DO THIS

With that said, carry on.

I'll pay you a little money if you can get something that'll stack tables for me on ftp and auto click the timebank... PM me if you get bored.
Reply With Quote
Robb
Old 08-07-2009, 02:05 PM #12 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Quote:
Originally Posted by kmind
Fucking shit Robb, I've been wanting the open HEM and auto import thing for awhile and the auto-login thing is sweet. You are the man! I hope I can somehow contribute to this thread or yourself.
My computer's a bit old and wasn't top end when new. So loading up all my poker software can take some time, especially if I'm browsing FTR and checking email while waiting. I've tried various database management things to speed up HEM, but it just loads slow (though in-game performance is fine imo).

My idea was to make a script that optimizes the amount of time between sitting down and playing a hand of poker.

If we open FTP first, then HEM and scripts last, we can be scanning the lobby for tables while HEM is initializing. The script will manage all the HEM stuff in the background, and by the time we get to post a blind, we'll have HUD and betting scripts operational.

I've pretty much got all the pieces working now, so I'll put them together (including the option to manually input username and password to keep from storing them online) and post them sometime tonight. Then I'll be able to click once, head to the fridge for a can of Coke, and by the time I sit back down I'll be ready to play.

I think some of my computer speed problem is parallel activities - trying to load both FTP and HEM simultaneously seems to take longer than loading one, then loading the other. But I just can't resist mashing the "load NOW" button on the next POS (piece of software :P). The AHK script waits just long enough for one process to end, then cranks the new one. Preliminary tests show a speed improvement. I believe I also have it working so that clicking in the lobby on FTP won't affect the HEM portions of the script.

I'm now working on the auto-sit-out, auto-sit-in type scripts that perform a function on all the tables at once. When I've got those (hopefully by the end of the weekend), I'll be pretty happy with life.

Glad people are finding this interesting.

@para - lulz :P
 
Reply With Quote
Nakamura
Old 08-07-2009, 10:18 PM #13 (permalink)  
Nakamura's Avatar
4-of-a-Kind

Join Date: Mar 2008
Location: Grindin'
Posts: 1,515
Nakamura is an unknown quantity at this point
Awesome stuff Robb!

I thought the HEM script was good, but then I figured I'd have to actually find the script and click it etc. and my PC is actually fairly quick, so it probably wouldn't shorten the process.

Still it's a pretty awesome thread for beginners to pick up the basics.

BTW, I was playing on full tilt this week and the queing process seems better. There still seemed to be one or two snags. Is it fixed?
Reply With Quote
jyms
Old 08-07-2009, 10:33 PM #14 (permalink)  
jyms's Avatar
Tilting Mod

Join Date: Feb 2006
Posts: 4,836
jyms has a spectacular aura aboutjyms has a spectacular aura aboutjyms has a spectacular aura about
What I am looking for is the command to make a window stay minimized. I would like to keep HEM out of site and unable to open. Just having it run would be reminder enough. It's such a habit to look at it even when I tell myself not to. Do I set it to click when maximized ont eh minimize coordinate or can I jsut type something like minimize HM?


edit: oooh found this, it's a list of commands.

http://www.autohotkey.com/docs/commands.htm
 
Reply With Quote
jyms
Old 08-07-2009, 10:51 PM #15 (permalink)  
jyms's Avatar
Tilting Mod

Join Date: Feb 2006
Posts: 4,836
jyms has a spectacular aura aboutjyms has a spectacular aura aboutjyms has a spectacular aura about
Woot, did it
 
Reply With Quote
Robb
Old 08-08-2009, 12:00 AM #16 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Quote:
Originally Posted by jyms
Woot, did it
Share?
 
Reply With Quote
Rage2100
Old 08-08-2009, 11:38 AM #17 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Great posts, Robb!

Thanks for the mention, too.
Reply With Quote
jyms
Old 08-08-2009, 03:21 PM #18 (permalink)  
jyms's Avatar
Tilting Mod

Join Date: Feb 2006
Posts: 4,836
jyms has a spectacular aura aboutjyms has a spectacular aura aboutjyms has a spectacular aura about
Quote:
Originally Posted by Robb
Quote:
Originally Posted by jyms
Woot, did it
Share?
Code:
loop
WinMinimize Hold'em Manager Professional 1.09 beta 18a         www.holdemmanager.net         DATABASE: retirement2010
 
Reply With Quote
Keith
Old 08-08-2009, 03:58 PM #19 (permalink)  
Full House

Join Date: Nov 2008
Posts: 1,335
Keith will become famous soon enoughKeith will become famous soon enough
Quote:
Originally Posted by jyms
Quote:
Originally Posted by Robb
Quote:
Originally Posted by jyms
Woot, did it
Share?
Code:
loop
WinMinimize Hold'em Manager Professional 1.09 beta 18a         www.holdemmanager.net         DATABASE: retirement2010
Is this going to have to be updated everytime HEM updates to the latest beta?.
Reply With Quote
Robb
Old 08-08-2009, 05:04 PM #20 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Quote:
Originally Posted by Keith_MM
Quote:
Originally Posted by jyms
Quote:
Originally Posted by Robb
Quote:
Originally Posted by jyms
Woot, did it
Share?
Code:
loop
WinMinimize Hold'em Manager Professional 1.09 beta 18a         www.holdemmanager.net         DATABASE: retirement2010
Is this going to have to be updated every time HEM updates to the latest beta?.
Yes, but use SetTitleMatchMode 2 for partial matching, like this:
Code:
loop
SetTitleMatchMode 2
WinMinimize Hold'em Manager Professional
return
 
Reply With Quote
Robb
Old 08-08-2009, 05:46 PM #21 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
All right, here is a collection of scripts I call "1 Script to Rule Them All" which activates hotkeys for various poker-related activities:

Ctrl Shift F - - Open/login to FlopTurnRiver Forum
Ctrl Shift S - - Take screen shot, open Photo Editor, "paste as new", and open web photo hosting URL
Ctrl Shift H - - Hand history posting: open weaktight.com, FTR (if statement checks if HEM is open and activates/opens as needed)
Ctrl Shift P - - Open/login Full Tilt, open HEM + auto-import, load poker scripts
Ctrl Shift X - - Closes gameplay scripts, but not HEM or poker client
Ctrl Shift G - - Open/login to gmail

I've broken up the script code into bite sized pieces, but the script file I use basically is just all these pieces strung together with blank lines between them.

NOW I'M GONNA LEARN HOW TO AUTOLOAD A SCRIPT ON STARTUP SO THESE HOTKEYS ARE ALWAYS READY RUN.

Cheers.


Play Poker Script loads HEM, FTP and Game Play Scripts
Code:
^+P::
SetTitleMatchMode 2
Run %A_ProgramFiles%\Full Tilt Poker\FullTiltPoker.exe
WinWait, Full Tilt,,15
WinGet, Number, PID, Full Tilt
WinWaitClose, ahk_pid %Number%
WinWaitActive, Full Tilt,,15
SendInput {Click 500,450}
Run %A_ProgramFiles%\RVG Software\Holdem Manager\HoldemManager.exe
WinWait, www.holdemmanager.net,,60
SetControlDelay -1
ControlClick, Start Auto Import
WinMinimize, Hold'em Manager
Run C:\Users\Family\AutoHotKey\MoveTable\MoveTable_Config1_FT_New.ahk
Run C:\Users\Family\AutoHotKey\Betting\BetScript.ahk
return
Notes: The WinWait, WinGet, and WinWaitClose commands track the first Full Tilt Poker window that pops up, the white one with the cards shuffling (it has the same title as the login window). When that's closed, the script can login. (If you don't like storing your passwords online, you can make it click on text boxes and enter strings for usernames and passwords like FTR script shown below.) "ControlClick" doesn't mean the Ctrl + mouse click, it means "click the control button called" Start Auto Import. The MoveTable script is Rage's and Naka's from the thread linked in this thread's OP. The Betting Scripts are the ones I've posted above, plus a couple clunky ones I haven't optimized, yet, but might post when I do.

Exits Game Play Scripts
Code:
^+X::
DetectHiddenWindows On
SetTitleMatchMode 2
WinClose MoveTable_Config1_FT_New.ahk - AutoHotkey
WinClose BetScript.ahk - AutoHotkey
return
Notes: Since the AHK scripts run as minimized system tray windows, the DetectHidden command "On" allows WinClose to "find" them and close them. "SetTitleMatchMode 2" sets the script to match any part of the window title. I've used the exact title names anyway, but I wouldn't have to. The MoveTable script is Rage's and Naka's from the thread linked in this thread's OP.


HH Script
Code:
^+H::
Run http://weaktight.com/
Run http://www.flopturnriver.com/phpBB2/forum/
SetTitleMatchMode 2
DetectHiddenWindows On
IfWinExist Hold'em Manager
  WinActivate Hold'em Manager
else
  Run %A_ProgramFiles%\RVG Software\Holdem Manager\HoldemManager.exe
return
Notes: The If statement checks first if HEM is open (DetectHidden checks the minimized windows, too). If HEM is not, the script loads it. The %A_ProgramFiles% makes the script more portable by checking for your computer's specific "ProgramFiles" folder and making the path name relative.


Screen Shot Script - Pretty thrilled @ this :P
Code:
^+S::
Send {PrintScreen}
Run Microsoft Photo Editor
WinWait Microsoft Photo Editor
WinMaximize Microsoft Photo Editor
Send !{E}
Send {N}
Run http://xs.to/
return
Notes: The "send" commands near end simulate hitting "Alt + E" to activate the Edit Menu, then "N" which is the menu hotkey for "Paste as New Image." I put the WinMaximize command in because my Photo Editor tends to open minimized for some reason - you may not need this. You can also call whatever JPEG editor you like and change the Send commands to work with it.


Open Gmail Script
Code:
^+G::
SetTitleMatchMode 2
Run www.gmail.com
WinWaitActive, Gmail,,30
Sleep 600
Send MyUserName
Send {Tab}
Send MyPassword
Send {Enter}
return
Notes: The ",,30" in WinWaitActive sets a time limit - if gmail isn't open in the browser by then, it exits the script. The sleep 600 pauses for 600 milliseconds (3/5's of a second) for the web page to load which happens AFTER it's become active. You can adjust the sleep time that works best with your machine speed and internet connection.

Open FTR Script - warning! clunky (requires Spy + new coords to work for others)
Code:
^+F::
SetTitleMatchMode 2
Run http://www.flopturnriver.com/phpBB2/forum/
WinWaitActive, Poker Forum,,30
WinMaximize Poker Forum
Sleep 1600
SendInput {Click 600,300,2}
Sleep 5
Send MyUserName
SendInput {Click 770,300,2}
Sleep 5
Send MyPassword
SendInput {Click 1000,300}
return
Notes: This is a HORRIBLE bad script (real programmers will LoL) that's really just here to show you how you can make hotkeys for any set of "repeated movements" you do on your personal computer. The "WinMaximize" makes my browser a specific size so the "Click" command coordinates hit the right spots. The Sleep 5 commands pause the script 1/200th of a second. For some reason, the dialog box needs a split second to recognize the double click before it's ready to accept text for username/password. The "2" at the end of the Click command is for "double click."


I will probably have to edit some of the above, but most of the scripts are stable. The ones noted as clunky mean they simulate mouse clicks relative to my machine and won't function nicely on someone else's without using WindowSpy to get coordinates and editing the script.
 
Reply With Quote
Robb
Old 08-08-2009, 06:13 PM #22 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Quote:
Originally Posted by Nakamura
Awesome stuff Robb! ... awesome thread for beginners to pick up the basics.
Thanks!! I wouldn't have done it at all if you and Rage hadn't got me thinkin...

Quote:
Originally Posted by Nakamura
BTW, I was playing on full tilt this week and the queing process seems better. There still seemed to be one or two snags. Is it fixed?
It is way fixed with the new FTP client software. Nicely, the most vital table opens IN EACH STACK (most of the time), not just in the main stack. So you can glance at the upcoming action on important tables while auto-folding in the main stack. When you learn what various activities (like opening/closing the lobby) will do to the main stack, it's pretty easy to not ever time out 'cuz an active table disappears.

Plus, my betting scripts work seamlessly with the MoveTable script (woot woot). You and Rage improved my poker productivity at least 60% with your table management scripts, and my betting scripts have added another 40%. So I've at least doubled the number of tables I can concentrate on at one time, with "concentrating" meaning I have time to take notes, look at popup HUD stats and analyze all the "tough spots."
 
Reply With Quote
Stacks
Old 08-08-2009, 09:30 PM #23 (permalink)  
Stacks's Avatar
4-of-a-Kind

Join Date: Jan 2008
Location: Im opedipus bitch, the original balla.
Posts: 2,604
Stacks will become famous soon enoughStacks will become famous soon enough
I have a question here...

I'm trying to create a script so that when I use xbutton2 on my mouse, the HEM instant hand history will open.



Using the SendInput function I have it working:

XButton2::
SendInput {Click 368, 126}
return

However, the problem is I see the mouse movement. I was wondering how I can get it to work seamlessly, so looked on the AHK website and found the ControlClick function.

The ControlClick function (XButton2::ControlClick x368 y126,A) works perfectly for everything; except, the manner in which I'm trying to use it. Because it needs to click on the HUD, it doesn't seem to work. It seems as if it is sending a virtual mouse click behind the HUD, instead of clicking the part where they HUD is.

Does anymore know how to remedy this situation so I can get this working?

Thanks for any help.
Reply With Quote
Robb
Old 08-08-2009, 09:49 PM #24 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Try starting script with SetBatchLines -1 or SetMouseDelay -1? Scripts have an "auto-sleep" of 10 - 20 ms between commands, which you can reduce to 0. Dunno if it will speed up the first script enough to make your happy or not, but the details are here:

SetMouseDelay

Might help you figure out what's slowing it down. My scripts using SendInput work instantly - I can't see anything but a jump to final state.
 
Reply With Quote
Keith
Old 08-09-2009, 12:36 AM #25 (permalink)  
Full House

Join Date: Nov 2008
Posts: 1,335
Keith will become famous soon enoughKeith will become famous soon enough
is it worth having a scripts sticky or even forum , so that people can post scripts they are having trouble writing or working on , and then stickied completed scripts
Reply With Quote
r9453
Old 08-09-2009, 03:04 AM #26 (permalink)  

Join Date: Jul 2009
Location: Australia
Posts: 30
r9453
It took me longer than I would have thought to get this to work but fwiw, here is a PT3 version of the HEM Initialize script:
SetTitleMatchMode 2
Run %A_ProgramFiles%\PokerTracker 3\PokerTracker.exe
WinWait, Database, , 15
SetControlDelay -1
ControlClick, Begin Auto Import,,,,,NA
WinMinimize, Database
Return
Sound off like ya gotta pair!
 
Reply With Quote
Rage2100
Old 08-09-2009, 02:20 PM #27 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Quote:
Originally Posted by XxStacksxX
The ControlClick function (XButton2::ControlClick x368 y126,A) works perfectly for everything; except, the manner in which I'm trying to use it. Because it needs to click on the HUD, it doesn't seem to work. It seems as if it is sending a virtual mouse click behind the HUD, instead of clicking the part where they HUD is.
I think you need to change the "A" part to the name of the window that you want to click. You can get this from AHK Window Spy. I think the HUD overlay is the name of the table with "overlay" added onto the end. Obviously, this will only then work for that particular table, so you would need to read the name of each table before you sent the click command.

I'm out for the rest of the day, but I'll try and have a go over the next couple of days, unless you or Robb beat me to it.
Reply With Quote
Stacks
Old 08-09-2009, 08:18 PM #28 (permalink)  
Stacks's Avatar
4-of-a-Kind

Join Date: Jan 2008
Location: Im opedipus bitch, the original balla.
Posts: 2,604
Stacks will become famous soon enoughStacks will become famous soon enough
That's it Rage. I gave it a go sing the HUD title on one of my tables, and it worked flawlessly. Unfortunately, I'm a bit of an ahk n00b, so I have absolutely no idea how to read the table name before sending the click command.

I'll be trying my best to figure it out, but really don't even know what I'm looking for. Any help is appreciated.
Reply With Quote
Rage2100
Old 08-10-2009, 06:21 PM #29 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Try this, Stacks. Basically, it grabs the title of the window when you press the XButton2 on your mouse. It then finds the position of the "$" sign in the title, takes 3 places off it, which just leaves the table name, and adds "overlay" to the end. Then it sends the control click. I've given it a quick test, but let me know if you have any problems.

Code:
XButton2::
MouseGetPos,,,tableID
WinGetTitle, title, ahk_id %tableID%
IfNotInString, title, overlay
{
   StringGetPos, move_pos, title, $
    move_pos:=move_pos-3
     StringLeft, title, title, %move_pos%
      title=%title%overlay
       ControlClick, x368 y126, %title%
} else
ControlClick, x368 y126, %title%
return
Reply With Quote
Stacks
Old 08-10-2009, 09:46 PM #30 (permalink)  
Stacks's Avatar
4-of-a-Kind

Join Date: Jan 2008
Location: Im opedipus bitch, the original balla.
Posts: 2,604
Stacks will become famous soon enoughStacks will become famous soon enough
I gave it a try, but no luck. Fwiw, I'm playing cash games on Pokerstars using the default tables. I went and double checked the coordinates, and tried it on a few cash tables, as well as SNG tables, and no luck.

I appreciate your help. I just wish I could help more.
Reply With Quote
Rage2100
Old 08-10-2009, 11:41 PM #31 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Quote:
Originally Posted by XxStacksxX
I gave it a try, but no luck. Fwiw, I'm playing cash games on PokerStars using the default tables. I went and double checked the coordinates, and tried it on a few cash tables, as well as SNG tables, and no luck.
Hmmm, are you sure you have the correct co-ordinates entered into the script? The co-ordinates for the HUD overlay stats are slightly different from those of the exact same position on the poker table itself. If you load up the AHK Window Spy and physically click the HUD stat so that the instant HH opens, you will get the correct co-ordinates.

Also, the co-ordinates appear in two places in the script, so if you change them, remember to change both sets.

I've just tried it on Poker Stars cash tables and it seems to work ok. The only difference I have in my version is I use the F1 key instead of the XButton2.
Reply With Quote
Nakamura
Old 08-11-2009, 04:51 PM #32 (permalink)  
Nakamura's Avatar
4-of-a-Kind

Join Date: Mar 2008
Location: Grindin'
Posts: 1,515
Nakamura is an unknown quantity at this point
Quote:
Originally Posted by XxStacksxX
I gave it a try, but no luck. Fwiw, I'm playing cash games on Pokerstars using the default tables. I went and double checked the coordinates, and tried it on a few cash tables, as well as SNG tables, and no luck.

I appreciate your help. I just wish I could help more.
I just tested this for Rage and it works fine. As Rage suggested to me, the co-ordinates for the HUD overlay stat are slightly different than those of the poker table for the exact same position, so make sure the HUD overlay window is active before getting the co-ordinates.
Reply With Quote
Rage2100
Old 08-11-2009, 06:14 PM #33 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Thanks for testing that, Naka. Here is a slightly better version, as you only have to enter the co-ordinates once, at the top of the script.

Code:
X=368
Y=126

XButton2::
MouseGetPos,,,tableID
WinGetTitle, title, ahk_id %tableID%
IfNotInString, title, overlay
{
   StringGetPos, move_pos, title, $
    move_pos:=move_pos-3
     StringLeft, title, title, %move_pos%
      title=%title%overlay
       ControlClick, x%X% y%Y%, %title%
} else
ControlClick, x%X% y%Y%, %title%
return
Reply With Quote
Robb
Old 08-11-2009, 07:35 PM #34 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
Wheeeeeee!!

Rage pwn'ing the thread and making my scripting look 2nl-ish :P

Would you like to auto-sit-in to all your tables after a quick break? Me too. So here's an attempt I have partially debugged. What it does successfully:

1. Counts number of Full Tilt windows open (important for loop statement some day).
2. Queries if "auto post blinds" box is checked.
3. If not, it clicks on it for you.
4. If yes, nothing happens.

Code:
CoordMode, mouse, screen
CoordMode, pixel, screen

WinGet Number, Count, ahk_class QWidget

GroupAdd FP, ahk_class QWidget
WinActivate FTP
PixelSearch,Px,Py,380,500,382,502,0x000000,10
If ErrorLevel
  SendInput {Click 381, 501}
return

; The rectangle from (378,498) top left to (386,505) should all be white pixels (0xffffff) when "Auto-post 

blinds" button is NOT selected.
For some reason, I CAN make it work if I use screen coordinates, but I can't the right window activated and use window coordinates, so making it loop and auto-check all blinds boxes can't happen, yet.

As you can see, when I get this looping and functioning happily, it will take very little effort to do the following:

A. Check all active tables for timers. If they exist, click on them to start extra time banks.
B. Deactivate "auto post blinds" on all tables to sit out when the BB comes around.
C. Activate the "sit out" box on all tables for emergency exits.

So this could lead to some really nice features so PLEASE PLEASE HELP anyone who has suggestions. K thx.
 
Reply With Quote
Rage2100
Old 08-11-2009, 11:30 PM #35 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Robb, have you tried the GroupActivate command to cycle through the tables?

Code:
GroupAdd, Tables, ahk_class QWidget
WinGet, Number, Count, ahk_class QWidget
Loop %Number%
{
   GroupActivate, Tables
    Sleep 500
}
Reply With Quote
Robb
Old 08-12-2009, 12:06 AM #36 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
All right - thanks Rage - I've got the loop set up and ID'ing each table in the group. Now I've got to see if I can get the IF commands running.
 
Reply With Quote
Robb
Old 08-12-2009, 12:34 AM #37 (permalink)  
4-of-a-Kind

Join Date: Aug 2007
Posts: 3,068
Robb is an unknown quantity at this point
OK, I've got the mother functioning :P Here's a script that checks each Full Tilt table and clicks "auto post" if it's not checked. You have to set the correct coordinates in PixelSearch and Click commands, so it's a bit clunky. But it works!!

Code:
WinGet Number, Count, ahk_class QWidget
GroupAdd FTP, ahk_class QWidget
Loop %Number%
{
GroupActivate FTP
WinGetActiveTitle Current
  PixelSearch,Px,Py,312,498,315,502,0x000000,10
  If ErrorLevel
  {
    IfWinActive Full Tilt Poker - Logged In As *******
      WinMinimize
    IfWinNotActive Full Tilt Poker - Logged In As *******
      SendInput {Click 314, 500}
  }
}
return
Edit: Cleaned up code above. The "IfWinActive" command minimizes the Lobby - shadows were being left over from it being maximized and checked, so the minimize command cleans up my screen. It worked (works) fine without that.

I also updated my betting script to make all the hotkey statements cleaner. I have my common preflop/flop bets (every BB increment between $2 and $5) set as special mouse clicks. I then have Ctrl + Numpad6 set to auto bet $6, and so forth. I've given the basics of the scripts below, but not every single line.

Code:
#IfWinActive ahk_class QWidget

;==============================
;  Opens 3.5BB or BetPot
;==============================
MButton::SendInput {Click 660,400}{Click 660,480}{Click 480,480,0}

;==============================
;  Opens 3BB or BetPot minus 1BB
;==============================
^MButton::SendInput {Click 660,400}{Click 660,420,0}{WheelDown}{Click 660,480}{Click 480,480,0}

;==============================
;  RtClick Auto Bets $2, $2.50, $3 ...
;==============================
^RButton::SendInput {Click 660,400}{Click 675,415,2}3{Click 660,480}{Click 480,480,0}
+RButton::SendInput {Click 660,400}{Click 675,415,2}3.5{Click 660,480}{Click 480,480,0}
;you get the idea...

;==============================
;  NumPad Auto Bets $6, $6.50, $3 ...
;==============================

^Numpad6::SendInput {Click 660,400}{Click 675,415,2}6{Click 660,480}{Click 480,480,0}
^#Numpad6::SendInput {Click 660,400}{Click 675,415,2}6.5{Click 660,480}{Click 480,480,0}
^Numpad7::SendInput {Click 660,400}{Click 675,415,2}7{Click 660,480}{Click 480,480,0}
^#Numpad7::SendInput {Click 660,400}{Click 675,415,2}7.5{Click 660,480}{Click 480,480,0}
;and so on...
 
Reply With Quote
Rage2100
Old 08-12-2009, 02:17 AM #38 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Impressive... most impressive.

It's great when you get these things to work properly. I got pretty addicted to writing them a few months back, when I started learning it. The only thing you have to watch out for, is that you don't spend more time writing the scripts than playing poker.
Reply With Quote
Rage2100
Old 08-12-2009, 07:39 PM #39 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Hey, Stacks. Did you manage to get it working?
Reply With Quote
Stacks
Old 08-12-2009, 10:19 PM #40 (permalink)  
Stacks's Avatar
4-of-a-Kind

Join Date: Jan 2008
Location: Im opedipus bitch, the original balla.
Posts: 2,604
Stacks will become famous soon enoughStacks will become famous soon enough
Ugh.. I must be retarded or something. But I have opened WindowSpy, and clicked on the HUD which gives me coordinates of {367, 99}. This is with the title & class in window spy reading the table name + overlay (so it is the HUD that is active.

I've changed the script to include those coordinates, saved, reloaded script, etc. But when I hover over the table, and use the desired button, nothing happens. However, when I hover over the overlay, even in places where a click shouldn't open the HH, if I then use the desired button the HH will open. So it seems it is working when I'm hovering anywhere on the overlay. I'm not sure if it is coded this way or not. Ideally, it would work if I clicked anywhere inside the table with the HH wish to see.
Reply With Quote
Rage2100
Old 08-13-2009, 11:50 AM #41 (permalink)  
Rage2100's Avatar
Full House

Join Date: Jan 2007
Location: UK
Posts: 719
Rage2100 is on a distinguished road
Quote:
Originally Posted by XxStacksxX
I've changed the script to include those coordinates, saved, reloaded script, etc. But when I hover over the table, and use the desired button, nothing happens. However, when I hover over the overlay, even in places where a click shouldn't open the HH, if I then use the desired button the HH will open. So it seems it is working when I'm hovering anywhere on the overlay. I'm not sure if it is coded this way or not. Ideally, it would work if I clicked anywhere inside the table with the HH wish to see.
That is just weird! The co-ordinates are obviously correct, as the HH opens when you are hovering over a HUD stat. It should open whether you are hovering over a HUD stat, or the table itself.

Can you change the XButton2 to the F1 key, and see if that works? That is the only difference in my version, as I don't have the XButton2 on my mouse.

PM me if you want, and we'll try to get it working.
Reply With Quote
kninja
Old 04-12-2010, 08:02 AM #42 (permalink)  
High Card

Join Date: Apr 2010
Posts: 2
kninja is on a distinguished road
is this script still working with latest HM
trying to run this; it load HM but the import function doesn't start
is there an update to this?

Thanks in advance

K.
Reply With Quote
mtcvision
Old 04-13-2010, 08:48 AM #43 (permalink)  
BANNED
High Card

Join Date: Apr 2010
Posts: 3
mtcvision is on a distinguished road
{link removed by moderator "Warpe", user banned}
Reply With Quote
kninja
Old 04-13-2010, 09:20 AM #44 (permalink)  
High Card

Join Date: Apr 2010
Posts: 2
kninja is on a distinguished road
above file contain a virus
Reply With Quote
poke_her_4_life
Old 10-16-2010, 02:37 PM #45 (permalink)  
poke_her_4_life's Avatar
High Card

Join Date: Oct 2010
Location: Green Bay, WI
Posts: 10
poke_her_4_life is on a distinguished road
this totally works, u rock man and you deserve a noble poker prize...
Reply With Quote
Reply
Latest Poker News
KoRnholio Old 05-26-2012, 03:08 PM    Australia Legalized Online Poker coming up in next 6 to 12 Months
According to an email sent out by Mark Bryan, a gaming analyst at Merrill Lynch, the Australian government plans to legalize online poker sometime in the next six to 12 months. This move will coincide ...

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:56 AM.


FTR Testimonials

All content
© FlopTurnRiver.com
Advertising  |   Partners  |   Testimonials  |   T&C  |   Contact Us  |   FTR News & Press  |   Site Map  |   Search FTR

Full Tilt  |   Titan Poker  |   UltimateBet  |   Poker Stars  |   Ladbrokes Bonus  |   Sportsbook  |   Cake Poker  

Play Texas Holdem Online, Online Texas Holdem Strategy, & Poker Forum
This is not a gambling website.