Saltar para o fórum
[Scripts] Stacked T...
 
Notificações
Limpar tudo

[Scripts] Stacked Table Viewer UPGRADE

336 Mensagens
48 Utilizadores
0 Reações
59.9 K Visualizações
xtremelexx
Membro desde: 08.11.2009

Original de nuno21nt
O que acontece se eu for o rs03rs03 e quiser jogar mais do que 24 sits ao mesmo tempo?

Pensei nisso. Parte do script já foi escrita para acolher até 48 mesas (esse "loop, 48" serve para isso) mas depois pensei: "Quem é que joga 24+ mesas Tiled? 24+ jogam-se stacked..."

Original de TheGameOver
Em relacao ao primeiro script, eu tentei botar pra rodar aqui, porém quando abro trava o pc, travado mesmo não consigo nem dar Alt + Tab, depois de un 15 seg o símbolo da PS dá uma mexida e trava dnovo.......

Dei voltas à cabeça aqui e não entendo porquê. Talvez seja o "setwindelay 0" que faça isso. Não sei mesmo.

Original de TheGameOver
Estou procurando meus códigos da epoca de computacao pra por aqui o /

Valeu! Estás à vontade para pôr aqui. :f_thumbsup:


Responder
Citar (Quote)
xtremelexx
Membro desde: 08.11.2009

Original de nuno21nt

True Story.
Acho que o jeito mesmo é escrever linhas de código ao calhas e fazer F5 até que funcione!


Responder
Citar (Quote)
rgs78
Membro desde: 19.07.2009

Original de xtremelexx
Olá a todos.

Lembrei-me de criar um tópico que servisse para postarmos aqui os nossos scripts.
Apelo a todos os amantes de programação, desde os iniciantes até aos mais aguerridos. São todos bem vindos! :f_thumbsup:

