Page 1 of 2

How to get a value from another program

Posted: 21 Oct 2020, 16:27
by JediMindTricksUK
Hello there,

I'm trying to write a hotkey script for a poker application, but in order to know the right betsize to make, I need to know the value of the pot. How do I go about getting this value from the poker client?

I look forward to any help.

Re: How to get a value from another program

Posted: 21 Oct 2020, 18:09
by boiler
There is no one answer to this. This is very specific to which poker client you are using. Some put it in the chat, especially when all dealer messages are on, but some don’t have chat that is readable easily. Some put it in their log file. You would need to look at all the possible means of grabbing info from the poker client in question. Often, it takes a good bit of experience to determine how to do it and how to implement it.

Re: How to get a value from another program

Posted: 21 Oct 2020, 18:17
by swagfag
unless the program provides an API to export this data in a way that u can then conveniently consume, there are 2 approaches:
  • the computer one: reverse engineer where the value is stored in memory and read it from there(RPM)
  • and the human one: analyze what u see on-screen, extract the data from it(OCR and similar computer vision related techniques)

Re: How to get a value from another program

Posted: 21 Oct 2020, 18:36
by boiler
Online poker sites are not in the business of providing APIs, so that’s generally out. However, there are still often means of grabbing the pot size and other information without having to read process memory or use image processing techniques like OCR. I mentioned two: The chat box on some sites has text that is readable by getting the text from a particular control (sometimes you need to turn on the more verbose chat option to get pot size information). Others put pot size and other information into a log file that can be read in real time.

Re: How to get a value from another program

Posted: 22 Oct 2020, 05:27
by JediMindTricksUK
Thanks for the replies. I really do appreciate you taking the time.

While the chatbox doesn't specifically list the potsize, all the relevant player betsizes are listed so with some easy multiplication I could get the size of the pot. How would I go about retrieving the text from the chatbox?

While that solution would work it's still not optimal. There may be other values that I would like to know that aren't listed in the catbox.


Ok, so I can see some ReadProcessMemory functions that other users have posted. Can someone guide me through what to do?

Re: How to get a value from another program

Posted: 22 Oct 2020, 06:42
by JediMindTricksUK
Ok, I understand the ReadProcessMemory function, but it requires the memory address where the value is stored. How can we find this considering that the memory location will not be the same every time?

Re: How to get a value from another program

Posted: 22 Oct 2020, 07:48
by boiler
JediMindTricksUK wrote: While the chatbox doesn't specifically list the potsize, all the relevant player betsizes are listed so with some easy multiplication I could get the size of the pot.
Is there on option to turn on all dealer messages in the chat box? Some sites list the pot size when dealing the next street if you have it on the most verbose setting.
JediMindTricksUK wrote: How would I go about retrieving the text from the chatbox?
Use the Window Spy tool that comes with AHK and click on the chat box and see if shows info for it as a separate control. See if it shows any of the chat text in the spy tool.
JediMindTricksUK wrote: While that solution would work it's still not optimal. There may be other values that I would like to know that aren't listed in the catbox.
Have you checked the contents of the log file? It would probably be located under your user AppData folders. That can be a goldmine of information and is pretty easy to pull information from.
JediMindTricksUK wrote: Ok, so I can see some ReadProcessMemory functions that other users have posted. Can someone guide me through what to do?
That is not easy to do if you’re not a experienced programmer. You would have to locate the appropriate memory location by searching for the pot size when it is a known value, however it might be represented in memory, which might not be obvious. Since the pot size is constantly changing, you would have to be fast. And when there are updates to the client software, they will often break your tool and you’ll have to go through the process again. It’s too involved for me to guide you, but perhaps swagfag might want to walk you through it if he’s experienced with it.

You probably know this already, but depending on the site, there are tools out there that do this kind of thing (set bet amounts, etc.), such as StarsHelper. Do you know if there is such a tool for your client? Or perhaps you know there is but want to create your own tool anyway.

Re: How to get a value from another program

