Open Side Menu Go to the Top
Register
Question about small piece of ahk code I'm trying to get work, killing ftp leave table attempt Question about small piece of ahk code I'm trying to get work, killing ftp leave table attempt

08-19-2009 , 02:09 PM
Hi guys,

I am new to ahk, just trying to add a little bit of functionality to starsplanner. Stars planner currently kills all sorts of pop ups for stars, I was trying to get it to do the same thing for ftp in certain cases.

I have been trying for a few hours to get this to work, I don't know of any way of debugging or monitoring variables with ahk, so I just keep editing the file, saving and running to try to get it to work.

The following piece of code works to kill a stars pop that asks if I am sure I want to leave the table:


///////////////////////

IfWinExist, Table ahk_class #32770 ahk_pid%ps_pid%, Cancel
{
WinGet, idlist, list, Table ahk_class #32770 ahk_pid%ps_pid%, Cancel
Loop, %idlist%
{
id := idlist%A_Index%
ControlFocus, Button1, ahk_id%id%
ControlSend, Button1, {SPACE}, ahk_id%id%
}
}
/////////////////////////

i think #32770 is used for popup windows, and ahk_pid is the process id for pokerstars which was retrieved earlier in the code. Cancel is a text string that shows up on the popup, one of the buttons.

So I am trying to do essentialy the same thing for stars but nothing is happening. Here is my code:

////////////////////

WinGet, ftp_id, id, Full Tilt Poker
WinGet, ftp_pid, PID, ahk_id%ftp_id%

IfWinExist, heads up ahk_class #32770 ahk_pid%ftp_pid%, No
{
#space::MsgBox You pressed Win+Spacebar in Notepad.
}



///////////////////

For now I just want the message box to pop up so I know that the popup is being recognized, but the msgbox never shows. I have used the message box just in front of the if statement to make sure the code is reached and the message box works, and it does. "heads up" is in the title bar of the ftp popup just as Table is in stars, No is the text of one of the buttons just as Cancel is in stars. I used the same steps to get the processID for ftp as is used for stars. So I have no idea why it won't work.

I am just trying to accomplish the very simple task of recognizing when a certain popup is on and in the case of ftp i will have it press {UP}{SPACEBAR} to have it closed. So I have also tried things like:

/////////

ifWinExist, John ahk_class #32770, No
{
#space::MsgBox You pressed Win+Spacebar in Notepad.
SendInput {Space}
}
/////////////

The table name was John, basicly I have done all the testing I can think of, the title bar string does not hvae to be the start of the string, just any piece of it, I tested it with the working stars code. I have tried all variations of winExist for ftp, is it simply the case that somehow the ftp windows just do not provide this information? That would seem odd to me.

Any help would be greatly appreciated.
Question about small piece of ahk code I'm trying to get work, killing ftp leave table attempt Quote
08-19-2009 , 04:02 PM
I'm prolly not the best person for this as I don't know anything really about FTP, but since _dave_ is on vacation I'll try

The "ahk_class #32770" bit might not be right for FTP (you can find this using the Windows Spy" AHK thing). Also since FTP has started using the QT library the "No" text may not be visible to AHK.

Try this first (replace John with anything in the titlebar):

Code:
SetTitleMatchMode, 2
ifWinExist, John
{
  MsgBox, Window found
}
If that doesn't work then you know something is seriously wrong.

If that does work then try adding the "SendInput {Space}" bit and see if that works:

Code:
SetTitleMatchMode, 2
ifWinExist, John
{
  SendInput {Space}
}
Finally you need to figure out how best to match the title without matching other windows by accident (just try the above simple code first though).

Juk
Question about small piece of ahk code I'm trying to get work, killing ftp leave table attempt Quote
08-19-2009 , 04:14 PM
After looking at the code above then I think this may do what you want (ie: find all FTP windows containing the word's "heads up" and send a space key-press to them):

Code:
WinGet, ftp_id, id, Full Tilt Poker
WinGet, ftp_pid, PID, ahk_id%ftp_id%

SetTitleMatchMode, 2
IfWinExist, heads up ahk_pid%ftp_pid%
{
  WinGet, idlist, list, heads up ahk_pid%ftp_pid%
  Loop, %idlist%
  {
    MsgBox, Window found
    id := idlist%A_Index%
    ControlFocus, , ahk_id%id%
    ControlSend, , {SPACE}, ahk_id%id%
  }
}
If that doesn't work then also try this:
Code:
WinGet, ftp_id, id, Full Tilt Poker
WinGet, ftp_pid, PID, ahk_id%ftp_id%

SetTitleMatchMode, 2
IfWinExist, heads up ahk_pid%ftp_pid%
{
  WinGet, idlist, list, heads up ahk_pid%ftp_pid%
  Loop, %idlist%
  {
    MsgBox, Window found
    id := idlist%A_Index%
    ControlSend, ahk_parent, {SPACE}, ahk_id%id%
  }
}
Juk
Question about small piece of ahk code I'm trying to get work, killing ftp leave table attempt Quote
08-19-2009 , 11:35 PM
thank you very much for the responses, I was gone all day so didn't have time to work more on this, I'm going to try it out tomorrow
Question about small piece of ahk code I'm trying to get work, killing ftp leave table attempt Quote
08-20-2009 , 05:06 PM
thanks again, your code worked, all I added was some exclude text that was in the table name but not in the popup and {UP} before space:


IfWinExist, heads up ahk_pid%ftp_pid%,,Limit Hold'em
{
WinGet, idlist, list, heads up ahk_pid%ftp_pid%,,Limit Hold'em
Loop, %idlist%
{
id := idlist%A_Index%
ControlFocus, , ahk_id%id%
ControlSend, , {UP}{SPACE}, ahk_id%id%
}
}
Question about small piece of ahk code I'm trying to get work, killing ftp leave table attempt Quote

      
m