Jump to content

Need Help With Code


Recommended Posts

One small potential issue with your code, Ron:

$actionField = 461808

What does the number signify here? It looks like a handle to me and if it is, it won't work for Barry.

Link to comment
Share on other sites

  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Moderators

A few more post on this one LxP and we will both be at 300 :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

It's the Control ID of the box, it will work.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Press CTRL-ALT-F to pause the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Watching: Play money 873517 - Hold'em - 5/10. Good Luck @@party

Class: WindowsForms10.window.8.app3

Size: X: 46 Y: 568 W: 696 H: 167

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Window: X: 130 Y: -201

Cursor ID: 5

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xECE9D8 Dec: 15526360

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size:

Control ID:

ClassNameNN:

Text:

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

Pot Size to justify call:

A

Q

6

K

8

(Straight:1.7%, Two Pairs:1%, others:.7%)

3.4%

Chance to Win:

1.17%

Hand Rank:

High Card Ace

Pocket Rank: 112 / 169

My Pos: 4/7, MID

Bet Cost:

Players Left: 6

Check <<<----(THIS IS WHAT I WANT IT TO READ)

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

T

7

on board

CAUTION! Possible

STR8

FULL

FLUSH

Edited by drbarry920
Link to comment
Share on other sites

  • Moderators

(Straight:1.7%, Two Pairs:1%, others:.7%)

3.4%

Chance to Win:

1.17%

Hand Rank:

High Card Ace

Pocket Rank: 112 / 169

My Pos: 4/7, MID

Bet Cost:

Players Left: 6

Check <<<----(THIS IS WHAT I WANT IT TO READ)

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size:  X: 488    Y: 40    W: 88    H: 48

Control ID: 461808

ClassNameNN: WindowsForms10.STATIC.app34

Text:  Fold      <<<< Actually that's what you want to read

Style:  0x5600000D

ExStyle:  0x00000000

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

A few more post on this one LxP and we will both be at 300 :)

You betcha! :evil:

It's the Control ID of the box, it will work.

My mistake; I wasn't aware of control IDs in numeric form.

Barry, does Ron's latest script work for you? If not, could you please do what you just did again but this time placing the mouse over the area that serves your suggestion, and posting the 'Control Under Mouse' result?

Link to comment
Share on other sites

  • Moderators

P.S. --- you need to edit the top of you post... You have you username for Party Poker up there!!

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

change the control id then:

From: 461808

To: 2163556

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Here's current text:

Opt("WinTitleMatchMode", 4)

; Window names

$pokerWindow = "Play money 873517"

$brainWindow = "classname=WindowsForms10.window.8.app3"

; Poker button control IDs

$foldButton = "AfxWnd42s14"

$checkButton = "AfxWnd42s15"

$callButton = "AfxWnd42s15"

$betButton = "AfxWnd42s16"

$raiseButton = "AfxWnd42s16"

; No Hands action suggestion field

$actionField = 2163556

; Wait for the two windows to be displayed

WinWait($pokerWindow)

WinWait($brainWindow)

MsgBox(64, "AutoIt", "Both windows now exist; starting loop")

while (WinExists($pokerWindow) And WinExists($brainWindow))

Sleep(300)

$foldVisible = ControlCommand($pokerWindow, "", $foldButton, "IsVisible", "")

$raiseVisible = ControlCommand($pokerWindow, "", $raiseButton, "IsVisible", "")

if ($foldVisible = 1) Then

MsgBox(64, "AutoIt", "Fold is visible; attempting to read from brain in a moment")

Sleep(Random(1500, 2500))

$action = ControlGetText($brainWindow, "", $actionField)

MsgBox(64, "AutoIt", "Brain returns:" & @CRLF & $action)

If $action = "Fold" Then ControlClick($pokerWindow, "", $foldButton)

If $action = "Check" Then ControlClick($pokerWindow, "", $checkButton)

If $action = "Bet" Then ControlClick($pokerWindow, "", $betButton)

If $action = "Raise" Then ControlClick($pokerWindow, "", $raiseButton)

If $action = "Call" Then ControlClick($pokerWindow, "", $callButton)

EndIf

WEnd

Link to comment
Share on other sites

Is it possible that the details of this control are changing across runs of the program? In your initial script you addressed it as WindowsForm10.STATIC.app314 but in your last post it was masquerading as WIndowsForms10.STATIC.app327.

Are you absolutely positive that you had your mouse over the correct control and not one nearby? Try moving the mouse cursor across all areas of the suggestion control and see if the details in 'Control Under Mouse' change. If they don't then could you please press Ctrl+Alt+F to freeze AutoIt Window Info and then copy that part of the information to e.g. Notepad?

Then please try fully shutting down your Poker software, loading the boxes again and repeating the above procedure. Are there differences in the values shown by AutoIt Window Info for that control?

Link to comment
Share on other sites

It Changed. It was the same throughout the box each time though. What do you think that means and what can I do about it?

1st Test:

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 464 Y: 96 W: 80 H: 32

Control ID: 2163556

ClassNameNN: WindowsForms10.STATIC.app327

Text:

New Poker window:

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 464 Y: 96 W: 80 H: 32

Control ID: 1770426

ClassNameNN: WindowsForms10.STATIC.app317

Text: Fold

Link to comment
Share on other sites

I think it means that someone's trying to make it hard for you to read the value! :)

The position and size of the control however is constant across sessions. Maybe we can rely on that to get the information related to it.

What we need to do then is adjust this line so that it works:

$actionField = _controlGetIDByPos($brainWindow, "", 464, 96, 80, 32)
$action = controlGetText($brainWindow, "", $actionField)

The problem here of course is that there isn't such a function (or at least it isn't obvious in the help file).

This leaves the option of looping through each and every control in the window for the one that matches the required coordinates. I'll take a look at the help file to see if that's easily done.

Link to comment
Share on other sites

This script will generate a ClassList.txt file on your desktop. Could you please run the script and attach ClassList.txt to a post? --

opt("winTitleMatchMode", 4)
local $outputFile = @desktopDir & "\ClassList.txt"
fileDelete($outputFile)
fileWrite($outputFile, stringReplace(winGetClassList("classname=WindowsForms10.window.8.app3"), @LF, @CRLF))

Edit: left a stupid test class name in the code.

Edited by LxP
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...