Posted: 22 Oct 2020, 08:50
by JediMindTricksUK
Hi boiler, Thanks for taking the time.
boiler wrote:
JediMindTricksUK wrote: While the chatbox doesn't specifically list the potsize, all the relevant player betsizes are listed so with some easy multiplication I could get the size of the pot.
Is there on option to turn on all dealer messages in the chat box? Some sites list the pot size when dealing the next street if you have it on the most verbose setting.
Even with the chatbox set to the most verbose setting it still doesn't list the pot size, but like I said, it does list all the individual bet sizes so I could caveman it to get the pot size that way. With that being said, other information, like a players stack size could be useful to know and that definitely isn't output.
boiler wrote:
JediMindTricksUK wrote: How would I go about retrieving the text from the chatbox?
Use the Window Spy tool that comes with AHK and click on the chatbox and see if shows info for it as a separate control. See if it shows any of the chat text in the spy tool.
For some reason, no controls are listed in Window Spy. The control under mouse position is blank. The class for the poker application is ApolloRuntimeContentWindow. Using Window Detective I can get the handle to 2 controls, both of which are class WebPluginView
boiler wrote:
JediMindTricksUK wrote: While that solution would work it's still not optimal. There may be other values that I would like to know that aren't listed in the catbox.
Have you checked the contents of the log file? It would probably be located under your user AppData folders. That can be a goldmine of information and is pretty easy to pull information from.
Yes I checked for a log file but there isn't one, unfortunately.
boiler wrote:
JediMindTricksUK wrote: Ok, so I can see some ReadProcessMemory functions that other users have posted. Can someone guide me through what to do?
That is not easy to do if you’re not a experienced programmer. You would have to locate the appropriate memory location by searching for the pot size when it is a known value, however it might be represented in memory, which might not be obvious. Since the pot size is constantly changing, you would have to be fast. And when there are updates to the client software, they will often break your tool and you’ll have to go through the process again. It’s too involved for me to guide you, but perhaps swagfag might want to walk you through it if he’s experienced with it.

You probably know this already, but depending on the site, there are tools out there that do this kind of thing (set bet amounts, etc.), such as StarsHelper. Do you know if there is such a tool for your client? Or perhaps you know there is but want to create your own tool anyway.
Yes I'm a noob but eager to learn. Using Cheat engine Memory Viewer i can see Information listed is momery locations like: pot="28" rake="0" etc so something is listing all the relevant info in a readable format. If I could just find out what!?

Yes, StarsHelper is the sort of thing I'm trying to create. One doesn't exist for the client I'm working with.

Re: How to get a value from another program

Posted: 22 Oct 2020, 10:47
by boiler
I would think you’d have an easier time using one of swagfag’s other suggestions: OCR. It could work very well if you’re just trying to pick off the pot size. It would probably be too slow to get everyone’s stack size unless you are playing HU.

Re: How to get a value from another program

Posted: 22 Oct 2020, 11:17
by malcev
Using cheat engine You can count offsets.
Read manual.

Re: How to get a value from another program

Posted: 24 Oct 2020, 04:50
by JediMindTricksUK
boiler wrote:
22 Oct 2020, 10:47
I would think you’d have an easier time using one of swagfag’s other suggestions: OCR. It could work very well if you’re just trying to pick off the pot size. It would probably be too slow to get everyone’s stack size unless you are playing HU.
While this would work, I would like to be able to do things like convert the monetary value to big blinds which would defiantly require knowing the memory location.

Re: How to get a value from another program

Posted: 24 Oct 2020, 04:55
by JediMindTricksUK
malcev wrote:
22 Oct 2020, 11:17
Using cheat engine You can count offsets.
Read manual.
I'll look into this. Thanks.

Re: How to get a value from another program

