AutoHotkey Community

It is currently May 26th, 2012, 8:53 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: June 23rd, 2009, 12:54 pm 
Hello,

I've made a script to automaticly load a new skin for Ongame client poker.
It works great but I'd like to add a new function :
- Detect everytime a new table is open
- Then close the chat box

So when I'm at the lobby, if I open a poker table, I want my AHK test if this window is a new one, and if yes, close the chat box.

Yet, I've done this. It works, but it doesn't test if the table (window) is a new one or not. So the problem is when I open for example 3 tables, and then navigate from one to the other, the script think it is a new window

Ok sorry for my really bad explanation let see this part of my pgm

Code:
; While the program exists and Everytime a new table is open, automaticly close the chat box
SetTitleMatchMode 2
Table=
TableSave=
Title=
Process, Exist, WinamaxPoker.exe
While (ErrorLevel > 0)
{
   WinWaitActive, No-limit Texas Hold'em,
   WinGetActiveTitle, Title
   StringLeft, Table, Title, 6
   If (Table <> "Winama")
   {   
      If (Table <> TableSave)
      {   
         Click, 767,303 ; close chat box
         Sleep, 100
         TableSave = %Table%
      }
   }
   Process, Exist, WinamaxPoker.exe
}
ExitApp
; pbm
; How to be sure to do this only ONE time for every NEW table
; I want to do this ONLY for a new table. So only if I double click in a finite zone and a new table open
; do not aply this for already open tables


