AutoHotkey Community

It is currently May 26th, 2012, 11:14 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: October 31st, 2008, 7:00 pm 
Hi!

I have the following problem. I'm trying to write a code for a poker programm. to select a specific window, i wrote the following:

Code:
~rbutton::
mousegetpos, x, y, Table
wingetpos, , , Breite, Höhe, ahk_id %Table%
if (Breite=518 AND Höhe=350)
 msgbox, This is a table
else
 msgbox, This is not a table
return


When i now use the mouse button while some window (NOT the poker window) is active the code works perfectly fine. Then, when i right-click on the (non-active) poker window the "This is not a table" box appears and the poker window is now active. But when I right-click again on the poker window nothing happens. I will have to left-click on another window first before it will work again. As mentioned, with other windows it works perfectly fine.

Thanks in advance and sorry for the bad english, i am german.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 7:21 pm 
Offline

Joined: June 2nd, 2008, 4:01 pm
Posts: 16
maybe try tooltip to see if the messagewindow is not messing things up
Code:
~rbutton::
mousegetpos, x, y, Table
wingetpos, , , Breite, Höhe, ahk_id %Table%
if (Breite=518 AND Höhe=350)
ToolTip This is a table
else
 ToolTip This is not a table
return



best of luck


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 7:27 pm 
wow, that was fast. thanks
I tried, but same problem.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 7:30 pm 
Offline

Joined: June 2nd, 2008, 4:01 pm
Posts: 16
Hi

or a different hotkey? maybe it interferes with some key used by the program?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 8:15 pm 
I tried a couple of Shortcuts. It's always the same problem. Also the click functino does not work in the poker window. Is it posible that the programm works with direct input?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 8:16 pm 
I tried a couple of Shortcuts. It's always the same problem. Also the click functino does not work in the poker window. Is it posible that the programm works with direct input?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 8:39 pm 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3329
Location: Simi Valley, CA
PdoubleU wrote:
Is it posible that the programm works with direct input?

That is possible. Another possibility is that the game client is using its own keyboard hook. You can possibly get around that by adding #IfWinActive, Title of your poker program before your hotkeys.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 9:10 pm 
I tried that, too. But unfortunately it doesn'work. Any other possibilities? Is it possible to somehow get around the direct-input-problem??


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 10:24 pm 
Offline

Joined: June 17th, 2008, 7:51 am
Posts: 243
Try this for debugging
Code:
~rbutton::
mousegetpos, x, y, Table
wingetpos, , , Breite, Höhe, ahk_id %Table%
if (Breite=518 AND Höhe=350)
 msgbox, This is a table %Breite%  %Höhe%  %Table%
else
 msgbox, This is not a table  %Breite%  %Höhe%  %Table%
return

_________________
Greetings
Rog


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 1st, 2008, 10:52 am 
Offline

Joined: June 2nd, 2008, 4:01 pm
Posts: 16
maybe to test you can put it in a loop and get the wingetpos from the active window

when you make your poker window active ............???? let us know what happpens :D

Code:
Gui +AlwaysOnTop
Gui, Add, Edit, W300 HwndEdit1
Gui, Add, Edit, W300 HwndEdit2
Gui, Show, AutoSize


SetTimer,alert,1000
return


alert:

wingetpos, , , Breite, Höhe, A
ControlSetText, ,%Breite% %Höhe%  , ahk_id%Edit1%
if (Breite=518 AND Höhe=350)
 ControlSetText, ,this is a table , ahk_id%Edit2%
else
ControlSetText, ,this is not a table , ahk_id%Edit2%
return

GuiClose:
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 1st, 2008, 4:24 pm 
Ok I tried both.
But still the same problem. When I click on the poker window when it is not active it works for one click. with the gui option I get the right "This is a table" and the corresponding High and Width.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2008, 3:02 pm 
any other ideas? Can I somehow get around the direct input??


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2008, 6:04 pm 
Offline

Joined: February 7th, 2008, 9:48 pm
Posts: 509
i do not know what you want to do but if the dimensions of the window are used to trigger action you can get them from the example with the gui and timer

the info is updated every second i presume that the poker window is not interupting this so you can get the info without even using a hotkey using controlgettext and the handle for the editcontrol

best regards


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2008, 10:22 pm 
ah ok. Now I understand. I works. The Gui shows me the right size of the pokerwindow. But that doesn't give me more information because the problem only exists when the poker window is active. I reduce the problem I tried the following:


coordmode, mouse, screen
rbutton::
mousemove, 788, 36
return

even this doesn't work (the coordinates are just examples) when the pokerwindow is active. how could that be?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2008, 3:28 pm 
Offline

Joined: February 7th, 2008, 9:48 pm
Posts: 509
the idea was that you do not have to use the hotkey but used the info from the gui to make a conditional next command (it seems the pokerprogram installs its own keyboardhook)




the height and width are in the gui updated every second as if you click your hotkey every second

you can read out the values from the gui in any other ahk program that is running and if they are the value you want you can add your commands


If breite=200
mousemove,788,36

best regards


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 54 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group