Posted: 18 Nov 2020, 08:32
by SalePepeCumino
boiler wrote:
22 Oct 2020, 07:48
JediMindTricksUK wrote: While the chatbox doesn't specifically list the potsize, all the relevant player betsizes are listed so with some easy multiplication I could get the size of the pot.
Is there on option to turn on all dealer messages in the chat box? Some sites list the pot size when dealing the next street if you have it on the most verbose setting.
JediMindTricksUK wrote: How would I go about retrieving the text from the chatbox?
Use the Window Spy tool that comes with AHK and click on the chat box and see if shows info for it as a separate control. See if it shows any of the chat text in the spy tool.
JediMindTricksUK wrote: While that solution would work it's still not optimal. There may be other values that I would like to know that aren't listed in the catbox.
Have you checked the contents of the log file? It would probably be located under your user AppData folders. That can be a goldmine of information and is pretty easy to pull information from.
JediMindTricksUK wrote: Ok, so I can see some ReadProcessMemory functions that other users have posted. Can someone guide me through what to do?
That is not easy to do if you’re not a experienced programmer. You would have to locate the appropriate memory location by searching for the pot size when it is a known value, however it might be represented in memory, which might not be obvious. Since the pot size is constantly changing, you would have to be fast. And when there are updates to the client software, they will often break your tool and you’ll have to go through the process again. It’s too involved for me to guide you, but perhaps swagfag might want to walk you through it if he’s experienced with it.

You probably know this already, but depending on the site, there are tools out there that do this kind of thing (set bet amounts, etc.), such as StarsHelper. Do you know if there is such a tool for your client? Or perhaps you know there is but want to create your own tool anyway.
Once I access to the info in the chat box with "Windows Spy Tool", How I could change the Percentage of the pot to insert? Which is the best command with AHK that allow me to change the value?

Thank you so much for your attention

Re: How to get a value from another program

Posted: 18 Nov 2020, 09:11
by boiler
It’s not just a command that would do it. And what you have to do depends on whether the bet entry box also has a control where the bet size text can be set directly or whether it needs to be sent to it as keystrokes.

Re: How to get a value from another program

Posted: 18 Nov 2020, 09:12
by SalePepeCumino
boiler wrote:
18 Nov 2020, 09:11
It’s not just a command that would do it. And what you have to do depends on whether the bet entry box also has a control where the bet size text can be set directly or whether it needs to be sent to it as keystrokes.
You're the best, thank you very mush!

Re: How to get a value from another program

Posted: 19 Nov 2020, 09:56
by SalePepeCumino
boiler wrote:
22 Oct 2020, 10:47
I would think you’d have an easier time using one of swagfag’s other suggestions: OCR. It could work very well if you’re just trying to pick off the pot size. It would probably be too slow to get everyone’s stack size unless you are playing HU.
Ok, I'm trying to setting up OCR with AHK script, but I'm super newbie.
Once OCR copy the text from the area I underlined, then how can I make them interact?
Ex.: OCR reveals that in the Area "CordX;CordY" there is a value of 5, and with AHK I want to get that number and divide it by a percentage. Then this number is put into a text (I think that, ex.: " ControlSend, 2," would be good for this part).

Thank you so much for your attention

Re: How to get a value from another program

Posted: 19 Nov 2020, 10:03
by SalePepeCumino
keep in mind that the value captured by OCR change a few times.

I didn't use Cheat Engine because I think it is not totally legal, right?

Re: How to get a value from another program

Posted: 19 Nov 2020, 10:11
by boiler
How you get the number depends on the details of the OCR package you are working with. Once you have 5 or whatever assigned to a variable, then you need to do the math using that variable.

Re: How to get a value from another program

Posted: 19 Nov 2020, 10:13
by boiler
SalePepeCumino wrote:
19 Nov 2020, 10:03
I didn't use Cheat Engine because I think it is not totally legal, right?
Check the terms of service for your poker site. It's possible your script itself would be considered a violation.

Re: How to get a value from another program

Posted: 19 Nov 2020, 13:47
by SalePepeCumino
boiler wrote:
19 Nov 2020, 10:11
How you get the number depends on the details of the OCR package you are working with. Once you have 5 or whatever assigned to a variable, then you need to do the math using that variable.
After I automate the process of Capture2Text, With which syntax I could copy the value captured this way into the AHK? Or how I can use the value captured this way for setting up a calculation like "x*0,5"?

Sorry guys for all the answers