TableNavigator | TableNavigatorSourceCode | TableNavChangeLog | TableNavToDoList | TableNavigatorStudio

About

This is a step-by-step guide to adding support for a new site to TableNavigator. You should be able to do this even if you don't know anything about programming or AHK whatsoever, provided you have a few hours to spare.

Step-by-Step

Table list & basic fold, call, raise... functions

Attention Queue

Pixel matching

As I mentioned above, there are two kinds of sites: Those with controls AHK can 'see' and those where it can't. Now, if AHK can't determine if a button is visible or hidden, we have to find it out by checking the color of a specific pixel. One button is always present if a table is waiting for your action, and that's the 'Fold' button. So, we'll check to see if it's there. Have a look at the 'IsTableWaitingPacific(id)' function:

IsTableWaitingPacific(id) { 
local x,y,wx,wy
CoordMode, Pixel, Screen 
WinGetPos, wx, wy,,, ahk_id%id%
x := wx + AQ_pixelX_Pacific
y := wy + AQ_pixelY_Pacific
If ( PixelGetColor(x, y) = AQ_pixel_Pacific )
 return 1
return 0
}

On the first line, we declare some variables as local. By doing this we ensure that, to the rest of the script, these variables mean nothing, so they can't mess anything up. Also, declaring variables local automatically mean that any other variables are global - we need AQ_pixelX_Pacific etc. to be global, because we put a value into them somewhere else. (Don't worry if you didn't get any of this). In line 2, we tell the function to treat any coordinates as relative to the screen instead of the active window. Since most of the time the window we're checking won't be active, this is essential. In line 3, we get the x and y position of our target window. Now, we calculate the position our pixel is at, relative to the screen. Finally, we compare the current color of the pixel to the color the user configured (in the Preferences Gui). If they are identical, the fold button is present, so we return 1, for 'yes, table is waiting'. Else, we return 0.

Important: Pixel colors as shown by WindowSpy are in BGR format (blue-green-red), but you have to use RGB format (red-green-blue). Don't let that confuse you.


CategoryAutoHotKey

TableNavigatorGuide (last edited 2009-09-18 19:00:28 by MogobuTheFool)