Skip to forum
[Scripts] Stacked T...
 
Notifications
Clear all

[Scripts] Stacked Table Viewer UPGRADE

336 Posts
48 Users
0 Reactions
59.9 K Views
ruuuic
Joined: 01.11.2010

Epá lembrei-me agora que te prometi uma grade de cerveja :facepalm:

Chuta aí o nick na stars :sdrink


Reply
Quote
xtremelexx
Joined: 08.11.2009

Tive que ir procurar o post de novo para me lembrar do que estavas a falar.
nick: xtremelexx

Original de ruuuic

Original de xtremelexx

Original de ruuuic
Tá muito bom. Excelente trabalho.
Se conseguires que ele me faça isso com a wpt+stars em simultâneo vou a tua casa entregar-te uma flor ou uma grade de cervejas, o que preferires.

Este funciona na Stars + WPT em simultâneo.
Repara no entanto que quando clicas no previewer, pode haver um erro de coordenadas de alguns pixeis. Isto porque a Stars e WPT não têm o mesmo formato de mesa... Nada muito grave mas fica o aviso. (se queres clicar num botão, evita clicar nas extremidades... só isso)
De resto funciona na perfeição!

PS: A grade de cervejas podes entregar na PokerStars. :f_biggrin:

Spoiler

{
;freo's Stacked Table Previewer v1.16
;XTlex's UPGRADE
;Only works in Vista/Windows7 with aero enabled

;Features:
;Shows thumbnails of all stacked tables in a preview window
;Adds and removes tables as they are opened and closed
;Click on the thumbnail to activate the table in the stack
;Displays number of open tables in the preview window title (in the caption)
;Highlights the active/previous active tables green/pink in the thumbnail (Color and border width can be changed in the user defined settings)

;UPGRADE:
;Configuration Menu
;Click on the thumbnail as if it was the table (Fold, Call, Raise, Sitout, you name it!)
;Table Numeration for easier access
;Hotkey for manually reorganize tables when reducing tables

#SingleInstance Force
#NoEnv

DetectHiddenWindows,On
SetTitleMatchMode, 2
setwindelay 0

OnMessage(0x201,"clickevent")
OnMessage(0x46, "WM_WINDOWPOSCHANGING")

;------------------------------------------------------------------------------------------------------------------
;User defined settings
pokersite=cu						;Pokersite ID - ps for Pokerstars, cu for Customised (you'll need to change cu settings further down)
hostwindoww:=1219				;Host preview window width, internal dim
hostwindowh:=480					;Host preview window height, internal dim
hostwindowx:=4					;Host preview window x position on screen
hostwindowy:=4					;Host preview window y position on screen
activebordersize:=4				;Width of the colored border for showing active and last active tables
activebordercolor=00FF00			;Color of the highlight border for the active window
lactivebordercolor=FF00FF			;Color of the highlight border for the last active window
chosenhotkeydefault=^!x			;Hotkey to manually reorganize previews (Ctrl+Alt+x)
refreshratedefault:=3				;Number of seconds to wait between refreshes
;------------------------------------------------------------------------------------------------------------------
}
if (pokersite = "ps") {
	ptablebasew=624										;Poker table base resolution width (For stars)
	ptablebaseh=430										;Poker table base resolution height (For stars)
	windowtitle=ahk_class PokerStarsTableFrameClass			;Window title to match to find tables - Pokerstars
	windowtitle2=Table ahk_class #32770					;Window title of the closing table message
	windowtitleexclude=									;Window title to exclude 
	windowtitleexclude2=PokerStars Lobby					;Window title to exclude 
} else if (pokersite = "cu") {								;Change these settings for a custom site/application
	ptablebasew=791										;custom site/application base resolution width
	ptablebaseh=550										;custom site/application base resolution height
	windowtitle=Hold'em ahk_class #32770					;Window title to match to find tables
	windowtitle2=Omaha ahk_class #32770					;Window title of the closing table message
	windowtitle3=ahk_class PokerStarsTableFrameClass
	windowtitleexclude=									;Window title to exclude 
	windowtitleexclude2=									;Window title to exclude 
}
{
;VARIABLES
SysGet, borderxa, 45										;Size of the x window 3D border
Sysget, borderya, 46										;Size of the y window 3D border
Sysget, captionha, 4										;Size of the caption
Sysget, borderxb, 5										;Size of the x window normal border
Sysget, borderyb, 6										;Size of the y window normal border
Sysget, borderxX, 32										;SM_CXSIZEFRAME
borderx := borderxa + borderxb								;Total size of the x border
bordery := borderya + borderyb							;Total size of the y border
captionh := captionha + bordery							;Total size of the caption

hostwindoww2:=hostwindoww+borderx+borderx					;Host preview window width, external dim
hostwindowh2:=hostwindowh+bordery+captionh				;Host preview window height, external dim
clientareah := hostwindowh								;Height of the area thumbnail windows can be placed in
clientareaw := hostwindoww								;Width of the area thumbnail windows can be placed in
clientareax := hostwindowx + borderx
clientareay := hostwindowy + captionh
ptablehwratio := (ptablebaseh) / (ptablebasew)				;Ratio used for scaling thumbnail window size
lastactive:=0
thisactive:=0
borderguix:=clientareax
borderguiy:=clientareay
chosenhotkeysave:=chosenhotkeydefault						;hotkey to manually reorganize previews
refreshratesave:=refreshratedefault
refreshratereal:=refreshratesave*1000						;refreshrate for mainloop
refreshratereal2:=refreshratesave*200						;refreshrate for 2ndloop
idZ:=id:=0
GroupAdd, XTgroup, %windowtitle%,,,%windowtitleexclude%
GroupAdd, XTgroup, %windowtitle2%,,,%windowtitleexclude2%
GroupAdd, XTgroup, %windowtitle3%,,,%windowtitleexclude%
hotkey, %chosenhotkeysave%, chosenhotkey


;GUIs
;Create preview window
Gui, 99: +LastFound +LabelForm1_
Gui, 99: Color, 0
;WinSet, TransColor, 0
target := WinExist()
Gui, 99: Show, w%hostwindoww% h%hostwindowh% x%hostwindowx% y%hostwindowy%, 00 Tables Previewed

;Create GUi's for colored border
;Gui 1 for active table
Gui, 1:+LastFound +Owner99
Gui, 1:Color, %activebordercolor%
Gui, 1:-Caption -Border
activegui:=WinExist()

;Gui 2 for last active table
Gui, 2:+LastFound +Owner99 
Gui, 2:Color, %lactivebordercolor%
Gui, 2:-Caption -Border
lactivegui:=WinExist()

;DebugMode GUI
;gui, 13:+alwaysontop
;gui, 13:-caption -border
;gui, 13:color, 0xFF0000
;gui, 13:show, w10 h10 x1 y1, Porp

;Configuration Page
gui, 72:+Owner99 -resize -minimizebox
gui, 72:font, s14 w700 cRed
gui, 72:add, text, center w300 h30 x1 y1, Configuration Page
gui, 72:font, s12 w400 cBlack
gui, 72:add, text, cBlue x10 y45 w280 h20, Manually reorganize previews:
gui, 72:add, text, cBlue x10 y110 w280 h20 vrefreshrateID0, RefreshRate:
gui, 72:add, text, center w10 h20 vrefresh, 1
gui, 72:add, text, center w10 h20 vrefresh2, 5
gui, 72:font, s8
gui, 72:add, hotkey, x10 y70 vchosenhotkey Limit1, %chosenhotkeydefault%
gui, 72:add, slider, x20 y130 vrefreshrateID tooltip tickinterval1 Buddy1refresh Buddy2refresh2 range1-5, %refreshratedefault%
gui, 72:add, button, x30 y210 gButton72, SAVE
gui, 72:add, button, x100 y210 gDefault72, DEFAULT
gui, 72:show, hide w300 h240 x%clientareax% y%clientareay%, Configuration Page

;Configuration Page Icon
gui, 73:+LastFound +Owner99
gui, 73:-caption -border
gui, 73:color, %activebordercolor%
g73:=WinExist()
g73x:=hostwindowx+hostwindoww-30
g73y:=hostwindowy+20
gui, 73:show, w40 h40 x%g73x% y%g73y%
winset, Region, 5-5 w30 h30 E, ahk_id %g73%

;GUI to anchor 75 and 77
gui, 74:show, hide

;Real Table active border
gui, 75:+LastFound +Owner74
gui, 75:-caption -border +alwaysontop
gui, 75:color, %activebordercolor%
XT0:=WinExist()

;Numeration Mask
gui, 76:+LastFound +Owner99
MaskK:=WinExist()
gui, 76:color, 0
winset, transcolor, 0, ahk_id %MaskK%
gui, 76:-caption -border
gui, 76:font, s20 w700 verdana
loop, 98 {
gui, 76: add, text, vNumera%a_index% c00FF00 x1 y5100, %a_index%
}
gui, 76: show, w%hostwindoww% h%hostwindowh% x%clientareax% y%clientareay%, Mask

;Real Table Numeration
gui, 77:+LastFound +Owner74
MesasS:=WinExist()
gui, 77:color, 0
winset, transcolor, 0, ahk_id %MesasS%
gui, 77:-caption -border +alwaysontop
gui, 77:font, s20 w700 verdana
gui, 77:add, text, x2 y0 c00FF00 vContagem, 00
gui, 77:show, x1 y5001 w70 h40 NA, Mesas


;DLL calls
DllCall("LoadLibrary", "str", "dwmapi.dll")							;Load dwmapi.dll for handling thumbnails
DllCall( "RegisterShellHookWindow", UInt,target)						;DLL hook for detecting window activations (for colored active table borders)
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
}

;Create Empty variables for storing thumbnail links
Loop, 98 {
	source%A_Index%_hnd:=0
	source%A_Index%_thumb:=0
	source%A_Index%_wide:=0
}

MainLoop:
{
setTimer, MainLoop, %refreshratereal%
setTimer, 2ndLoop, %refreshratereal2%
skip:=0

;Get Tables List
WinGet, id, list, ahk_group XTgroup
if (id>idZ)
	idZ:=id

;Find any closed tables
Loop, 98 {
	abc:=source%a_index%_hnd
	IfWinNotExist, ahk_id %abc%
	{
		source%A_Index%_hnd:=0
		source%A_Index%_thumb:=0
		source%A_Index%_wide:=0
	}
}

;Unregister existing thumbs
Loop, 98 {
	unregisterthumbnail(source%A_Index%_thumb)
}

;Register new thumbs
Loop, %id% {
	kk:=id%a_index%
	flag:=0
	loop, 98 {
		if (kk = source%a_index%_hnd) {
			k:=a_index
			break
		}
		if (source%a_index%_hnd=0 and flag=0) {
			k:=a_index
			flag:=1
		}
	}
	tablesw := numtablesw(idZ)
	childwinw := Floor(calcwinsize(tablesw, idZ))
	childwinh := Floor(childwinw * ptablehwratio)
	addchild(k, kk)
}

WinSetTitle, ahk_id %target%, ,%id% Tables Previewed
gui, 76:show, hide
gui, 76:show, NA
skip:=1
}
Return

2ndLoop:
if (skip=1) {
	gui, 72:submit, nohide
	guicontrol, 72:, refreshrateID0, RefreshRate: %refreshrateID%s
	drawborder(1,thisactive)
	drawborder(2,lastactive)

	winget, XTlex, ID, A
	kjkj:=0
	loop, 98 {
		kjkj++
		if (XTlex=source%a_index%_hnd)
			break
	}
	if (kjkj<98) {
		drawExtras(XTlex)
	} else {
		Gui, 77:-alwaysontop
		Gui, 75:-alwaysontop
		winset, Top,, ahk_id %XTlex%
	}
}
return

;Function to register the thumbnail to the GUI
registerthumbnail(target, source, thumbnum) {
	Global

	VarSetCapacity(thumbnail,4,0)
	DllCall("dwmapi\DwmRegisterThumbnail",UInt,target,UInt,source,UInt, &thumbnail)
	thumbnail:=Numget(thumbnail,0,true)
	source%thumbnum%_hnd:=source
	source%thumbnum%_thumb:=thumbnail

	updatethumbnail(source, thumbnum, thumbnail)
}

updatethumbnail(source, thumbnum, thumbnail) {
/*
Function sets thumbnail properties and displays
DWM_TNP_RECTDESTINATION (0x00000001)
Indicates a value for rcDestination has been specified.
DWM_TNP_RECTSOURCE (0x00000002)
Indicates a value for rcSource has been specified.
DWM_TNP_OPACITY (0x00000004)
Indicates a value for opacity has been specified.
DWM_TNP_VISIBLE (0x00000008)
Indicates a value for fVisible has been specified.
DWM_TNP_SOURCECLIENTAREAONLY (0x00000010)
Indicates a value for fSourceClientAreaOnly has been specified.
*/
	Global

	dwFlags:=0X1 | 0x10
	opacity:=150
	fVisible:=1
	fSourceClientAreaOnly:=1

	;Determine where to position thumbnail based on its number
	rownum := Ceil(thumbnum / tablesw)
	colnum := Mod(thumbnum - 1,tablesw)+1
	newx := ((colnum - 1) * childwinw)
	newy := ((rownum - 1) * childwinh)
	neww := newx + childwinw
	newh := newy + childwinh
	new3x:=newx+1+activebordersize
	new3y:=newy-5+activebordersize
	guicontrol, 76: move, Numera%thumbnum%, x%new3x% y%new3y%
	WinGetPos,wx,wy,ww,wh,ahk_id %source%

	;struct _DWM_THUMBNAIL_PROPERTIES
	VarSetCapacity(dskThumbProps,45,0)
	NumPut(dwFlags,dskThumbProps,0,"UInt")
	NumPut(newx,dskThumbProps,4,"Int")								;x coord in relation to the target
	NumPut(newy,dskThumbProps,8,"Int")								;y coord in relation to the target
	NumPut(neww,dskThumbProps,12,"Int")							;x coord of bottom-right of the thumb in relation to the target
	NumPut(newh,dskThumbProps,16,"Int")							;y coord of bottom-right of the thumb in relation to the target
	;NumPut(0,dskThumbProps,20,"Int")								;x coord of source to start capture of image
	;NumPut(0,dskThumbProps,24,"Int")								;y coord of source to start capture of image
	;NumPut(ww-borderx,dskThumbProps,28,"Int")						;x coord of source to end capture of image
	;NumPut(wh-captionh,dskThumbProps,32,"Int")					;y coord of source to end capture of image
	;NumPut(opacity,dskThumbProps,36,"UChar")
	;NumPut(fVisible,dskThumbProps,37,"Int")
	NumPut(fSourceClientAreaOnly,dskThumbProps,41,"Int")
	DllCall("dwmapi\DwmUpdateThumbnailProperties","UInt",thumbnail,"UInt",&dskThumbProps) 
	source%thumbnum%_wide:=ww
}

unregisterthumbnail(unthumbnail) {
	DllCall("dwmapi.dll\DwmUnregisterThumbnail", "UInt", unthumbnail)
}

;Function to determine the optimal number of tables wide to show in preview window
numtablesw(totaltables) {
	if(totaltables>1) {
		global clientareah
		global clientareaw
		global ptablehwratio

		wsize := 0
		wnum := 0
		Loop,%totaltables% {											;The loop value will equal the number of tables per row
			thiswsize := floor(calcwinsize(A_Index, totaltables))
			if (thiswsize >= wsize) {    
				wsize := thiswsize
				wnum := A_Index
			}
		}
		return, %wnum%
	} Else return, 1
}

;Calculates child window size based on number of tables per row
calcwinsize(tblperrow, totaltables) {
	global clientareaw
	global clientareah
	global ptablehwratio

	calcwsize := clientareaw / tblperrow
	calcrownum := ceil(totaltables / tblperrow)
	if ((clientareah / calcrownum) < (ptablehwratio * calcwsize))
		calcwsize := (1 / ptablehwratio) * (clientareah / calcrownum)
	Return, calcwsize
}

;Adds child window to the preview pane
addchild(usenum, previewid) {
	Global childwinw
	Global childwinh
	Global hostwindoww
	Global hostwindowh
	Global target

	if (usenum > 0) {										;If usenum is 0 it is not part of the initial load of existing windows
		registerthumbnail(target, previewid, usenum)
		Return
	}
}

;Function to determine what happens when a thumbnail is clicked
clickevent(wparam) {
	local id2,win,mousex,mousey,thisslot,thisrow,thiscol,xl,xr,yt,yb
	coordmode,mouse,relative
	mousegetpos,mousex,mousey,id2
	mousex-=borderx
	mousey-=captionh
	
	if (a_gui=73) {
		gui, 72:show, x%borderguix% y%borderguiy%
		gosub, Saved72
	}
	if (id2=target) {
		if (id>0) {
			;Calculate slot number
			thisrow:=Ceil((mousey+1) / childwinh)
			thiscol:=Ceil((mousex+1) / childwinw)
			thisslot:=((thisrow-1)*tablesw)+thiscol
			win:=source%thisslot%_hnd

			WinGetPos, newnew, newnew2, tablew, tableh, ahk_id %win%
			tablew-=borderxX*2-2			;14
			tableh-=borderxX*2-bordery		;13
			tableh-=captionh
			getcoordsinv(thisslot,thisrow,thiscol,tablew,tableh,mousex,mousey,MX,MY)
			MX:=MX+borderxX							;8
			MY:=MY+borderxX+captionh-bordery			;30
			winactivate, ahk_id%win%
			controlclick, x%MX% y%MY%, ahk_id%win% ,,,,NA
;			MX:=MX+newnew
;			MY:=MY+newnew2
;			winmove, Porp,,%MX%,%MY%
		}
	}
}

getcoordsinv(calcslot,thisrow,thiscol,tablew,tableh,rectx,recty,ByRef thisx,ByRef thisy) {
	Global

	thisx:= ((thiscol-1) * childwinw)
	thisy:= ((thisrow - 1) * childwinh)
	thisx:=(rectx-thisx)*tablew/childwinw
	thisy:=(recty-thisy)*tableh/childwinh
	return
}

;Function for docking the border gui's to the preview window
WM_WINDOWPOSCHANGING(wParam, lParam) {
	Global

	if (A_Gui = 99) && !(NumGet(lParam+24) & 0x2)				; SWP_NOMOVE=0x2 
	{
		; Since WM_WINDOWPOSCHANGING happens *before* the window moves,
		; we must get the new position from the WINDOWPOS pointed to by lParam.
		borderguix := NumGet(lParam+8,0,"int")
		borderguiy := NumGet(lParam+12,0,"int")

		x76:=borderguix+borderx
		y76:=borderguiy+captionh
		winmove, ahk_id %MaskK%,, %x76%, %y76%
		x73:=borderguix+hostwindoww-30
		y73:=borderguiy+20
		winmove, ahk_id %g73%,, %x73%, %y73%

		If(thisactive>0)
			Gui, 1:Show, X%borderguix% Y%borderguiy% NA
		
		if(lastactive>0)
			Gui, 2:Show, X%borderguix% Y%borderguiy% NA
	}
}

;Function for detecting window activations for setting border colors
ShellMessage( wParam,lParam ) {
	Global

	If ((wParam = 4 or wParam = 32772) And WinExist( "ahk_id " lParam ))		;  HSHELL_WINDOWACTIVATED = 4, HSHELL_RUDEAPPACTIVATED = 32772
	{
		matchcnt:=0
		Loop, 98 {
			matchcnt++
			if (source%matchcnt%_hnd = lParam)
				break
		}
		if (matchcnt < 98)
			drawExtras(lparam)
		if (matchcnt < 98 and thisactive != lParam) {
			lastactive:=thisactive
			thisactive:=lParam
			drawborder(1,thisactive)
			drawborder(2,lastactive)
		}
	}
}

drawborder(guinum, active) {
	Global

	if (active) {
		slotnumb:=0
		Loop, 98 {
			slotnumb++
			if (source%slotnumb%_hnd = active)
				break
		}
	;Get the thumbnail outer edge coords
	thisrow:=Ceil(slotnumb/tablesw)
	thiscol:=Mod(slotnumb - 1,tablesw)+1
	xl:= (thiscol-1) * childwinw +borderx
	xr:= (thiscol) * childwinw +borderx
	yt:= (thisrow-1) * childwinh +captionh
	yb:= (thisrow) * childwinh +captionh

	if(guinum=1)
		thisgui:=activegui
	else
		thisgui:=lactivegui

	xli:=xl+activebordersize
	xri:=xr-activebordersize
	yti:=yt+activebordersize
	ybi:=yb-activebordersize

	WinSet, Region, %xl%-%yt% %xr%-%yt% %xr%-%yb% %xl%-%yb% %xl%-%yt%   %xli%-%yti% %xri%-%yti% %xri%-%ybi% %xli%-%ybi% %xli%-%yti%, ahk_id %thisgui%
	Gui, %guinum%:Show, x%borderguix% y%borderguiy% W%hostwindoww2% H%hostwindowh2% NA
	}
}

drawExtras(XTlex) {
	Global
		wingetpos, XT1, XT2, XT3, XT4, ahk_id %XTlex%
		loop, 98 {
		if (XTlex = source%A_Index%_hnd) {
			XTlex2:=a_index
			break
		}
		}
		XT15:=XT3-activebordersize
		XT16:=XT4-activebordersize
		WinSet, Region, 0-0 %XT3%-0 %XT3%-%XT4% 0-%XT4% 0-0   %activebordersize%-%activebordersize% %XT15%-%activebordersize% %XT15%-%XT16% %activebordersize%-%XT16% %activebordersize%-%activebordersize%, ahk_id %XT0%
		gui, 75:show, w%XT3% h%XT4% x%XT1% y%XT2% NA
		gui, 75:+alwaysontop

		XT15:=XT1+activebordersize
		XT16:=XT2+activebordersize-4
		GuiControl, 77:text, Contagem, %XTlex2%
		winmove, ahk_id %MesasS%,, %XT15%, %XT16%
		Gui, 77:+alwaysontop
}

Form1_Close:
	ExitApp
return

chosenhotkey:
{
flag2:=0
idZ:=0
loop, 97 {
	if (flag2=1)
		break
	flag2:=0
	loop, 98 {
		kkk:=a_index+1
		guicontrol, 76: move, Numera%a_index%, x1 y5100
		if (source%a_index%_hnd=0 and a_index<98) {
			source%a_index%_hnd:=source%kkk%_hnd
			source%a_index%_wide:=source%kkk%_wide
			source%a_index%_thumb:=source%kkk%_thumb
			source%kkk%_hnd:=0
			source%kkk%_wide:=0
			source%kkk%_thumb:=0
		}
		if (source%a_index%_hnd=0 and flag2=0)
			flag2:=1
		if (source%a_index%_hnd!=0 and flag2=1)
			flag2:=2
	}
}
}
return

Button72:
{
gui, 72:submit, nohide
if (chosenhotkeysave)
	hotkey, %chosenhotkeysave%, chosenhotkey, OFF
if (chosenhotkey)
	hotkey, %chosenhotkey%, chosenhotkey, ON
chosenhotkeysave:=chosenhotkey
refreshratesave:=refreshrateID
refreshratereal:=refreshratesave*1000
refreshratereal2:=refreshratesave*200
}
return

Default72:
guicontrol, 72:, chosenhotkey, %chosenhotkeydefault%
guicontrol, 72:, refreshrateID, %refreshratedefault%
return

Saved72:
guicontrol, 72:, chosenhotkey, %chosenhotkeysave%
guicontrol, 72:, refreshrateID, %refreshratesave%
return

Assim farei :sdrink


Reply
Quote
nuno21nt
Joined: 28.06.2009

Original de xtremelexx
Tive que ir procurar o post de novo para me lembrar do que estavas a falar.

Eu não. Lembrava-me perfeitamente.


Reply
Quote
pedrofurlanetto
Joined: 01.05.2011

Muito obrigado pelas informaçoes!!!

quer dizer entao, que posso ter funcoes semelhantes ao table ninja, de graça ??? muito bom isso!


Reply
Quote
xtremelexx
Joined: 08.11.2009

Original de pedrofurlanetto
Muito obrigado pelas informaçoes!!!

quer dizer entao, que posso ter funcoes semelhantes ao table ninja, de graça ??? muito bom isso!

Isso mesmo. Lembro-me de ter pensado fazer um Table Ninja há uns tempos atrás.
Desisti porque jogo essencialmente na PokerStars que já tem a maioria dessas funções incorporadas no software... (hotkeys, mass multi-tabling options...)

Fiz só um script para clicar o Timebank e clicar o botão do I'm Back quando fico sitout.

...
Mas sim! É possível fazer um Table Ninja usando ahk.
Se precisares de ajuda, avisa! :f_thumbsup:


Reply
Quote
ruuuic
Joined: 01.11.2010

Original de xtremelexx
Tive que ir procurar o post de novo para me lembrar do que estavas a falar.
nick: xtremelexx

Original de ruuuic

Original de xtremelexx

Original de ruuuic
Tá muito bom. Excelente trabalho.
Se conseguires que ele me faça isso com a wpt+stars em simultâneo vou a tua casa entregar-te uma flor ou uma grade de cervejas, o que preferires.

Este funciona na Stars + WPT em simultâneo.
Repara no entanto que quando clicas no previewer, pode haver um erro de coordenadas de alguns pixeis. Isto porque a Stars e WPT não têm o mesmo formato de mesa... Nada muito grave mas fica o aviso. (se queres clicar num botão, evita clicar nas extremidades... só isso)
De resto funciona na perfeição!

PS: A grade de cervejas podes entregar na PokerStars. :f_biggrin:

Spoiler

{
;freo's Stacked Table Previewer v1.16
;XTlex's UPGRADE
;Only works in Vista/Windows7 with aero enabled

;Features:
;Shows thumbnails of all stacked tables in a preview window
;Adds and removes tables as they are opened and closed
;Click on the thumbnail to activate the table in the stack
;Displays number of open tables in the preview window title (in the caption)
;Highlights the active/previous active tables green/pink in the thumbnail (Color and border width can be changed in the user defined settings)

;UPGRADE:
;Configuration Menu
;Click on the thumbnail as if it was the table (Fold, Call, Raise, Sitout, you name it!)
;Table Numeration for easier access
;Hotkey for manually reorganize tables when reducing tables

#SingleInstance Force
#NoEnv

DetectHiddenWindows,On
SetTitleMatchMode, 2
setwindelay 0

OnMessage(0x201,"clickevent")
OnMessage(0x46, "WM_WINDOWPOSCHANGING")

;------------------------------------------------------------------------------------------------------------------
;User defined settings
pokersite=cu						;Pokersite ID - ps for Pokerstars, cu for Customised (you'll need to change cu settings further down)
hostwindoww:=1219				;Host preview window width, internal dim
hostwindowh:=480					;Host preview window height, internal dim
hostwindowx:=4					;Host preview window x position on screen
hostwindowy:=4					;Host preview window y position on screen
activebordersize:=4				;Width of the colored border for showing active and last active tables
activebordercolor=00FF00			;Color of the highlight border for the active window
lactivebordercolor=FF00FF			;Color of the highlight border for the last active window
chosenhotkeydefault=^!x			;Hotkey to manually reorganize previews (Ctrl+Alt+x)
refreshratedefault:=3				;Number of seconds to wait between refreshes
;------------------------------------------------------------------------------------------------------------------
}
if (pokersite = "ps") {
	ptablebasew=624										;Poker table base resolution width (For stars)
	ptablebaseh=430										;Poker table base resolution height (For stars)
	windowtitle=ahk_class PokerStarsTableFrameClass			;Window title to match to find tables - Pokerstars
	windowtitle2=Table ahk_class #32770					;Window title of the closing table message
	windowtitleexclude=									;Window title to exclude 
	windowtitleexclude2=PokerStars Lobby					;Window title to exclude 
} else if (pokersite = "cu") {								;Change these settings for a custom site/application
	ptablebasew=791										;custom site/application base resolution width
	ptablebaseh=550										;custom site/application base resolution height
	windowtitle=Hold'em ahk_class #32770					;Window title to match to find tables
	windowtitle2=Omaha ahk_class #32770					;Window title of the closing table message
	windowtitle3=ahk_class PokerStarsTableFrameClass
	windowtitleexclude=									;Window title to exclude 
	windowtitleexclude2=									;Window title to exclude 
}
{
;VARIABLES
SysGet, borderxa, 45										;Size of the x window 3D border
Sysget, borderya, 46										;Size of the y window 3D border
Sysget, captionha, 4										;Size of the caption
Sysget, borderxb, 5										;Size of the x window normal border
Sysget, borderyb, 6										;Size of the y window normal border
Sysget, borderxX, 32										;SM_CXSIZEFRAME
borderx := borderxa + borderxb								;Total size of the x border
bordery := borderya + borderyb							;Total size of the y border
captionh := captionha + bordery							;Total size of the caption

hostwindoww2:=hostwindoww+borderx+borderx					;Host preview window width, external dim
hostwindowh2:=hostwindowh+bordery+captionh				;Host preview window height, external dim
clientareah := hostwindowh								;Height of the area thumbnail windows can be placed in
clientareaw := hostwindoww								;Width of the area thumbnail windows can be placed in
clientareax := hostwindowx + borderx
clientareay := hostwindowy + captionh
ptablehwratio := (ptablebaseh) / (ptablebasew)				;Ratio used for scaling thumbnail window size
lastactive:=0
thisactive:=0
borderguix:=clientareax
borderguiy:=clientareay
chosenhotkeysave:=chosenhotkeydefault						;hotkey to manually reorganize previews
refreshratesave:=refreshratedefault
refreshratereal:=refreshratesave*1000						;refreshrate for mainloop
refreshratereal2:=refreshratesave*200						;refreshrate for 2ndloop
idZ:=id:=0
GroupAdd, XTgroup, %windowtitle%,,,%windowtitleexclude%
GroupAdd, XTgroup, %windowtitle2%,,,%windowtitleexclude2%
GroupAdd, XTgroup, %windowtitle3%,,,%windowtitleexclude%
hotkey, %chosenhotkeysave%, chosenhotkey


;GUIs
;Create preview window
Gui, 99: +LastFound +LabelForm1_
Gui, 99: Color, 0
;WinSet, TransColor, 0
target := WinExist()
Gui, 99: Show, w%hostwindoww% h%hostwindowh% x%hostwindowx% y%hostwindowy%, 00 Tables Previewed

;Create GUi's for colored border
;Gui 1 for active table
Gui, 1:+LastFound +Owner99
Gui, 1:Color, %activebordercolor%
Gui, 1:-Caption -Border
activegui:=WinExist()

;Gui 2 for last active table
Gui, 2:+LastFound +Owner99 
Gui, 2:Color, %lactivebordercolor%
Gui, 2:-Caption -Border
lactivegui:=WinExist()

;DebugMode GUI
;gui, 13:+alwaysontop
;gui, 13:-caption -border
;gui, 13:color, 0xFF0000
;gui, 13:show, w10 h10 x1 y1, Porp

;Configuration Page
gui, 72:+Owner99 -resize -minimizebox
gui, 72:font, s14 w700 cRed
gui, 72:add, text, center w300 h30 x1 y1, Configuration Page
gui, 72:font, s12 w400 cBlack
gui, 72:add, text, cBlue x10 y45 w280 h20, Manually reorganize previews:
gui, 72:add, text, cBlue x10 y110 w280 h20 vrefreshrateID0, RefreshRate:
gui, 72:add, text, center w10 h20 vrefresh, 1
gui, 72:add, text, center w10 h20 vrefresh2, 5
gui, 72:font, s8
gui, 72:add, hotkey, x10 y70 vchosenhotkey Limit1, %chosenhotkeydefault%
gui, 72:add, slider, x20 y130 vrefreshrateID tooltip tickinterval1 Buddy1refresh Buddy2refresh2 range1-5, %refreshratedefault%
gui, 72:add, button, x30 y210 gButton72, SAVE
gui, 72:add, button, x100 y210 gDefault72, DEFAULT
gui, 72:show, hide w300 h240 x%clientareax% y%clientareay%, Configuration Page

;Configuration Page Icon
gui, 73:+LastFound +Owner99
gui, 73:-caption -border
gui, 73:color, %activebordercolor%
g73:=WinExist()
g73x:=hostwindowx+hostwindoww-30
g73y:=hostwindowy+20
gui, 73:show, w40 h40 x%g73x% y%g73y%
winset, Region, 5-5 w30 h30 E, ahk_id %g73%

;GUI to anchor 75 and 77
gui, 74:show, hide

;Real Table active border
gui, 75:+LastFound +Owner74
gui, 75:-caption -border +alwaysontop
gui, 75:color, %activebordercolor%
XT0:=WinExist()

;Numeration Mask
gui, 76:+LastFound +Owner99
MaskK:=WinExist()
gui, 76:color, 0
winset, transcolor, 0, ahk_id %MaskK%
gui, 76:-caption -border
gui, 76:font, s20 w700 verdana
loop, 98 {
gui, 76: add, text, vNumera%a_index% c00FF00 x1 y5100, %a_index%
}
gui, 76: show, w%hostwindoww% h%hostwindowh% x%clientareax% y%clientareay%, Mask

;Real Table Numeration
gui, 77:+LastFound +Owner74
MesasS:=WinExist()
gui, 77:color, 0
winset, transcolor, 0, ahk_id %MesasS%
gui, 77:-caption -border +alwaysontop
gui, 77:font, s20 w700 verdana
gui, 77:add, text, x2 y0 c00FF00 vContagem, 00
gui, 77:show, x1 y5001 w70 h40 NA, Mesas


;DLL calls
DllCall("LoadLibrary", "str", "dwmapi.dll")							;Load dwmapi.dll for handling thumbnails
DllCall( "RegisterShellHookWindow", UInt,target)						;DLL hook for detecting window activations (for colored active table borders)
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
}

;Create Empty variables for storing thumbnail links
Loop, 98 {
	source%A_Index%_hnd:=0
	source%A_Index%_thumb:=0
	source%A_Index%_wide:=0
}

MainLoop:
{
setTimer, MainLoop, %refreshratereal%
setTimer, 2ndLoop, %refreshratereal2%
skip:=0

;Get Tables List
WinGet, id, list, ahk_group XTgroup
if (id>idZ)
	idZ:=id

;Find any closed tables
Loop, 98 {
	abc:=source%a_index%_hnd
	IfWinNotExist, ahk_id %abc%
	{
		source%A_Index%_hnd:=0
		source%A_Index%_thumb:=0
		source%A_Index%_wide:=0
	}
}

;Unregister existing thumbs
Loop, 98 {
	unregisterthumbnail(source%A_Index%_thumb)
}

;Register new thumbs
Loop, %id% {
	kk:=id%a_index%
	flag:=0
	loop, 98 {
		if (kk = source%a_index%_hnd) {
			k:=a_index
			break
		}
		if (source%a_index%_hnd=0 and flag=0) {
			k:=a_index
			flag:=1
		}
	}
	tablesw := numtablesw(idZ)
	childwinw := Floor(calcwinsize(tablesw, idZ))
	childwinh := Floor(childwinw * ptablehwratio)
	addchild(k, kk)
}

WinSetTitle, ahk_id %target%, ,%id% Tables Previewed
gui, 76:show, hide
gui, 76:show, NA
skip:=1
}
Return

2ndLoop:
if (skip=1) {
	gui, 72:submit, nohide
	guicontrol, 72:, refreshrateID0, RefreshRate: %refreshrateID%s
	drawborder(1,thisactive)
	drawborder(2,lastactive)

	winget, XTlex, ID, A
	kjkj:=0
	loop, 98 {
		kjkj++
		if (XTlex=source%a_index%_hnd)
			break
	}
	if (kjkj<98) {
		drawExtras(XTlex)
	} else {
		Gui, 77:-alwaysontop
		Gui, 75:-alwaysontop
		winset, Top,, ahk_id %XTlex%
	}
}
return

;Function to register the thumbnail to the GUI
registerthumbnail(target, source, thumbnum) {
	Global

	VarSetCapacity(thumbnail,4,0)
	DllCall("dwmapi\DwmRegisterThumbnail",UInt,target,UInt,source,UInt, &thumbnail)
	thumbnail:=Numget(thumbnail,0,true)
	source%thumbnum%_hnd:=source
	source%thumbnum%_thumb:=thumbnail

	updatethumbnail(source, thumbnum, thumbnail)
}

updatethumbnail(source, thumbnum, thumbnail) {
/*
Function sets thumbnail properties and displays
DWM_TNP_RECTDESTINATION (0x00000001)
Indicates a value for rcDestination has been specified.
DWM_TNP_RECTSOURCE (0x00000002)
Indicates a value for rcSource has been specified.
DWM_TNP_OPACITY (0x00000004)
Indicates a value for opacity has been specified.
DWM_TNP_VISIBLE (0x00000008)
Indicates a value for fVisible has been specified.
DWM_TNP_SOURCECLIENTAREAONLY (0x00000010)
Indicates a value for fSourceClientAreaOnly has been specified.
*/
	Global

	dwFlags:=0X1 | 0x10
	opacity:=150
	fVisible:=1
	fSourceClientAreaOnly:=1

	;Determine where to position thumbnail based on its number
	rownum := Ceil(thumbnum / tablesw)
	colnum := Mod(thumbnum - 1,tablesw)+1
	newx := ((colnum - 1) * childwinw)
	newy := ((rownum - 1) * childwinh)
	neww := newx + childwinw
	newh := newy + childwinh
	new3x:=newx+1+activebordersize
	new3y:=newy-5+activebordersize
	guicontrol, 76: move, Numera%thumbnum%, x%new3x% y%new3y%
	WinGetPos,wx,wy,ww,wh,ahk_id %source%

	;struct _DWM_THUMBNAIL_PROPERTIES
	VarSetCapacity(dskThumbProps,45,0)
	NumPut(dwFlags,dskThumbProps,0,"UInt")
	NumPut(newx,dskThumbProps,4,"Int")								;x coord in relation to the target
	NumPut(newy,dskThumbProps,8,"Int")								;y coord in relation to the target
	NumPut(neww,dskThumbProps,12,"Int")							;x coord of bottom-right of the thumb in relation to the target
	NumPut(newh,dskThumbProps,16,"Int")							;y coord of bottom-right of the thumb in relation to the target
	;NumPut(0,dskThumbProps,20,"Int")								;x coord of source to start capture of image
	;NumPut(0,dskThumbProps,24,"Int")								;y coord of source to start capture of image
	;NumPut(ww-borderx,dskThumbProps,28,"Int")						;x coord of source to end capture of image
	;NumPut(wh-captionh,dskThumbProps,32,"Int")					;y coord of source to end capture of image
	;NumPut(opacity,dskThumbProps,36,"UChar")
	;NumPut(fVisible,dskThumbProps,37,"Int")
	NumPut(fSourceClientAreaOnly,dskThumbProps,41,"Int")
	DllCall("dwmapi\DwmUpdateThumbnailProperties","UInt",thumbnail,"UInt",&dskThumbProps) 
	source%thumbnum%_wide:=ww
}

unregisterthumbnail(unthumbnail) {
	DllCall("dwmapi.dll\DwmUnregisterThumbnail", "UInt", unthumbnail)
}

;Function to determine the optimal number of tables wide to show in preview window
numtablesw(totaltables) {
	if(totaltables>1) {
		global clientareah
		global clientareaw
		global ptablehwratio

		wsize := 0
		wnum := 0
		Loop,%totaltables% {											;The loop value will equal the number of tables per row
			thiswsize := floor(calcwinsize(A_Index, totaltables))
			if (thiswsize >= wsize) {    
				wsize := thiswsize
				wnum := A_Index
			}
		}
		return, %wnum%
	} Else return, 1
}

;Calculates child window size based on number of tables per row
calcwinsize(tblperrow, totaltables) {
	global clientareaw
	global clientareah
	global ptablehwratio

	calcwsize := clientareaw / tblperrow
	calcrownum := ceil(totaltables / tblperrow)
	if ((clientareah / calcrownum) < (ptablehwratio * calcwsize))
		calcwsize := (1 / ptablehwratio) * (clientareah / calcrownum)
	Return, calcwsize
}

;Adds child window to the preview pane
addchild(usenum, previewid) {
	Global childwinw
	Global childwinh
	Global hostwindoww
	Global hostwindowh
	Global target

	if (usenum > 0) {										;If usenum is 0 it is not part of the initial load of existing windows
		registerthumbnail(target, previewid, usenum)
		Return
	}
}

;Function to determine what happens when a thumbnail is clicked
clickevent(wparam) {
	local id2,win,mousex,mousey,thisslot,thisrow,thiscol,xl,xr,yt,yb
	coordmode,mouse,relative
	mousegetpos,mousex,mousey,id2
	mousex-=borderx
	mousey-=captionh
	
	if (a_gui=73) {
		gui, 72:show, x%borderguix% y%borderguiy%
		gosub, Saved72
	}
	if (id2=target) {
		if (id>0) {
			;Calculate slot number
			thisrow:=Ceil((mousey+1) / childwinh)
			thiscol:=Ceil((mousex+1) / childwinw)
			thisslot:=((thisrow-1)*tablesw)+thiscol
			win:=source%thisslot%_hnd

			WinGetPos, newnew, newnew2, tablew, tableh, ahk_id %win%
			tablew-=borderxX*2-2			;14
			tableh-=borderxX*2-bordery		;13
			tableh-=captionh
			getcoordsinv(thisslot,thisrow,thiscol,tablew,tableh,mousex,mousey,MX,MY)
			MX:=MX+borderxX							;8
			MY:=MY+borderxX+captionh-bordery			;30
			winactivate, ahk_id%win%
			controlclick, x%MX% y%MY%, ahk_id%win% ,,,,NA
;			MX:=MX+newnew
;			MY:=MY+newnew2
;			winmove, Porp,,%MX%,%MY%
		}
	}
}

getcoordsinv(calcslot,thisrow,thiscol,tablew,tableh,rectx,recty,ByRef thisx,ByRef thisy) {
	Global

	thisx:= ((thiscol-1) * childwinw)
	thisy:= ((thisrow - 1) * childwinh)
	thisx:=(rectx-thisx)*tablew/childwinw
	thisy:=(recty-thisy)*tableh/childwinh
	return
}

;Function for docking the border gui's to the preview window
WM_WINDOWPOSCHANGING(wParam, lParam) {
	Global

	if (A_Gui = 99) && !(NumGet(lParam+24) & 0x2)				; SWP_NOMOVE=0x2 
	{
		; Since WM_WINDOWPOSCHANGING happens *before* the window moves,
		; we must get the new position from the WINDOWPOS pointed to by lParam.
		borderguix := NumGet(lParam+8,0,"int")
		borderguiy := NumGet(lParam+12,0,"int")

		x76:=borderguix+borderx
		y76:=borderguiy+captionh
		winmove, ahk_id %MaskK%,, %x76%, %y76%
		x73:=borderguix+hostwindoww-30
		y73:=borderguiy+20
		winmove, ahk_id %g73%,, %x73%, %y73%

		If(thisactive>0)
			Gui, 1:Show, X%borderguix% Y%borderguiy% NA
		
		if(lastactive>0)
			Gui, 2:Show, X%borderguix% Y%borderguiy% NA
	}
}

;Function for detecting window activations for setting border colors
ShellMessage( wParam,lParam ) {
	Global

	If ((wParam = 4 or wParam = 32772) And WinExist( "ahk_id " lParam ))		;  HSHELL_WINDOWACTIVATED = 4, HSHELL_RUDEAPPACTIVATED = 32772
	{
		matchcnt:=0
		Loop, 98 {
			matchcnt++
			if (source%matchcnt%_hnd = lParam)
				break
		}
		if (matchcnt < 98)
			drawExtras(lparam)
		if (matchcnt < 98 and thisactive != lParam) {
			lastactive:=thisactive
			thisactive:=lParam
			drawborder(1,thisactive)
			drawborder(2,lastactive)
		}
	}
}

drawborder(guinum, active) {
	Global

	if (active) {
		slotnumb:=0
		Loop, 98 {
			slotnumb++
			if (source%slotnumb%_hnd = active)
				break
		}
	;Get the thumbnail outer edge coords
	thisrow:=Ceil(slotnumb/tablesw)
	thiscol:=Mod(slotnumb - 1,tablesw)+1
	xl:= (thiscol-1) * childwinw +borderx
	xr:= (thiscol) * childwinw +borderx
	yt:= (thisrow-1) * childwinh +captionh
	yb:= (thisrow) * childwinh +captionh

	if(guinum=1)
		thisgui:=activegui
	else
		thisgui:=lactivegui

	xli:=xl+activebordersize
	xri:=xr-activebordersize
	yti:=yt+activebordersize
	ybi:=yb-activebordersize

	WinSet, Region, %xl%-%yt% %xr%-%yt% %xr%-%yb% %xl%-%yb% %xl%-%yt%   %xli%-%yti% %xri%-%yti% %xri%-%ybi% %xli%-%ybi% %xli%-%yti%, ahk_id %thisgui%
	Gui, %guinum%:Show, x%borderguix% y%borderguiy% W%hostwindoww2% H%hostwindowh2% NA
	}
}

drawExtras(XTlex) {
	Global
		wingetpos, XT1, XT2, XT3, XT4, ahk_id %XTlex%
		loop, 98 {
		if (XTlex = source%A_Index%_hnd) {
			XTlex2:=a_index
			break
		}
		}
		XT15:=XT3-activebordersize
		XT16:=XT4-activebordersize
		WinSet, Region, 0-0 %XT3%-0 %XT3%-%XT4% 0-%XT4% 0-0   %activebordersize%-%activebordersize% %XT15%-%activebordersize% %XT15%-%XT16% %activebordersize%-%XT16% %activebordersize%-%activebordersize%, ahk_id %XT0%
		gui, 75:show, w%XT3% h%XT4% x%XT1% y%XT2% NA
		gui, 75:+alwaysontop

		XT15:=XT1+activebordersize
		XT16:=XT2+activebordersize-4
		GuiControl, 77:text, Contagem, %XTlex2%
		winmove, ahk_id %MesasS%,, %XT15%, %XT16%
		Gui, 77:+alwaysontop
}

Form1_Close:
	ExitApp
return

chosenhotkey:
{
flag2:=0
idZ:=0
loop, 97 {
	if (flag2=1)
		break
	flag2:=0
	loop, 98 {
		kkk:=a_index+1
		guicontrol, 76: move, Numera%a_index%, x1 y5100
		if (source%a_index%_hnd=0 and a_index<98) {
			source%a_index%_hnd:=source%kkk%_hnd
			source%a_index%_wide:=source%kkk%_wide
			source%a_index%_thumb:=source%kkk%_thumb
			source%kkk%_hnd:=0
			source%kkk%_wide:=0
			source%kkk%_thumb:=0
		}
		if (source%a_index%_hnd=0 and flag2=0)
			flag2:=1
		if (source%a_index%_hnd!=0 and flag2=1)
			flag2:=2
	}
}
}
return

Button72:
{
gui, 72:submit, nohide
if (chosenhotkeysave)
	hotkey, %chosenhotkeysave%, chosenhotkey, OFF
if (chosenhotkey)
	hotkey, %chosenhotkey%, chosenhotkey, ON
chosenhotkeysave:=chosenhotkey
refreshratesave:=refreshrateID
refreshratereal:=refreshratesave*1000
refreshratereal2:=refreshratesave*200
}
return

Default72:
guicontrol, 72:, chosenhotkey, %chosenhotkeydefault%
guicontrol, 72:, refreshrateID, %refreshratedefault%
return

Saved72:
guicontrol, 72:, chosenhotkey, %chosenhotkeysave%
guicontrol, 72:, refreshrateID, %refreshratesave%
return

Assim farei :sdrink

Mandei dez paus, não gastes tudo em rebuçados.


Reply
Quote
xtremelexx
Joined: 08.11.2009

Mandei dez paus, não gastes tudo em rebuçados.

Obrigado ruuuic! Já gastei 5 aqui.


Reply
Quote
xtremelexx
Joined: 08.11.2009

@kinhodod:
Script que organiza as mesas por ordem de abertura.
É conveniente ligar o script logo no inicio da sessão, para ele saber que ordem deve colocar as mesas (ordem de abertura).

Se a sala está a correr em Administrador, o script também deve estar.

Abraço.

Spoiler

#NoEnv
#SingleInstance force
Setwindelay -1
Sysget, Area, MonitorWorkArea
Area0 := Arearight - Arealeft
Area1 := Areabottom - Areatop
elapsedTime:=id:=idZ:=0
settimer, inicio, 50

inicio:
WinGet, id, list, ahk_class PokerStarsTableFrameClass,, Lobby
elapsedTime++
if (id!=idZ OR elapsedTime>60) {
elapsedTime:=0
idZ:=id

wsize:=wnum:=0
Loop, %id% {
	
	thiswsize:=Area0/A_Index
	calcrownum:=ceil(id/A_Index)
	if ((Area1/calcrownum) <= ((thiswsize-16)/1.45+38))
		thiswsize:=(Area1/calcrownum-38)*1.45+16
	
	if (thiswsize >= wsize)
		wsize:=thiswsize , wnum:=A_Index
}
wsize2:=(wsize-16)/1.45+38

Loop, 48 {
	abc:=array%a_index%
	ifwinnotexist, ahk_id %abc%
		array%a_index%:=0
}

flag2:=0
loop, 47 {
	if (flag2=1)
		break
	flag2:=0
	loop, 48 {
		kkk:=a_index+1
		if (array%a_index%=0 and a_index<48) {
			array%a_index%:=array%kkk%
			array%kkk%:=0
		}
		if (array%a_index%=0 and flag2=0)
			flag2:=1
		if (array%a_index%!=0 and flag2=1)
			flag2:=2
	}
}

Loop, %id% {
	WindowID:=id%a_index%
	flag:=0
	loop, 48 {
	if (WindowID = array%a_index%) {
		k:=a_index
		break
	}
	if (array%a_index%=0 and flag=0) {
		k:=a_index
		flag:=1
	}
	}

	coord0:=(k-1-wnum*floor((k-1)/wnum))*wsize
	coord1:=floor((k-1)/wnum)*wsize2

	winrestore, ahk_id %WindowID%
	winmove, ahk_id %WindowID%,,coord0, coord1, wsize, 3000
	array%k%:=WindowID
}
}
return

^!q::exitapp


Reply
Quote
Blue2Poker
Joined: 16.04.2012

Boas @xtremelexx

Apenas ainda não conseguir colocar a funcionar o 'Time Bank' e o 'I'm Back', estou a usar o table theme 'Classic'.

Obrigado e continuação de um bom trabalho.


Reply
Quote
xtremelexx
Joined: 08.11.2009

Original de Blue2Poker
Boas @xtremelexx

Apenas ainda não conseguir colocar a funcionar o 'Time Bank' e o 'I'm Back', estou a usar o table theme 'Classic'.

Obrigado e continuação de um bom trabalho.

Boas.
Em principio, o problema vem daí mesmo. O script não é universal porque daria muito trabalho escrevê-lo para funcionar com todos os table themes... este funciona só com o tema "Nova".
:fdrink


Reply
Quote
kinhodod
Joined: 09.01.2013

Original de xtremelexx
@kinhodod:
Script que organiza as mesas por ordem de abertura.
É conveniente ligar o script logo no inicio da sessão, para ele saber que ordem deve colocar as mesas (ordem de abertura).

Se a sala está a correr em Administrador, o script também deve estar.

Abraço.

Spoiler

#NoEnv
#SingleInstance force
Setwindelay -1
Sysget, Area, MonitorWorkArea
Area0 := Arearight - Arealeft
Area1 := Areabottom - Areatop
elapsedTime:=id:=idZ:=0
settimer, inicio, 50

inicio:
WinGet, id, list, ahk_class PokerStarsTableFrameClass,, Lobby
elapsedTime++
if (id!=idZ OR elapsedTime>60) {
elapsedTime:=0
idZ:=id

wsize:=wnum:=0
Loop, %id% {
	
	thiswsize:=Area0/A_Index
	calcrownum:=ceil(id/A_Index)
	if ((Area1/calcrownum) <= ((thiswsize-16)/1.45+38))
		thiswsize:=(Area1/calcrownum-38)*1.45+16
	
	if (thiswsize >= wsize)
		wsize:=thiswsize , wnum:=A_Index
}
wsize2:=(wsize-16)/1.45+38

Loop, 48 {
	abc:=array%a_index%
	ifwinnotexist, ahk_id %abc%
		array%a_index%:=0
}

flag2:=0
loop, 47 {
	if (flag2=1)
		break
	flag2:=0
	loop, 48 {
		kkk:=a_index+1
		if (array%a_index%=0 and a_index<48) {
			array%a_index%:=array%kkk%
			array%kkk%:=0
		}
		if (array%a_index%=0 and flag2=0)
			flag2:=1
		if (array%a_index%!=0 and flag2=1)
			flag2:=2
	}
}

Loop, %id% {
	WindowID:=id%a_index%
	flag:=0
	loop, 48 {
	if (WindowID = array%a_index%) {
		k:=a_index
		break
	}
	if (array%a_index%=0 and flag=0) {
		k:=a_index
		flag:=1
	}
	}

	coord0:=(k-1-wnum*floor((k-1)/wnum))*wsize
	coord1:=floor((k-1)/wnum)*wsize2

	winrestore, ahk_id %WindowID%
	winmove, ahk_id %WindowID%,,coord0, coord1, wsize, wsize2
	array%k%:=WindowID
}
}
return

^!q::exitapp

Caraca cara, que rápido!

Amanhã vou testar e volto pra dar feedback!

Obrigado!
:nh


Reply
Quote
nuno21nt
Joined: 28.06.2009

Original de xtremelexx
@kinhodod:
Script que organiza as mesas por ordem de abertura.
É conveniente ligar o script logo no inicio da sessão, para ele saber que ordem deve colocar as mesas (ordem de abertura).

Se a sala está a correr em Administrador, o script também deve estar.

Abraço.

Spoiler

#NoEnv
#SingleInstance force
Setwindelay -1
Sysget, Area, MonitorWorkArea
Area0 := Arearight - Arealeft
Area1 := Areabottom - Areatop
elapsedTime:=id:=idZ:=0
settimer, inicio, 50

inicio:
WinGet, id, list, ahk_class PokerStarsTableFrameClass,, Lobby
elapsedTime++
if (id!=idZ OR elapsedTime>60) {
elapsedTime:=0
idZ:=id

wsize:=wnum:=0
Loop, %id% {
	
	thiswsize:=Area0/A_Index
	calcrownum:=ceil(id/A_Index)
	if ((Area1/calcrownum) <= ((thiswsize-16)/1.45+38))
		thiswsize:=(Area1/calcrownum-38)*1.45+16
	
	if (thiswsize >= wsize)
		wsize:=thiswsize , wnum:=A_Index
}
wsize2:=(wsize-16)/1.45+38

Loop, 48 {
	abc:=array%a_index%
	ifwinnotexist, ahk_id %abc%
		array%a_index%:=0
}

flag2:=0
loop, 47 {
	if (flag2=1)
		break
	flag2:=0
	loop, 48 {
		kkk:=a_index+1
		if (array%a_index%=0 and a_index<48) {
			array%a_index%:=array%kkk%
			array%kkk%:=0
		}
		if (array%a_index%=0 and flag2=0)
			flag2:=1
		if (array%a_index%!=0 and flag2=1)
			flag2:=2
	}
}

Loop, %id% {
	WindowID:=id%a_index%
	flag:=0
	loop, 48 {
	if (WindowID = array%a_index%) {
		k:=a_index
		break
	}
	if (array%a_index%=0 and flag=0) {
		k:=a_index
		flag:=1
	}
	}

	coord0:=(k-1-wnum*floor((k-1)/wnum))*wsize
	coord1:=floor((k-1)/wnum)*wsize2

	winrestore, ahk_id %WindowID%
	winmove, ahk_id %WindowID%,,coord0, coord1, wsize, wsize2
	array%k%:=WindowID
}
}
return

^!q::exitapp

Puto, tu és deus Flags ternárias e o caraças. You're way ahead.


Reply
Quote
kinhodod
Joined: 09.01.2013

Original de kinhodod

Original de xtremelexx
@kinhodod:
Script que organiza as mesas por ordem de abertura.
É conveniente ligar o script logo no inicio da sessão, para ele saber que ordem deve colocar as mesas (ordem de abertura).

Se a sala está a correr em Administrador, o script também deve estar.

Abraço.

Spoiler

#NoEnv
#SingleInstance force
Setwindelay -1
Sysget, Area, MonitorWorkArea
Area0 := Arearight - Arealeft
Area1 := Areabottom - Areatop
elapsedTime:=id:=idZ:=0
settimer, inicio, 50

inicio:
WinGet, id, list, ahk_class PokerStarsTableFrameClass,, Lobby
elapsedTime++
if (id!=idZ OR elapsedTime>60) {
elapsedTime:=0
idZ:=id

wsize:=wnum:=0
Loop, %id% {
	
	thiswsize:=Area0/A_Index
	calcrownum:=ceil(id/A_Index)
	if ((Area1/calcrownum) <= ((thiswsize-16)/1.45+38))
		thiswsize:=(Area1/calcrownum-38)*1.45+16
	
	if (thiswsize >= wsize)
		wsize:=thiswsize , wnum:=A_Index
}
wsize2:=(wsize-16)/1.45+38

Loop, 48 {
	abc:=array%a_index%
	ifwinnotexist, ahk_id %abc%
		array%a_index%:=0
}

flag2:=0
loop, 47 {
	if (flag2=1)
		break
	flag2:=0
	loop, 48 {
		kkk:=a_index+1
		if (array%a_index%=0 and a_index<48) {
			array%a_index%:=array%kkk%
			array%kkk%:=0
		}
		if (array%a_index%=0 and flag2=0)
			flag2:=1
		if (array%a_index%!=0 and flag2=1)
			flag2:=2
	}
}

Loop, %id% {
	WindowID:=id%a_index%
	flag:=0
	loop, 48 {
	if (WindowID = array%a_index%) {
		k:=a_index
		break
	}
	if (array%a_index%=0 and flag=0) {
		k:=a_index
		flag:=1
	}
	}

	coord0:=(k-1-wnum*floor((k-1)/wnum))*wsize
	coord1:=floor((k-1)/wnum)*wsize2

	winrestore, ahk_id %WindowID%
	winmove, ahk_id %WindowID%,,coord0, coord1, wsize, wsize2
	array%k%:=WindowID
}
}
return

^!q::exitapp

Caraca cara, que rápido!

Amanhã vou testar e volto pra dar feedback!

Obrigado!
:nh

Olá xtremelexx!
Seguinte, botei rodar o script mas ele ficou aumentando o tamanho da minha mesa para o tamanho máximo. Por mais que eu tentasse diminuir, o script aumenta a tela.


Reply
Quote
xtremelexx
Joined: 08.11.2009

O script usa sempre o espaço todo que está disponível. Se abrir uma mesa, ela vai ocupar o máximo que puder. Se abrir 2, elas adaptam-se, de novo, para ocupar o máximo disponível.
Se abrir 15, elas ajustam-se seguindo o mesmo padrão.

Prefere que o tamanho seja predefinido manualmente ou automaticamente (como está agora)?
É bem fácil alterar. Só dizer.


Reply
Quote
kinhodod
Joined: 09.01.2013

Original de xtremelexx
O script usa sempre o espaço todo que está disponível. Se abrir uma mesa, ela vai ocupar o máximo que puder. Se abrir 2, elas adaptam-se, de novo, para ocupar o máximo disponível.
Se abrir 15, elas ajustam-se seguindo o mesmo padrão.

Prefere que o tamanho seja predefinido manualmente ou automaticamente (como está agora)?
É bem fácil alterar. Só dizer.

Ai que burro... :facepalm:

pode deixar assim mesmo, nem esquenta.
Amanhã testo de novo então.

Obrigado xtremelexx!


Reply
Quote
xtremelexx
Joined: 08.11.2009

Só mais uma coisa. Pequeno FAIL meu! :f_biggrin:
Não estava logged in na PokerStars quando testei o script então só consegui abrir 5 mesas (limite para quem está logged off).
Tava testando aqui agora com mais mesas e notei um pequeno bug que fica resolvido alterando a linha do quote 1 pela linha do quote 2.

Assim fica bom! :f_biggrin:

winmove, ahk_id %WindowID%,,coord0, coord1, wsize, wsize2

winmove, ahk_id %WindowID%,,coord0, coord1, wsize, 3000

Editei o post do script original.
:fdrink


Reply
Quote
PederPoker
Joined: 21.04.2008

Original de PederPoker
Olá xtremelexx, tudo bem?

Teria como fazer um outro script para abrir mesas, vou dar um exemplo:

Jogando SnG HT 1 mesa por vez, toda vez que acaba um torneio o script já te inscreve em outro igual.

Abraço!!

Boa noite xtremelexx, sem querer abusar de sua boa vontade mas deu tempo de dar uma olhadinho nisso??

Abraço! :)


Reply
Quote
xtremelexx
Joined: 08.11.2009

Original de PederPoker
Boa noite xtremelexx, sem querer abusar de sua boa vontade mas deu tempo de dar uma olhadinho nisso??

Abraço! :)
Opa PederPoker, tudo bem?
Esqueci-me desse script. Amanhã tratarei disso! (Pelo menos vou tentar... :f_biggrin: )
:fdrink


