Auto hotkeys for iPoker (Coral Poker)

  • 6 replies
    • VorpalF2F
      VorpalF2F
      Super Moderator
      Super Moderator
      Joined: 02.09.2010 Posts: 8,904
      Hi, Splitas,
      Ooooh, wouldn`t that be nice :D

      There actually is such a program, but it is fiercely expensive (60$ per year), and has nowhere near the capabilities of TableNinja.

      If you are adept with AutoHotKey scripts, perhaps you could create one.

      Best of luck,
      VS
    • tonypmm
      tonypmm
      Silver
      Joined: 11.01.2009 Posts: 3,853
      Hi all, there are a couple of tools advertised in the Russian community (I'm not sure if they can be promoted in the English one, if not, erase the links):

      Universal Poker Table Organizer
      iTable beta (by the author of iPoker Editor - a layout manager).

      I can't tell how they work because I use a simplistic self-written AHK script that just clicks buttons of the client (it's not good for sharing because it's written for minimum size (480x360) tables that I use and doesn't adapt to table resizing).
    • VorpalF2F
      VorpalF2F
      Super Moderator
      Super Moderator
      Joined: 02.09.2010 Posts: 8,904
      Hi, tonypmm
      I think that links to other PokerStrategy.com communities are OK, but I've asked the upper-level types.

      In your AHK script, how to you ensure that the clicks don't go the wrong table?

      I had a go at writing one a while back, but it had a problem where I'd press the hotkey but another window would become active and get the keystroke.

      Cheers,
      VS



    • tonypmm
      tonypmm
      Silver
      Joined: 11.01.2009 Posts: 3,853
      Originally posted by VorpalF2F
      In your AHK script, how to you ensure that the clicks don't go the wrong table?

      I had a go at writing one a while back, but it had a problem where I'd press the hotkey but another window would become active and get the keystroke.
      That's indeed a problem. I save the handle of the window (table) and then reactivate the window before every emulated mouse click (even if they're adjacent in the code). In practice, this approach works reliably enough.

      The code (for the table under the mouse) is like this:

      code:
      ~MButton::  ; middle mouse button will bet/raise
      MouseGetPos, x, y, id  ; get the relative coords x & y of the mouse and the ID of the window under it
      WinGetClass, winclass, ahk_id %id%  ; get the window class
      if winclass = PTIODEVICE  ; check if the window is of an iPoker client, if not, do nothing
        {
         IfWinNotActive, ahk_id %id%
         WinActivate, ahk_id %id%  ; activate the window	
         Click, 405, 330  ; click 'Bet'
         IfWinNotActive, ahk_id %id%  
         WinActivate, ahk_id %id%  ; reactivate the window in case focus has been stolen
                                   ; so that the mouse cursor returns to the correct window
         MouseMove, %x%, %y% ; move the mouse back
        }
    • tonypmm
      tonypmm
      Silver
      Joined: 11.01.2009 Posts: 3,853
      Actually, I've just realised that I've been overthinking the problem.

      Especially if you wish to apply this to a script working with stacked tables, just get the coordinates of the upper left corner of the window using WinGetPos, set the coordinate mode for mouse clicks to absolute.

      An analogous code with this approach (but clicking the 'Bet' button in the initially active window instead of the window under the mouse and also adjusting to the table size) would be:

      code:
      ; untested, be careful!!
      CoordMode, Mouse, Screen  ; set the coord mode to absolute
      ~MButton::  ; middle mouse button will bet/raise
      IfWinExist, A  ; just to set the 'Last Found Window' to the active one 
      WinGetClass, winclass  ; get the window class
      if winclass = PTIODEVICE  ; check if the window is of an iPoker client, if not, do nothing
        {
         WinGetPos, x, y, w, h  ; get the absolute coords x & y of the upper left corner, the window size w & h
         MouseGetPos, mouse_x, mouse_y  ; get the coords of the mouse
         WinGet, active_id, ID, A  ; get the ID of the currently active window
         WinActivate  ; reactivate the target window in case focus has been stolen
         Click, % %x%+405*%w%//480, % %y%+330*%h%//360  ; click 'Bet' there
                              ; '% ' are here to force expressions - 'Click' doesn't support them by default
         WinActivate, ahk_id %active_id%  ; return focus
         MouseMove, %mouse_x%, %mouse_y% ; move the mouse back
        }

      If you need to send clicks to the table under the mouse, then the code becomes
      code:
      ; untested, be careful!!
      CoordMode, Mouse, Screen  ; set the coord mode to absolute
      ~MButton::  ; middle mouse button will bet/raise
      MouseGetPos, mouse_x, mouse_y, id  ; get the coords of the mouse and the id of the window under it
      IfWinExist, ahk_id %id%  ; just to set the 'Last Found Window' to the target one 
      WinGetClass, winclass  ; get the window class
      if winclass = PTIODEVICE  ; check if the window is of an iPoker client, if not, do nothing
        {
         WinGetPos, x, y, w, h  ; get the absolute coords x & y of the upper left corner, the window size w & h
         WinGet, active_id, ID, A  ; get the ID of the currently active window
         WinActivate  ; activate the target window
         Click, % %x%+405*%w%//480, % %y%+330*%h%//360  ; click 'Bet' there
                              ; '% ' are here to force expressions - 'Click' doesn't support them by default
         WinActivate, ahk_id %active_id%  ; return focus
         MouseMove, %mouse_x%, %mouse_y% ; move the mouse back
        }


      But, to ensure robustness, we still need to reactivate the target window before every click.

      Realising right now that '% ' has to be used to force expressions in 'Click' has been quite an enlightenment to me, an AHK fish :f_biggrin:

      I have to go to bed now, shall fix my iPoker code soon with this knowledge to allow for resizing :f_cool:
    • VorpalF2F
      VorpalF2F
      Super Moderator
      Super Moderator
      Joined: 02.09.2010 Posts: 8,904
      Thanks,
      I'll dig out my iPoker AHK script and see what I can do.

      Thanks,
      VS