Obrigado por teres excluído gajos como eu. :(


Responder
Citar (Quote)
nuno21nt
Membro desde: 28.06.2009

Original de rgs78

Original de xtremelexx
Olá a todos.

Lembrei-me de criar um tópico que servisse para postarmos aqui os nossos scripts.
Apelo a todos os amantes de programação, desde os iniciantes até aos mais aguerridos. São todos bem vindos! :f_thumbsup:

Obrigado por teres excluído gajos como eu. :(
O que ele, na verdade, quis dizer com isso foi:
Se eu consegui aprender a mexer nesta linguagem em dois dias, qualquer um consegue numas horas.


Responder
Citar (Quote)
rgs78
Membro desde: 19.07.2009

Original de nuno21nt

Original de rgs78

Original de xtremelexx
Olá a todos.

Lembrei-me de criar um tópico que servisse para postarmos aqui os nossos scripts.
Apelo a todos os amantes de programação, desde os iniciantes até aos mais aguerridos. São todos bem vindos! :f_thumbsup:

Obrigado por teres excluído gajos como eu. :(
O que ele, na verdade, quis dizer com isso foi:
Se eu consegui aprender a mexer nesta linguagem em dois dias, qualquer um consegue numas horas.


Responder
Citar (Quote)
xtremelexx
Membro desde: 08.11.2009

Original de rgs78

Original de nuno21nt

Original de rgs78

Original de xtremelexx
Olá a todos.

Lembrei-me de criar um tópico que servisse para postarmos aqui os nossos scripts.
Apelo a todos os amantes de programação, desde os iniciantes até aos mais aguerridos. São todos bem vindos! :f_thumbsup:

Obrigado por teres excluído gajos como eu. :(
O que ele, na verdade, quis dizer com isso foi:
Se eu consegui aprender a mexer nesta linguagem em dois dias, qualquer um consegue numas horas.


Responder
Citar (Quote)
mkofera2
Membro desde: 24.03.2011

Original de nuno21nt
First

Eish, que tópico mais épico!

>>>> <<<<

aahahhhahahhha


Responder
Citar (Quote)
nuno21nt
Membro desde: 28.06.2009


Responder
Citar (Quote)
xtremelexx
Membro desde: 08.11.2009

Muito bom!


Responder
Citar (Quote)
dtmobil
Membro desde: 22.11.2011

Original de xtremelexx
SCRIPT nº2.

Dificuldade: Baixa
Tempo: 2h30

Opa pessoal, depois do estrondoso fracasso do 1º script , lembrei-me de fazer outro relacionado com Poker, desta vez!
Apresento-vos o TilesOrganizer!! :f_biggrin:

Este script serve para quem não gosta da forma como as salas organizam as mesas. Permite jogar até 24 mesas Tiled sem sobreposição. Num futuro próximo poderá ser configurado também.
Este é um trabalho a decorrer e pode ser alterado. Vejam o vídeo abaixo para terem uma ideia de como funciona!
O código segue mais abaixo no SPOILER!
Façam sugestões. Que funcionalidades querem ver implementadas?

Spoiler
#NoEnv
SetTitleMatchMode 2
setwindelay 0
Sysget, Area, MonitorWorkArea
Area0 := Arearight-Arealeft
Area1 := Areabottom-Areatop
id:=0
idZ:=0
Loop, 48 {
	array%a_index%:=0
}
gui, font, s20 w700 verdana
gui, add, text, x5 y0 c00FF00 vContagem, 00
gui, color, 0
idY:=Areabottom-33
gui, show, x%Arealeft% y%idY% w40 h6, Mesas
winset, AlwaysOnTop, on, Mesas
winset, Style, -0xC00000, Mesas

settimer, inicio, 500

inicio:
WinGet, id, list, ahk_class PokerStarsTableFrameClass,, Lobby
GuiControl, text, Contagem, %id%
if (id>idZ)
	idZ:=id
if (idZ=1) {
	width2:=Area0
	width3:=Area1
	coord:=1
}
if (idZ=2) {
	width2:=Area0/2
	width3:=Area1
	coord:=2
}
if (idZ>2) {
	width2:=Area0/2
	width3:=Area1/2
	coord:=3
}
if (idZ>4) {
	width2:=Area0/3
	width3:=Area1/2
	coord:=4
}
if (idZ>6) {
	width2:=Area0/3
	width3:=Area1/3
	coord:=5
}
if (idZ>9) {
	width2:=Area0/4
	width3:=Area1/3
	coord:=6
}
if (idZ>12) {
	width2:=Area0/5
	width3:=Area1/4
	coord:=7
}
if (idZ>20) {
	width2:=Area0/6
	width3:=Area1/4
	coord:=8
}
winmove, ahk_id %id1%,,0, 0, width2, width3
wingetpos,,, width0, width1, ahk_id %id1%


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


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

	if (coord=1)
		coord0:=coord1:=0
	if (coord=2) {
		coord0:=(k-1)*width0
		coord1:=0
	}
	if (coord=3) {
		coord0:=(k-1-2*floor((k-1)/2))*width0
		coord1:=floor((k-1)/2)*width1
	}
	if (coord=4 or coord=5) {
		coord0:=(k-1-3*floor((k-1)/3))*width0
		coord1:=floor((k-1)/3)*width1
	}
	if (coord=6) {
		coord0:=(k-1-4*floor((k-1)/4))*width0
		coord1:=floor((k-1)/4)*width1
	}
	if (coord=7) {
		coord0:=(k-1-5*floor((k-1)/5))*width0
		coord1:=floor((k-1)/5)*width1
	}
	if (coord=8) {
		coord0:=(k-1-6*floor((k-1)/6))*width0
		coord1:=floor((k-1)/6)*width1
	}

	winrestore, ahk_id %kk%
	winmove, ahk_id %kk%,,coord0, coord1, width2, width3
	array%k%:=kk
}
return

^!q::exitapp
^!x::
flag2:=0
idZ:=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
	}
}
return

como coloco para funcionar este script?!


Responder
Citar (Quote)
RAimi
Membro desde: 25.12.2007

Olá dtmobil!

Es é um programa executado pelo AutoHotkey (deves executá-lo através dele), disponível no link abaixo:

http://www.autohotkey.com/

No tópico abaixo podes obter mais informações sobre o assunto:

Stacked Table Viewer Thread

Abraço!


Responder
Citar (Quote)
dtmobil
Membro desde: 22.11.2011

Original de RAimi
Olá dtmobil!

Es é um programa executado pelo AutoHotkey (deves executá-lo através dele), disponível no link abaixo:

http://www.autohotkey.com/

No tópico abaixo podes obter mais informações sobre o assunto:

Stacked Table Viewer Thread

Abraço!

solicito agora ajuda a por para funcionar...
ja baixei o hot key instalei..
agora onde salvo o codigo que ja copiei do tile organizer... ??
e coloco para funcionar!
?

vlw!


Responder
Citar (Quote)
blueanj
Membro desde: 12.11.2010

Tópico muito interessante.

:nh


Responder
Citar (Quote)
xtremelexx
Membro desde: 08.11.2009

Original de dtmobil

Original de RAimi
Olá dtmobil!

Es é um programa executado pelo AutoHotkey (deves executá-lo através dele), disponível no link abaixo:

http://www.autohotkey.com/

No tópico abaixo podes obter mais informações sobre o assunto:

Stacked Table Viewer Thread

Abraço!

solicito agora ajuda a por para funcionar...
ja baixei o hot key instalei..
agora onde salvo o codigo que ja copiei do tile organizer... ??
e coloco para funcionar!
?

vlw!

Olá dtmobil,

A forma mais fácil é correr directamente este .exe aqui: link.
TilesOrganizer.rar
File Size: 198.33KB
É o mesmo script mas transformei-o em exe para poder ser iniciado mesmo sem ter o AutoHotKey instalado.

Código:

Spoiler

#NoEnv
SetTitleMatchMode 2
setwindelay 0
Sysget, Area, MonitorWorkArea
Area0 := Arearight-Arealeft
Area1 := Areabottom-Areatop
id:=0
idZ:=0
Loop, 48 {
	array%a_index%:=0
}
gui, font, s20 w700 verdana
gui, add, text, x5 y0 c00FF00 vContagem, 00
gui, color, 0
idY:=Areabottom-33
gui, show, x%Arealeft% y%idY% w40 h6, Mesas
winset, AlwaysOnTop, on, Mesas
winset, Style, -0xC00000, Mesas

settimer, inicio, 500

inicio:
WinGet, id, list, ahk_class PokerStarsTableFrameClass,, Lobby
GuiControl, text, Contagem, %id%
if (id>idZ)
	idZ:=id
if (idZ=1) {
	width2:=Area0
	width3:=Area1
	coord:=1
}
if (idZ=2) {
	width2:=Area0/2
	width3:=Area1
	coord:=2
}
if (idZ>2) {
	width2:=Area0/2
	width3:=Area1/2
	coord:=3
}
if (idZ>4) {
	width2:=Area0/3
	width3:=Area1/2
	coord:=4
}
if (idZ>6) {
	width2:=Area0/3
	width3:=Area1/3
	coord:=5
}
if (idZ>9) {
	width2:=Area0/4
	width3:=Area1/3
	coord:=6
}
if (idZ>12) {
	width2:=Area0/5
	width3:=Area1/4
	coord:=7
}
if (idZ>20) {
	width2:=Area0/6
	width3:=Area1/4
	coord:=8
}
winmove, ahk_id %id1%,,0, 0, width2, width3
wingetpos,,, width0, width1, ahk_id %id1%


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


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

	if (coord=1)
		coord0:=coord1:=0
	if (coord=2) {
		coord0:=(k-1)*width0
		coord1:=0
	}
	if (coord=3) {
		coord0:=(k-1-2*floor((k-1)/2))*width0
		coord1:=floor((k-1)/2)*width1
	}
	if (coord=4 or coord=5) {
		coord0:=(k-1-3*floor((k-1)/3))*width0
		coord1:=floor((k-1)/3)*width1
	}
	if (coord=6) {
		coord0:=(k-1-4*floor((k-1)/4))*width0
		coord1:=floor((k-1)/4)*width1
	}
	if (coord=7) {
		coord0:=(k-1-5*floor((k-1)/5))*width0
		coord1:=floor((k-1)/5)*width1
	}
	if (coord=8) {
		coord0:=(k-1-6*floor((k-1)/6))*width0
		coord1:=floor((k-1)/6)*width1
	}

	winrestore, ahk_id %kk%
	winmove, ahk_id %kk%,,coord0, coord1, width2, width3
	array%k%:=kk
}
return

