Here is new version, options from preferences menu work correctly now, added "restore" option (NoTitlebar.ahk):
Code:
; #### NoTitlebar ####
; AHK version: 1.0.46.09
; date: 5:12 PM Friday, April 06, 2007
; version: 1.04
; author: Roland (roland@overcards.com)
#NoEnv
#NoTrayIcon
#SingleInstance force
#Include %a_scriptDir%
#Include Functions.ahk
#Include *i casinos.ahk
#Include dfc.ahk
SetWorkingDir %a_scriptDir%
If 1 != -i
Menu, Tray, Icon
OnMessage(0x5555, "ExitMsg")
ini = NoTitlebar.ini
IniRead, includeLobby, % ini, Prefs, includeLobby, 0
IniRead, dragNdrop, % ini, Prefs, dragNdrop, 1
IniRead, noBorder, % ini, Prefs, noBorder, 0
IniRead, restore, % ini, Prefs, restore, 0
IniRead, version, % ini, Prefs, version
Loop, Casinos\*.ahk
casinos:=addToList(casinos, StrRep(a_loopFileName, ".ahk"))
Menu, Tray, NoStandard
Menu, Tray, Add, &Help, Help
Menu, Tray, Default, &Help
Menu, Tray, Add
Menu, Tray, Add, &About, About
Menu, Tray, Add
Menu, Tray, Add, &Preferences, Prefs
Menu, Tray, Add
Menu, Tray, Add, Plug-&In..., PlugIn
Menu, Tray, Add
Menu, Tray, Add, E&xit, Exit
Menu, Tray, Tip, NoTitlebar v%version%
If ( dragNdrop )
Hotkey, ~LButton, DragNDrop
SetTimer, timer, 500
return
; ## end of auto-execute section ##
; ## timer ##
Timer:
tables := tables()
Loop, Parse, tables, `,
{ If ( a_loopfield="" )
continue
WinGetPos,,, w,, ahk_id%a_loopfield%
If ( w!=wPrev%a_loopfield% ) {
WinWaitStatic(a_loopfield, 2000)
Cut(a_loopfield)
}
wPrev%a_loopfield% := w
}
return
; ## cut ##
Cut(win) {
global
WinGetPos,,, wsize, hsize, ahk_id%win%
;global caption,noBorder
WinGet, style, style, ahk_id%win%
code:=( style & 0x40000 ) ? 32 : 7
SysGet, border, % code
SysGet, caption, 4
b:=( noBorder ? border : 0 )
c:=dfc(caption . casino(win))
c:=caption!="" ? c : caption
c:=( noBorder ? caption+border : caption )
xx:=wsize-b, yy:=hsize-b
;WinSet, Region
; , %b%-%c% %xx%-%c% %xx%-%yy% %b%-%yy% %b%-%c%
; , ahk_id%win%
if !restore
{
WinSet, Style, -0xC00000, ahk_id%win%
if noborder
WinSet, Style, -0x40000, ahk_id%win%
else
{
WinSet, Style, +0x40000, ahk_id%win%
if !b
b:=border/2
else
b:=border
}
}
else
{
WinSet, Style, +0xC00000, ahk_id%win%
WinSet, Style, +0x40000, ahk_id%win%
if b
b:=-1*border
else
b:=0
if c
c:=-1*caption
else
c:=0
}
WinGetPos,,, wnew, hnew, ahk_id%win%
ControlGet, Z, Visible,,PokerStarsChatClass1, ahk_id %win%
if not Z
ControlGet, Z, Visible,,PokerStarsNoteEditorClass1, ahk_id %win%
if not Z
ControlGet, Z, Visible,,PokerStarsInfoClass1, ahk_id %win%
if not Z
ControlGet, Z, Visible,,PokerStarsInfoClass2, ahk_id %win%
if not Z
ControlGet, Z, Visible,,PokerStarsFrameClass2, ahk_id %win%
if Z
if ((wnew=wsize) and (hnew=hsize))
{
w1:=wsize-2*b
h1:=hsize-2*b-c
WinSet, Region
,0-0 w%w1% h%h1%
, ahk_id%win%
}
noborder%win%:=true
}
; ## tables ##
tables() {
global casinos, includeLobby, auto
Loop, Parse, casinos, `,
{ lobby := dfc("lobby" . a_loopfield)
If ! lobby
continue
theseTables:=dfc("tables" . a_loopfield, lobby)
If ( theseTables="" )
continue
tables := addToList(tables, theseTables)
If ( includeLobby )
tables := addToList(tables, lobby)
} return tables
}
; ## casino ##
casino(id) {
global casinos
Loop, Parse, casinos, `,
{ lobby := dfc("lobby" . a_loopfield)
If ! lobby
continue
If IsIn(id, dfc("tables" . a_loopfield, lobby))
return a_loopfield
}
}
; ## drag&drop ##
DragNDrop:
win := MouseGetWin()
tables := tables()
If ! IsIn(win, tables)
return
MouseGetPos,, y
If ( y > 60 )
return
WinExist("a")
PostMessage, 0xA1, 2
return
; ## Prefs ##
Prefs:
Gui, +toolwindow
Gui, Margin, 5, 5
Gui, Font,, Comic Sans MS
Gui, Add, Checkbox, vincludeLobby checked%includeLobby%, &Include Lobby
Gui, Add, Checkbox, vdragNdrop checked%dragNdrop%, &Enable drag&&drop
Gui, Add, Checkbox, vnoBorder checked%noBorder%, &Strip border completely
Gui, Add, Checkbox, vrestore checked%restore%, &restore borders and caption
Gui, Add, Button, default section h20, Submit
Gui, Add, Button, ys h20, &Cancel
Gui, Show,, Preferences
return
ButtonSubmit:
Gui, Submit
IniWrite, % includeLobby, % ini, Prefs, includeLobby
IniWrite, % dragNdrop, % ini, Prefs, dragNdrop
IniWrite, % noBorder, % ini, Prefs, noBorder
IniWrite, % restore, % ini, Prefs, restore
Reload
return
GuiClose:
GuiEscape:
ButtonCancel:
Gui destroy
return
; ## tray menu ##
Help:
Run http://www.overcards.com/wiki/moin.cgi/NoTitlebar
return
About:
TrayTip
, NoTitlebarStars v%version%, Author: Roland`nE-mail: roland@overcards.com
,, 1
return
PlugIn:
RunWait PlugIn.ahk
Run Start.ahk
Exit:
exitApp