Reply
Quote
xtremelexx
Joined: 08.11.2009

Olá PederPoker!

Segue o script em spoiler.

Atenção/Importante.
Instruções:

1- O Lobby da PokerStars deve estar filtrado para mostrar só o tipo de torneio que joga.
Use os filtros certos para que não haja nenhum outro na lista.
2- O script vai registar no 1o SnG da lista, o que está no topo da lista.
Mais uma vez, use os filtros e ordene os SnG de forma a que o SnG certo esteja no topo da lista.
3- Na PokerStars, ir a "Options/Advanced Multi-Table Options" e activar "auto-close tournament without notification".

Abraço.

Spoiler

#NoEnv
#SingleInstance force
#persistent
SetTitleMatchMode, 2
SetTimer, inicio, 1000
return

inicio:

winget, ID, list, Hyper ahk_class PokerStarsTableFrameClass, , Lobby
if (ID=0 and !regist) {
	regist:=1
	ControlClick, PokerStarsListClass4, PokerStars Lobby
	ControlSend, PokerStarsListClass4, {PgUP}, PokerStars Lobby
	ControlClick, PokerStarsButtonClass10, PokerStars Lobby

	WinWait, Tournament Registration
	ControlClick, Button2, Tournament Registration
	ControlClick, PokerStarsButtonClass1, Tournament Registration
	sleep 1000
	WinWait, Tournament Registration
	WinClose, Tournament Registration
	sleep 3000
} else if (ID>=1) {
	regist:=0
}

return


Reply
Quote
nuno21nt
Joined: 28.06.2009

Vinha com ideias de te perguntar se tinhas pensado nalguma forma simples de resolver o que o PederPoker pediu. Parece que já cheguei tarde. Boa solução.


Reply
Quote