Maybe I could transform this with SetTimer ?
How to save all open window id, and then test if it is a new one or not ?
The other solution could be to test if a double click is done in a specific region, and then wait for the new window, and close the chat box.
But in this case, how to wait for a "double click" in a certain zone (like for example from top80,left10 to bottom260,right80

Thanks for your help


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2009, 3:47 pm 
Quote:
how to wait for a "double click" in a certain zone (like for example from top80,left10 to bottom260,right80
OnMessage + MouseGetPos


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2009, 5:40 pm 
Offline

Joined: June 23rd, 2009, 12:57 pm
Posts: 10
Thanks,

The OnMEssage is WM_LBUTTONDBLCLK ?

And about GetPos is there an easy way to define a square/rectangle ?

Also :
Is there an easy solution to just test if a soft launch a new window.
Like this every time my soft launch a new window I'd only have to test if it is the one I'm waiting for.
When I say new, I really want this window never exists before. Not a window that become active. A new one


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2009, 6:37 pm 
Offline

Joined: June 23rd, 2009, 12:57 pm
Posts: 10
Ok I've tested this, but I never enter in the function

Code:
OnMessage(0x203, "WM_LBUTTONDBLCLK")
return

WM_LBUTTONDBLCLK(wParam, lParam)
{
   Process, Exist, WinamaxPoker.exe
   if ErrorLevel = 0
      ExitApp
   Else
   {
      MouseGetPos, xpos, ypos
      if ((xpos > 7) and (xpos < 486) and (ypos > 164) and (ypos < 557))
      {
         WinWaitActive, No-limit Texas Hold'em,   
         Click, 767,303 ; close chat box
         Sleep, 100
      }
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2009, 6:40 pm 
Offline

Joined: June 23rd, 2009, 12:57 pm
Posts: 10
The complete source code is this one

I've added the OnMessage after the
Code:
WinWaitActive, %SkinName% - %Langue%,


But the app I launch is a flash soft, and it looks like my script wil never receive messages from this app

Code:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.


; Lecture du fichier .ini
IniRead, Langue, WamSkins.ini, Config, ILangue
IniRead, SkinName, WamSkins.ini, Config, ISkinName
IniRead, ProgramPath, WamSkins.ini, Config, IProgramPath
IniRead, DirSource, WamSkins.ini, Config, IDirSource
IniRead, Programme, WamSkins.ini, Config, IProgramme
IniRead, PlaceMintPath, WamSkins.ini, Config, IPlaceMintPath
IniRead, DSkin, WamSkins.ini, Options, PSkin
IniRead, DPlaceMint, WamSkins.ini, Options, PPlaceMint
IniRead, DLimites, WamSkins.ini, Options, PLimites
IniRead, DStakes, WamSkins.ini, Options, PStakes
IniRead, DTables, WamSkins.ini, Options, PTables

if DPlaceMint=1
   CPM=+Checked

If DLimites = NL
   CNL=+Checked
If DLimites = PL
   CPL=+Checked
If DLimites = FL
   CFL=+Checked

if DStakes = Mic
   CMic=+Checked
if DStakes = Low
   CLow=+Checked
if DStakes = Med
   CMed=+Checked
if DStakes = High
   CHig=+Checked

if DTables = SH
   CSH=+Checked
if DTables = FH
   CFH=+Checked
if DTables = HU
   CHU=+Checked
if DTables = All
   CAll=+Checked
   
Gui, Add, Text, x12 y12 w100 h20 , Nom du Skin:
Gui, Add, Edit, x92 y12 w170 h20 vSkin, %DSkin%
Gui, Add, Button, x62 y262 w70 h20 , OK
Gui, Add, Button, x262 y262 w70 h20 , Cancel
Gui, Add, Text, x12 y52 w100 h20 , Lancer PlaceMint :
Gui, Add, CheckBox, x112 y42 w60 h30 vPlaceMint %CPM%,
Gui, Add, GroupBox, x12 y92 w110 h150 , LIMITES
Gui, Add, Radio, x22 y112 w100 h30 vNL %CNL%, No-Limit
Gui, Add, Radio, x22 y142 w100 h30 vPL %CPL%, Pot-Limit
Gui, Add, Radio, x22 y172 w100 h30 vFL %CFL%, Fix Limit
Gui, Add, GroupBox, x132 y92 w120 h150 , MISES
Gui, Add, Radio, x142 y112 w100 h30 vMic %CMic%, Micro
Gui, Add, Radio, x142 y142 w100 h30 vMin %CLow%, Minimales
Gui, Add, Radio, x142 y172 w100 h30 vMoy %CMed%, Moyennes
Gui, Add, Radio, x142 y202 w100 h30 vMax %CHig%, Maximales
Gui, Add, GroupBox, x262 y92 w120 h150 , TABLES
Gui, Add, Radio, x272 y112 w100 h30 vSH %CSH%, Short handed
Gui, Add, Radio, x272 y142 w100 h30 vFR %CFH%, Complète
Gui, Add, Radio, x272 y172 w100 h30 vHU %CHU%, Heads Up
Gui, Add, Radio, x272 y202 w100 h30 vAll %CAll%, Toutes
; Generated using SmartGUI Creator 4.0
Gui, Show, x279 y217 h311 w403, Chargeur de Skins Ongame V2.1
Return

GuiClose:
   ExitApp

ButtonCancel:
   ExitApp

ButtonOK:
   Gui, submit
   
   IniWrite, %PlaceMint%, wamskins.ini, Options, PPlaceMint
   IniWrite, %Skin%, wamskins.ini, Options, PSkin
   
   if NL=1
      IniWrite, NL, wamskins.ini, Options, PLimites
   if PL=1
      IniWrite, PL, wamskins.ini, Options, PLimites
   if FL=1
      IniWrite, FL, wamskins.ini, Options, PLimites
   if Mic=1
      IniWrite, Mic, wamskins.ini, Options, PStakes
   if Min=1
      IniWrite, Low, wamskins.ini, Options, PStakes
   if Moy=1
      IniWrite, Med, wamskins.ini, Options, PStakes
   if Max=1
      IniWrite, High, wamskins.ini, Options, PStakes
   if SH=1
      IniWrite, SH, wamskins.ini, Options, PTables
   if FR=1
      IniWrite, FH, wamskins.ini, Options, PTables
   if HU=1
      IniWrite, HU, wamskins.ini, Options, PTables
   if All=1
      IniWrite, All, wamskins.ini, Options, PTables
   
   DestinationFileName=TableImages.swf
   DestinationConfig=P5-data.xml
   TableImageSourceFile=%DirSource%\%Skin%\TableImages.swf
   ConfigSourceFile=%DirSource%\%Skin%\P5-data.xml

   ; Si Placemint est sur ON alors on le lance
   if (PlaceMint = 1)
   {
      Process, Exist, PlaceMint.exe
      if not ErrorLevel  ; No PID for PlaceMint was found.
      {
         Run, PlaceMint.exe, %PlaceMintPath%
         WinWait, PlaceMint
         WinMinimize
      }
      else
         Msgbox, PlaceMint est déjà actif sur votre system. Il ne sera pas relancé
   }
   
      Process, Exist, WinamaxPoker.exe
      if ErrorLevel  ; PID existe deja
      {
         Msgbox, Votre client de poker est déjà actif sur votre system. Vous devez le fermer avant de relancer. Arret de OSL
         exitapp
      }   
      
   ; EXECUTION de Winamax et LOGIN AUTO
   Run, %Programme%, %ProgramPath%
   WinWait, %SkinName% ahk_class FlashHostClass
   Sleep, 1000
   IfWinNotActive, %SkinName%, , WinActivate, Winamax,
   WinWaitActive, %SkinName%, 
   Send, {ENTER}

   WinWait, %SkinName% - %Langue%

   IfWinNotActive, %SkinName% - %Langue%, , WinActivate, %SkinName% - %Langue%,
   WinWaitActive, %SkinName% - %Langue%,

   ; MODIF SKIN TABLE
   FileDelete, %ProgramPath%\%DestinationFileName%
   FileCopy, %TableImageSourceFile%, %ProgramPath%\%DestinationFileName%
   FileDelete, %ProgramPath%\%DestinationConfig%
   FileCopy, %ConfigSourceFile%, %ProgramPath%\%DestinationConfig%

   ; On ferme le chat et on click sur Cash Game
   Click, 762, 309
   Sleep, 100
   Click, 141, 50
   Sleep, 100
   
   ; Gestion Choix LIMITE
   Click, 77, 115
   Sleep, 100
   
   if NL = 1
   {
      Click, 100, 145
      Sleep, 100
   }
   else if PL = 1
   {
      Click, 100, 162
      Sleep, 100
   }
   else if FL = 1
   {
      Click, 100, 179
      Sleep, 100
   }
   else
   {
      Click, 100, 145
      Sleep, 100
   }
   
   ; Gestion choix Stake
   Click, 237, 115
   Sleep, 100
   
   if Mic = 1
   {
      Click, 230, 145
      Sleep, 100
   }
   else if Min = 1
   {
      Click, 230, 162
      Sleep, 100
   }
   else if Moy = 1
   {
      Click, 230, 179
      Sleep, 100
   }
   else if Max = 1
   {
      Click, 230, 196
      Sleep, 100
   }
   else
   {
      Click, 230, 145
      Sleep, 100
   }
   
   ;Gestion choix table
   Click, 396, 115
   Sleep, 100
   
   if SH = 1
   {
      Click, 410, 145
      Sleep, 100
   }
   else if FR = 1
   {
      Click, 410, 162
      Sleep, 100
   }
   else if HU = 1
   {
      Click, 410, 179
      Sleep, 100
   }
   else if All = 1
   {
      Click, 410, 196
      Sleep, 100
   }
   else
   {
      Click, 410, 145
      Sleep, 100
   }

   Sleep, 100
   MouseClick, left,  419,  153
   Sleep, 100
   MouseClick, left,  419,  153
   Sleep, 100
   MouseClick, left,  496,  298
   Sleep, 2000
   MouseClick, left,  393,  170
   Sleep, 100
   
   ExitApp
   


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: coinman, oldbrother and 62 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