How to get a value from another program

Get help with using AutoHotkey and its commands and hotkeys
JediMindTricksUK
Posts: 6
Joined: 21 Oct 2020, 15:26

How to get a value from another program

21 Oct 2020, 16:27

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.
User avatar
boiler
Posts: 6631
Joined: 21 Dec 2014, 02:44

Re: How to get a value from another program

21 Oct 2020, 18:09

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.
swagfag
Posts: 4092
Joined: 11 Jan 2017, 17:59

Re: How to get a value from another program

21 Oct 2020, 18:17

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)
User avatar
boiler
Posts: 6631
Joined: 21 Dec 2014, 02:44

Re: How to get a value from another program

21 Oct 2020, 18:36

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.
JediMindTricksUK
Posts: 6
Joined: 21 Oct 2020, 15:26

Re: How to get a value from another program

22 Oct 2020, 05:27

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?
JediMindTricksUK
Posts: 6
Joined: 21 Oct 2020, 15:26

Re: How to get a value from another program

22 Oct 2020, 06:42

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?
User avatar
boiler
Posts: 6631
Joined: 21 Dec 2014, 02:44

Re: How to get a value from another program

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.
JediMindTricksUK
Posts: 6
Joined: 21 Oct 2020, 15:26

Re: How to get a value from another program

22 Oct 2020, 08:50

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.
User avatar
boiler
Posts: 6631
Joined: 21 Dec 2014, 02:44

Re: How to get a value from another program

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.
malcev
Posts: 829
Joined: 12 Aug 2014, 12:37

Re: How to get a value from another program

22 Oct 2020, 11:17

Using cheat engine You can count offsets.
Read manual.
JediMindTricksUK
Posts: 6
Joined: 21 Oct 2020, 15:26

Re: How to get a value from another program

24 Oct 2020, 04:50

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.
JediMindTricksUK
Posts: 6
Joined: 21 Oct 2020, 15:26

Re: How to get a value from another program

24 Oct 2020, 04:55

malcev wrote:
22 Oct 2020, 11:17
Using cheat engine You can count offsets.
Read manual.
I'll look into this. Thanks.
SalePepeCumino
Posts: 11
Joined: 13 Nov 2020, 09:47

Re: How to get a value from another program

18 Nov 2020, 08:32

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
User avatar
boiler
Posts: 6631
Joined: 21 Dec 2014, 02:44

Re: How to get a value from another program

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.
SalePepeCumino
Posts: 11
Joined: 13 Nov 2020, 09:47

Re: How to get a value from another program

18 Nov 2020, 09:12

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!
SalePepeCumino
Posts: 11
Joined: 13 Nov 2020, 09:47

Re: How to get a value from another program

19 Nov 2020, 09:56

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
SalePepeCumino
Posts: 11
Joined: 13 Nov 2020, 09:47

Re: How to get a value from another program

19 Nov 2020, 10:03

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?
User avatar
boiler
Posts: 6631
Joined: 21 Dec 2014, 02:44

Re: How to get a value from another program

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.
User avatar
boiler
Posts: 6631
Joined: 21 Dec 2014, 02:44

Re: How to get a value from another program

19 Nov 2020, 10:13

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.
SalePepeCumino
Posts: 11
Joined: 13 Nov 2020, 09:47

Re: How to get a value from another program

19 Nov 2020, 13:47

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

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], HiSoKa, songdg, TAC109 and 32 guests