^!q::exitapp
^!x::
flag2:=0
idZ:=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
	}
}
return

Caso contrário, sem .exe:
Para pôr o script a funcionar deve seguir estes passos:
Etapa1: Instalar o autoHotKey. Esta parte já está.
Etapa2: Fazer click direito no ambiente de trabalho ou numa pasta à sua escolha (é onde vai ficar guardado o script) e fazer "New", "AutoHotKey Script" (imagem 1)
Etapa3: No ficheiro que acabou de ser criado, fazer click direito novamente e escolher EDIT. Isto vai abrir o Notepad. Suprimir o conteudo do ficheiro e substituir pelo código do script. Gravar. (imagem 2)
Etapa2 alternativa: Se não aparece a opção "AutoHotKey Script" na etapa2, a alternativa passa por criar um ficheiro .txt, abri-lo com Notepad e colocar lá o código que copiou daqui.
Etapa3 alternativa: Fazer "Guardar Como" e alterar a extensão para .ahk em vez de .txt
Escolher o Tipo "All Files" para gravar em ahk, caso contrário ele grava em .txt (imagem 3)

Etapa4: Iniciar o ficheiro .ahk criado. Esse é o nosso script.

IMAGEM1

IMAGEM2

IMAGEM3

Relembrando que se a PokerStars estiver a correr em modo "Administrador", o script também deverá ser. Isto para que o script possa mexer nas mesas.
Assim:
Click direito no ficheiro .ahk ou no .exe, Propriedades, Compatibilidade, correr em Administrador.

Abraço.


Responder
Citar (Quote)
xtremelexx
Membro desde: 08.11.2009

Este script funciona na PokerStars apenas.
Para funcionar em outras salas, é só substituir esta linha:
WinGet, id, list, ahk_class PokerStarsTableFrameClass,, Lobby

iPoker.
WinGet, id, list, o vosso nick na sala,, Nickname:
por exemplo:
WinGet, id, list, xtremelexx,, Nickname:

PartyPoker.
WinGet, id, list, Hold'em
(Cash Games NLHE apenas)


Responder
Citar (Quote)
xtremelexx
Membro desde: 08.11.2009

SCRIPT nº3.

Dificuldade: Média
Tempo: 12h00

Olá a todos! :f_thumbsup:

Este Script baseia-se no trabalho de freo.
Acabei por fazer alterações significativas no código para ficar mais completo, mais leve e corrigi alguns erros.
Apresento-vos o Stacked Table Viewer 1.16 _XTlex UPGRADE

O que há de novo?
Havia muito código repetido que estava a sobrecarregar o script inutilmente. Tirei.
Corrigi todos os erros de coordenadas que davam erro ao tentar clicar em botões.
Já não há aquele espaço desperdiçado entre mesas como havia.
Adicionei um Menu de configuração.
É possível agora jogar directamente a partir do preview. Fold, Call, Raise, Sitout como se estivesse directamente a clicar na mesa.
Numeração das mesas para acesso mais fácil.
Ctrl+Alt+x para reorganizar os previews quando se fecham muitas, para não ficarem espaços vazios que não se querem.

Como pôr a funcionar?
- instalar autohotkey. http://www.autohotkey.com/download/
- criar um ficheiro .txt e colar lá o código.
- mudar o nome do ficheiro de MyScript.txt para MyScript.ahk
- Correr o ficheiro.
Só funciona em Vista e win7 com Aero ligado. Versões anteriores de windows não tinham aero então não dá.
Se a sala estiver em modo Administrador, o script também deve estar!

O código segue em spoiler:

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=ps						;Pokersite ID - ps for Pokerstars, cu for Customised (you'll need to change cu settings further down)
hostwindoww:=1230				;Host preview window width, internal dim
hostwindowh:=568					;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=483										;custom site/application base resolution width
	ptablebaseh=353										;custom site/application base resolution height
	windowtitle=											;Window title to match to find tables
	windowtitle2=											;Window title of the closing table message
	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%
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


Responder
Citar (Quote)
xtremelexx
Membro desde: 08.11.2009

Versão .exe para quem não quer instalar o AutoHotKey.
Em contrapartida este não pode ser configurado...

ENJOY!
:f_thumbsup:

STViewer_Upgrade.rar (201.62KB)
http://www.sendspace.com/file/g58wc9


Responder
Citar (Quote)
TMB814
Membro desde: 27.05.2011

Ahah muito bom o que aqui aparece no entanto o máximo que posso postar por agora é o reversi ou o minesweeper em java e a funcionar em cmd:P Ainda estou no primeiro ano de Engenharia Informática mas já se vai aprendendo umas coisas :)


Responder
Citar (Quote)
LobinhoJR
Membro desde: 10.03.2011

Muito interessante!! Esse programa funciona só pra cash, ou pra qualquer jogo?


Responder
Citar (Quote)
xtremelexx
Membro desde: 08.11.2009

Original de TMB814
Ahah muito bom o que aqui aparece no entanto o máximo que posso postar por agora é o reversi ou o minesweeper em java e a funcionar em cmd:P Ainda estou no primeiro ano de Engenharia Informática mas já se vai aprendendo umas coisas :)
Thank you.

Fica à vontade para postar, TMB814.
Todos os scripts são bem vindos e eu gosto de Reversi e MineSweeper! Então calha bem!
:f_biggrin:


Responder
Citar (Quote)