By APerfect10. The corresponding thread on 2+2 is here.


DeMonster v2.0.1 Beta

This is DeMonster's Beta page. Changes, fixes, and updates will first appear on the beta before DeMonster final release. Keep in mind that this beta is for testing so there may be bugs.

This script will completely eliminate the Monster Jackpot, Slider & Popup windows on PartyPoker.

No need for 1x1 blank images, this script will work with Party's default images as well as modified images.

The Monster Jackpot slider consumes a lot of CPU; running DeMonster and auto-pinning each slider will regain this CPU and increase performance of the PartyPoker application.

NoSpam! Eliminate popups and automate repetitive non-game play tasks ie) Auto login, auto post BB, auto leave table, etc. (see below)

How To Use This Script

  1. Read instructions for AutoHotkey, and make sure you have the latest version installed.

  2. Read all instructions on this page.

  3. Save the script code below in a file (or download via the link) and save to "DeMonster.ahk"

  4. DO NOT EDIT any of the scripts!

  5. Run the script (double-click the file).

  6. Choose the directory where you want to install DeMonster

  7. After installation, click OK and run the script.

  8. Right click in the system tray and choose "Settings" to choose your preferences.

Default settings will:

  1. Auto close Monster popups when joining a Monster table.

  2. Pin all monster jackpot sliders on Monster tables.

  3. Disable & Hide monster jackpot on Monster tables.

Optional Settings will:

  1. Disable Lobby Jackpot

  2. Auto minimize lobby news & events

  3. Auto join waiting list

  4. Auto join first available table

  5. Auto Buy-in (any amount)

  6. Auto leave table

  7. Auto post big blind

  8. Auto wait for big blind

  9. Auto login

  10. No spam/popups

  11. Auto scroll to last game in hand history

  12. Auto select chat options

  13. Hotkeys to sitout (play until blinds or not) & return

  14. Hotkey to auto leave tables and close Party Poker

  15. (Stack Reloader) Hotkeys to reload all or active table(s)

Detailed explanation of Optional settings

A blue DeMonster icon will show in the system tray as long as the script is running. Right-click this icon and choose "Exit" to exit the script. If the script seems to have gone wild, choose "Reload this script".

Change Log

Troubleshooting

If things don't seem to work, restart the script from the system tray.

Download

Download DeMonster v2.0.1 Beta (Right click save as)

Script Code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   Code begins here   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;++##\\Installation
;------------------------------------------------------------------------------------------------
;       DeMonster Installation
;------------------------------------------------------------------------------------------------
;       Date: 2006-09-22
;------------------------------------------------------------------------------------------------
;       Author(s): APerfect10
;------------------------------------------------------------------------------------------------
;________________________________________________________________________________________________
;
;       DO NOT EDIT THIS SCRIPT!
;________________________________________________________________________________________________

#NoEnv

version = 2.0.1 Beta
reqAHKversion = 1.0.44.12
ini = DeMonster\DeMonster.ini

IsCompiled()
CheckAHKVersion(reqAHKversion)

InstallFolder := SelectFolder()
If( InstallFolder = "" )
        ExitApp

CurrentDir = %A_WorkingDir%
SetWorkingDir %InstallFolder%

IfNotExist DeMonster
        FileCreateDir DeMonster
IfNotExist DeMonster\Modules
        FileCreateDir DeMonster\Modules
IfNotExist DeMonster\Includes
        FileCreateDir DeMonster\Includes

IniWrite, %version%, %ini%, Misc, version
IniWrite, %reqAHKversion%, %ini%, Misc, reqAHKversion

;Installation

Menu, Tray, NoStandard
Menu, Tray, DeleteAll
Menu, Tray, Add, Exit, Exit
Menu, Tray, Tip, DeMonster Installation

Gui, +Lastfound +Owner -SysMenu
Gui, Color, b0d4e2
Gui, Font, s11 bold, Comic Sans MS
Gui, Margin, 10, 10
Gui, Add, Text, vTxt, DeMonster was successfully installed.`nLaunch now?
GuiControl,,Txt, Please wait...
Gui, Add, Progress, vProg w300 c0c66b1 Backgroundffffff
Gui, Font, s8 norm
Gui, Add, Checkbox, % "vcb1 checked" IniRead(ini,"Installation","Shortcut",1), Create Desktop Shortcut
Gui, Add, Button, vButton1 w50 Section disabled +default h20 gButton, Okay
Gui, Add, Button, vButton2 w50 ys disabled h20 gButton, &Cancel
Gui, Show,, DeMonster Installation

SetTimer, Progress, 50

FileRead, code, %CurrentDir%\%A_ScriptName%
FileDelete %CurrentDir%\%A_ScriptName%

FileAppend, %code%, DeMonster_Install.ahk

key = `;++##\\Installation
code := key . StrMid(code, key, key " - end") . key " - end"
;FileDelete DeMonster\DeMonster_Install.txt
;FileAppend, %code%, DeMonster\DeMonster_Install.txt

Install()

FileDelete,DeMonster_Install.ahk

FileCreateShortcut, %a_workingdir%\DeMonster\DeMonster.ahk
          , %a_workingdir%\DeMonster\DeMonster.lnk, %a_workingDir%\DeMonster
          ,,, %a_workingDir%\DeMonster\DeMonster.ico

SetTimer, Progress, Off
Loop {
 prog_++
 If ( prog_ >= 100 )
                break
 GuiControl,,Prog, +1
 Sleep 10
}
GuiControl,, Txt, DeMonster was successfully installed. Launch now?
GuiControl, Enable, Button1
GuiControl, Enable, Button2
return

;####################

Button:
Gui Submit
IniWrite %cb1%, %ini%, Installation, Shortcut
If ( cb1 ) 
 FileCreateShortcut, %a_workingdir%\DeMonster\DeMonster.ahk
                        , %A_Desktop%\DeMonster.lnk, %a_workingDir%\DeMonster
                        ,,, %a_workingDir%\DeMonster\DeMonster.ico, t
If a_guicontrol = Button2
 ExitApp
Run DeMonster\DeMonster.lnk
ExitApp
return

Exit:
ExitApp

Progress:
prog_++
If ( prog_ = 100 ) {
        prog_ = 0
        GuiControl,,Prog,0
 }
GuiControl,,Prog,+1
return

ExcludeCode(name, fileName) 
{
        filename = %A_WorkingDir%\%fileName%

        replace1 =
        start = `;++##\\%name%
        end = %start% - end

        replace1 = `#Inc
        comment1 = `;--==Comment==--%replace1%

        FileDelete %fileName%

        FileRead, code, %A_WorkingDir%\DeMonster_Install.ahk
        
        StringReplace, code, code, %comment1%, %replace1%, 1

        If(name = "Help")
        {
                replace2 = [
                comment2 = ``;--==Comment==--[
                StringReplace, code, code, %comment2%, %replace2%, 1
        }
        FileAppend, % TrimWhiteSpace(StrMid(code, start, end)), %fileName%
}

Install() 
{
        SetBatchLines -1

        l := CreateBinaryFile(DeMonsterIcon(), "DeMonster\DeMonster.ico", "pebwa")
        l := CreateBinaryFile(HelpIcon(), "DeMonster\HelpIcon.ico", "pebwa")
        l := CreateBinaryFile(PixelImage(), "DeMonster\pixel.gif", "pebwa")

        ExcludeCode("MainScript","DeMonster\DeMonster.ahk")
        ExcludeCode("Settings","DeMonster\Settings.ahk")
        ExcludeCode("About","DeMonster\About.ahk")
        ExcludeCode("Help","DeMonster\DeMonsterHelp.txt")
        ExcludeCode("Common","DeMonster\Includes\include.Common.ahk")
        ExcludeCode("NoSpam Module","DeMonster\Modules\module.NoSpam.ahk")
        ExcludeCode("DeMonster Module","DeMonster\Modules\module.DeMonster.ahk")

        SetBatchLines 10ms
} 

;################# Zipped Files ####################

DeMonsterIcon() {
var1 =
( Join %,`
Ÿœ1)á—••†"•†"•00†1•†"•†%•h†'••†7‡$—•(‡$—•0‡$—•`‡$—•†"•†%‡*—•†4†,••†4†,••†1‡(—•
êëÞ•âÔ°•±f†-•«†­Y•óºU•†½¡†»•##†9•ogP•NH0•冮†9•Ú¾†®•†¹yA•É£f‡&—•ÿÿÿ‡&—•‰&—ÿþ•†
"ªZª†1†1ï‰/—ÿð†"W·'+·w\¡†0‰-—ÿþ†"[‡$—º""""†¤:†@‰,—ÿàÆµDDDD†º†º""':’ï‰)—ÿþ†-DJ
†2†"†;DDD†º†³"(¼’‰)—ÿðÄÁ†/îáx†§†¬ÄDI†³"(z†1‰(—ÿìL†/î†"vmÖh†¬Ä¤I†³"'1†0‰&—ÿþ¤0î
àVmh†¬»»³Ä¤I†³"†¤’‰&—ÿðL^î†8mh†¬»3³33ʤI"(:‰&—ÿêG†?ᆮÖ{»;³³33<ʤ†³"†¤¯ÿÿÿÿ†%E
†/XÖ†¬»»»333ÃÃ̪D†³(1ÿÿÿþ†5µ†"mh»»»333ÃÌÌÌʪ†º"†­†@ÿÿ𤵆)Ö†¬»»³3<<‰&—̪I†³(’ÿ
ÿð†5uVØ»»³ÃÌ<‰'—Ìʆ;†³"ºïÿñ†5umg»»;x†©xs‰'—Ì¡I"†­†@ÿðLum†¬»»fmÝÝf|ÌÌ3;3ʤ†³'’ÿ
ð†5um†¬»†§Öh{xmkÌÆ§fhs†5†³(Áÿñ†=wÖ†¬»mk<ÌÌÈØÃvh†©†§h¡I"z†0ð†5·Ö†¬»m†­¬ÌÌÈÖ7fu
PU†®†«†:"%†0ð†=wÖ{»†®gÌÌÌÈØ¸gP•†&Xפ†³†¤†?ð†57݆¬»¸Ö¼ÌÌ6×¶e•†&xwf†;†³'Pð†+Èm†¬
»·m|Ì̆®l}†¦•†&Ýhf†2I(Pð†+G†®g»;m|ÌÈÖ¼½cP†6ffg†"I"Qð†"dž§Ø»8Ý|ÃvØÌ6Ö†©†¨†§Ý׆;
©"qð†"Lw݆¬vØ<Çm†¤ÌÇfh†©†©†§hw¤"qþ•¥u†®hmcÃvØ<Ìû³Ã33†§†¦†5†³†«þ•†=7XÝÖ¼8݆¤Ã‰
(—Ì8†¨†;†³ºÿà†;ÇxÝk;†®h3<É&—Ì38†¨¡†³†«ÿà†"Çmh<vÖ†¤Ã3ÃÌ<ÌÌÃ;ff†«†³µÿî†"£f†¤vÝÖ
w»333Ãûw†§†§hºBzÿîà†=vvmhmÖh†¨w·w†©ffgU†2†"B*ÿþ†/†;VÝg†&X†§m‰'—ÝÖq†/îêIzÿÿî†"
Ãh†/î†/àw†©mÖ†©m݆¦†/îîáBqÿÿîà¥7Pî•î†&xÖh†§Ýg†?îîîäK°ÿÿþà†+Çuîîî†8mÖfÝgPîîîî†"
BÀÿÿÿî†"\wPà†$mÝÝÝgP‰&—î†"†¼’ÿÿÿîà†;WuUmÝÝÖ†¨Q‰'—î†5†¸†?ÿÿÿþî†"¥xmÝfh†¦P‰(—î†5
†½†0ÿÿÿÿ;[f†©uU‰)—îàD±ïÿÿÿÿþWuP†/‰)—î†+I’‰'—ÿþî†"ª7uQ†/‰'—î•TC†/‰(—ÿàà†;
¬7uU‡$—•†/=DÁï‰(—ÿþà•†2¬ÇwuU†2†"QUÄL†?‰*—ÿþà•†2¤¬77ww3ÄDÀï‰+—ÿî••†2†5†5‰&—D
A†/‰-—ÿî••†"†2†2†5†5ª¡î‰/—ÿþà•†1‡$—2†1î‰?—ÿà•†@ÿÿ••ÿ†¡•†(ÿÿ••þ••†"ÿÿ••ü‡$—•†@ÿ
†¡Dø‡$—•†0ÿ••ø‡$—•†$ÿ••ð‡$—•†"ÿ••à‡%—•ÿ••à‡%—•ÿ••À‡%—•† ••À‡%—•?••†¡‡%—•†@••†¡
‡%—•†0••†¡‡%—•†(••†¡‡%—•†(••†¡‡%—•†$••†¡‡%—•†$••†¡‡%—•†"••†¡‡%—•†"••†¡‡(—•†¡‡(
—•†¡‡(—•†¡‡(—•†¡‡(—•†¡‡(—•†¡‡(—•†¡‡(—•À‡(—•À‡(—•À‡(—•À‡(—•à‡(—•ð‡(—•ð‡(—•ø‡(—•
ü‡(—•ü‡(—•þ‡%—•†"••ÿ‡%—•†"••ÿ†¡‡$—•†$••ÿà‡$—•†$••ÿð‡$—•†(••ÿø‡$—•†0••ÿþ‡$—•†@•
•ÿÿ‡$—•?••ÿÿÀ••ÿ••ÿÿø•†$ÿ••‰'—ÿ
)

return var1
}

HelpIcon(){
var1 =
( Join %,`
Ÿœ14{—••†"•†"•0.••†"•†)•8†/••†7‡$—•(‡$—•0‡$—•\‡$—•†"•†)‡*—•†4†,••†4†,‡$—•†"‡'—
•ðʦ•ª?*•ÿ?*•ª?U•ª_U•ÿ_U•ª† U•ÿ† U•ª_† •ª† † •ÿ† † •ª†À† •ÿ†À† •ª†Àª•ÿ†Àª•ª¿ª•
ÿ¿ª•ÿßÔ•ÿÿÔ•ÿßÿ•ÿÌÌ•U†@*•ª†@*•ÿ†@*•U?*•ðûÿ•¤’’•ÿÿÿ‡%ä—•‡µ—=†1†*†+†+†*‡'—+†*‡B—
=†:†*‡1—+‡=—=†5†*†*†+†*†+†+‡%—-†+†-†+†+†-‡'—+‡:—=†%‡%—*†+†+†-†/†-‡'—/†-†-‡'—+‡
7—=†<†)†*†+†*‡$—-†/†-‡'—7†"†#†&†/†/†-†-‡&—+‡4—=†2‡$—*†+‡$—/†"†6‡)—7†"†7†7†#†1†
-†-‡&—+‡2—=†2†*†*†+†-†-†/†7†7†6‡+—7†"†"†8†#†#†/†/†-‡%—+‡1—=†*†*†+†-†/†/†7†6‡'—
7†-†-†/†-†#†"†"†#†"†8†#†#†"†/†-‡$—+†*‡/—=†'†*†*†-†/†"†7†6†6†7†6‡$—7‡'—/†"†"†8‡
'—#†/†-‡$—+‡.—=†%†*†*†-†/†%†6†7†6†6‡%—7†6‡'—/†"†"†7‡(—#†/†-‡$—+‡-—=†*†*†-†/†1†
6‡&—7†"†7†"†6†/†1†/†1†/†1†"‡$—7‡$—#†8†7†"†7†-†-†+†+†*‡+—=†)†*†+†-†/†6†7†6†6‡(—
7†1†1†/†1†1†/‡&—"†#‡$—"†8†7†1†-‡$—+‡*—=†0†*†,†/†/†6†7†"†7†6†"†7†"†7†"†7†"†7†5†
1†1†5†"†7†"‡%—7†"†8†7‡$—"†/†-‡$—+‡)—=†*†*†,†/†/‡$—6†"†"†7†7†"†"†7†7‡&—"†7‡$—"†
7†7‡%—"†7†7†"†7†"†-‡$—+‡)—=†*†*†/†/†"†7†6†"†"†7†6‡)—"†7‡$—"†7†"†"†7†7†"†7†"†7†
7†"†7†7†/†-†+†+†5‡'—=†*†,†,†/†/†6†6†"†7†"†"†7‡'—"†1†/†1†/†1†/†"†7‡$—"†7‡%—"‡$—
7†1†-‡$—+‡'—=†*†*†.†/†-†6‡$—"†9‡)—"‡%—1†/†/†"†"†7‡&—"‡'—7†/†-†*†*‡'—=†*†.†/†/†
7‡.—"‡&—1†/‡+—"†7†7†"†7†/†-†*†*‡'—=†;†/†1†1†"†6†9†9‡+—"‡&—1†/†#‡*—"†7†"†7†7†/†
/†+†+‡'—=†,†.†/†1†6†6‡-—"†5†5†1†5‡$—1†&‡)—"‡%—7†1†/†+†*†/‡&—=†;†.†1†5†"†9‡.—"†
2†5†5‡%—1†/‡)—"†7†"†6†1†-†+†+†%‡&—=†.†.†1†1†9‡/—"†<‡$—2†5‡%—1‡)—"†7†7†1†/†+†*†
*‡&—=†/†.†1†5‡1—"‡%—2†5†5†1†1†/‡&—"†7†"†"†7†1†/†-†*†*‡&—=†.†0†1†5‡&—"†$‡$—"†$†
$‡%—"†$†$†+‡$—2†5‡$—1†/‡(—"†7†1†/†+†*†5‡&—=†.†1•†5‡'—"†$‡*—%†"†"†%†<†2†2†5‡$—1
‡)—"†1†/†/†*‡'—=†.†1†1†5†%†"†"†$‡'—%‡$—"‡$—%†$†%†"†%†2†2‡$—5†1†/‡(—"†/†/†*†*‡'
—=†.†1•†5†2†"†"‡%—%†5†1‡%—5‡%—%†"†%†"†:†2†2†5†5†1†1†$‡%—"†6†"†/†/†,†*‡'—=†2†1†
5†5†2†$†$‡%—%‡'—2‡(—%†:†2†2‡$—5†1‡'—"†5†/†/†+†*‡(—=†0†5†5†2‡'—%†"†:†:‡$—2†+‡'—
%†3†2†2‡$—5†1‡'—"†1†/†/†*‡)—=†/•†5†2†:‡%—%†&†%†2‡$—<†2†2‡&—%†$‡%—2†5†5†1‡&—"†/
†1†/†-†*‡*—=†1†5†2†:†&†%†%†&†&†+†5‡$—<†3†2†2†"†$†$†+‡&—2†5†5‡$—"†$†"†"†5†1†.†*
†%‡*—=†.•†5†2†<‡$—%†'†+†+‡%—<†:‡+—2†5†5‡&—"†5†5†/†/†*‡,—=†1†5†2†:†<†%†'‡$—+†%‡
&—<†2†:†2†4‡%—2†5†5†"†$‡$—"†%†5†1†/†.†0‡,—=†1†5†2†2†<†2†&‡%—+†%‡'—<†:†2†4‡$—2†
5†"†$†"‡$—$†5†5†/†.†*‡.—=†0†5†2†2†<†<†*‡&—+‡&—<†:†:‡%—2†%†$†"†$†"†"†5†5†1†.†,‡
0—=†5†5†2†2†<†<†(‡&—+†%†2†:‡%—2†/‡&—%†"†1†5†5†1†/†,‡2—=†5†2†2†:†<†<†-‡'—+†(‡)—
%†"†"‡$—5†1†/†;†:‡3—=†5‡$—2‡$—<†+†'†*†'†%†&‡(—%†$†2‡$—5†1†1†.†2‡5—=•‡$—2†:‡%—<
†+†+†(‡&—%‡$—2‡$—5†1†1†;‡8—=†1†5‡$—2†:†:‡%—<†:†:‡%—2‡&—5†1†.‡;—=†5†5‡-—2‡$—5†1
†1†.‡?—=•†5†5‡&—2‡&—5†1†0†.‡D—=†1†1•‡%—5†1†0†.‡d—=‰'—ÿ••‰+—ÿÀ†$‰&—ÿþ••† ÿ••ÿø•
•†@ÿ••ÿ𕕆0ÿ••ÿÀ••†$ÿ••ÿ†¡••†"ÿ••ÿ‡%—•ÿ†£†@ÿ‡%—•† †-†"þ‡%—•† ndü‡%—•?••ü‡%—•†
@••ø‡%—•†@••ð‡%—•†0••ð‡%—•†0••ð‡%—•†(••à‡%—•†(†¡Dà‡%—•†(••à‡%—•†(••à‡%—•†(••à‡
%—•†$••à‡%—•†$••à‡%—•†$••à‡%—•†$••à‡%—•†$••à‡%—•†(••à‡%—•†(••à‡%—•†(••à‡%—•†(•
•ð‡%—•†0••ð‡%—•†0••ø‡%—•†0••ø‡%—•†@••ü‡%—•†@••ü‡%—•?••þ‡%—•† ••ÿ‡%—•ÿ••ÿ†¡‡$—•
ÿ••ÿÀ••†"ÿ••ÿà••†(ÿ••ÿ𕕆0ÿ••ÿü••?ÿ••ÿÿ••ÿÿ••ÿÿà†(ÿÿ••‰'—ÿ
) ; HelpIcon.ico: 3662 / 2825

return var1
}

PixelImage(){
var1 =
( Join %,`
Ÿœ1L—GIF89a†"•†"•†¡••†-f±‡$—•!ù†%‡&—•,‡%—•†"•†"••†#†#D†"•;
) ; pixel.gif: 43 / 59

return var1
}
;###################### Write Files ########################


CreateBinaryFile(_encodedData, _filename, _decodeMethod="")
{
        local fh, len, data

        _filename = %A_WorkingDir%\%_filename%

        len := Pebwa2Bin(data, _encodedData)

        If (len < 0)
                Return len
        fh := OpenFileForWrite(_filename)
        WriteInFile(fh, data, len)   ; Give size because data var is larger than given bytes
        CloseFile(fh)

        Return len
}

OpenFileForWrite(_filename)
{
        local handle

        handle := DllCall("CreateFile"
                        , "Str", _filename              ; lpFileName
                        , "UInt", 0x40000000    ; dwDesiredAccess (GENERIC_WRITE)
                        , "UInt", 3             ; dwShareMode (FILE_SHARE_READ|FILE_SHARE_WRITE)
                        , "UInt", 0             ; lpSecurityAttributes
                        , "UInt", 4             ; dwCreationDisposition (OPEN_ALWAYS: create if not exists)
                        , "UInt", 0             ; dwFlagsAndAttributes
                        , "UInt", 0)    ; hTemplateFile
        If (handle = INVALID_HANDLE_VALUE or handle = 0)
        {
                ErrorLevel = -1
        }
        IfNotEqual ErrorLevel, 0, Return INVALID_HANDLE_VALUE   ; Couldn't open the file
        Return handle
}

WriteInFile(_handle, ByRef @data, _byteNb=0, _moveMethod=-1, _offset=0)
{
        local dataSize, result, written

        _offset := MoveInFile(_handle, _moveMethod, _offset)
        IfNotEqual ErrorLevel, 0, Return -1     ; Couldn't make the move

        dataSize := VarSetCapacity(@data)        ; Get the capacity (>= used length!)
        If (_byteNb < 1 or _byteNb > dataSize)
        {
                byteNb := dataSize
        }
        result := DllCall("WriteFile"
                        , "UInt", _handle       ; hFile
                        , "Str", @data          ; lpBuffer
                        , "UInt", _byteNb       ; nNumberOfBytesToWrite
                        , "UInt *", written     ; lpNumberOfBytesWritten
                        , "UInt", 0)            ; lpOverlapped
        if (result = 0 or written < _byteNb)
        {
                ErrorLevel = -2
        }
        IfNotEqual ErrorLevel, 0, Return -1     ; Couldn't write in the file
        Return written
}

MoveInFile(_handle, _moveMethod=-1, _offset=0)
{
        local result

        result = %INVALID_FILE_SIZE%
        if (_moveMethod != -1)
        {
                result := DllCall("SetFilePointer"
                                , "UInt", _handle               ; hFile
                                , "Int", _offset                ; lDistanceToMove
                                , "UInt", 0                     ; lpDistanceToMoveHigh
                                , "UInt", _moveMethod)  ; dwMoveMethod
                if (result = -1)        ; INVALID_SET_FILE_POINTER
                {
                        ErrorLevel = -1
                }
                IfNotEqual ErrorLevel, 0, Return -1     ; Couldn't make the move
        }
        Return result
}

CloseFile(_handle)
{
        local result

        result := DllCall("CloseHandle"
                        , "UInt", _handle)
        If (result = 0)
        {
                ErrorLevel = -1
        }
}

DecodeQuantity(_quantity)
{
        local byte, quantity

        PEBWA_QTY_BASE = 188
        PEBWA_MAX_LOWER_QTY = 93
        PEBWA_LOW_QTY_OFFSET = 33
        PEBWA_HIGH_QTY_OFFSET = 67

        quantity := 0
        Loop Parse, _quantity
        {
                ; Decode 189-based digit
                byte := Asc(A_LoopField)
;~ OutputDebug b: %byte% (%A_LoopField%)
                If (byte <= PEBWA_MAX_LOWER_QTY + PEBWA_LOW_QTY_OFFSET)
                {
                        byte -= PEBWA_LOW_QTY_OFFSET
                }
                Else
                {
                        byte -= PEBWA_HIGH_QTY_OFFSET
                }
                quantity := quantity * PEBWA_QTY_BASE + byte
;~ OutputDebug b: %byte%, q: %quantity%
        }
        Return quantity
}

Pebwa2Bin(ByRef @bin, _pebwa)
{
        local byte, b1, dataSize, binaryDataSize, granted
        local encodedAddress, binaryAddress, ri, wi

        encodedAddress := &_pebwa
        ; Is it starting by the signature?
        Gosub Pebwa2Bin_GetNextEncodedChar
        b1 := byte
        Gosub Pebwa2Bin_GetNextEncodedChar
        If (b1 != 159 || byte != 156)
        {
                ErrorLevel := "Bad Data Format"
                Return -1
        }
        Gosub Pebwa2Bin_GetNextEncodedChar ; Eat the version id, unused now
        ; Get size of data
        Gosub Pebwa2Bin_ReadQuantity
        binaryDataSize := dataSize
        ; Make enough room
        granted := VarSetCapacity(@bin, binaryDataSize, 0)
        if (granted < binaryDataSize)
        {
                ; Cannot allocate enough memory
                ErrorLevel := "Not Enough Memory (" . granted . "/" . binaryDataSize . ")"
                Return -1
        }
        binaryAddress := &@bin
        wi = 0
;~ MsgBox %binaryDataSize% %granted% %binaryAddress% %encodedAddress%

        Loop
        {
                Gosub Pebwa2Bin_GetNextEncodedChar
                If (byte = 0)
                        Break   ; End!
                If byte in 145,146,149
                {
                        Gosub Pebwa2Bin_DecodeControlChar
                        Gosub Pebwa2Bin_WriteNextByte
                }
                Else If (byte = 134)
                {
                        ; One encoded control char
                        Gosub Pebwa2Bin_GetNextEncodedChar
                        Gosub Pebwa2Bin_DecodeControlChar
                        Gosub Pebwa2Bin_WriteNextByte
                }
                Else If byte in 135,137
                {
                        b1 := byte
                        ; A run of encoded chars
                        Gosub Pebwa2Bin_ReadQuantity
                        Gosub Pebwa2Bin_GetNextEncodedChar
                        If (b1 = 135)
                        {
                                ; Need to decode the control char
                                Gosub Pebwa2Bin_DecodeControlChar
                        }
                        ; Write bytes
                        Loop %dataSize%
                        {
                                Gosub Pebwa2Bin_WriteNextByte
                        }
                }
                Else
                {
                        Gosub Pebwa2Bin_WriteNextByte   ; Plain char
                }
        }
;~      MsgBox % DumpDWORDs(@bin, binaryDataSize)

        Return binaryDataSize


Pebwa2Bin_ReadQuantity:
        ; Read quantity
        quantity := ""
        Loop
        {
                Gosub Pebwa2Bin_GetNextEncodedChar
                If (byte = 151)
                        Break
                quantity := quantity . Chr(byte)
        }
        dataSize := DecodeQuantity(quantity)
Return

Pebwa2Bin_DecodeControlChar:
        If byte in 145,146,149
        {
                byte := SPECIAL_CONTROL_CHAR%byte%
        }
        Else
        {
                byte -= 33      ; Other control char
        }
Return

Pebwa2Bin_GetNextEncodedChar:
        byte := *encodedAddress
;~ OutputDebug % "R => " ri ": Byte: " byte " (" Chr(byte) ")"
;~ ri++
        encodedAddress++
Return

Pebwa2Bin_WriteNextByte:
        DllCall("RtlFillMemory"
                        , "UInt", binaryAddress
                        , "UInt", 1
                        , "UChar", byte)
;~ OutputDebug % "W => " wi ": Byte: " byte " (" Chr(byte) ")"
;~ wi++
        binaryAddress++
Return
}

;######## Misc ###########

;don't allow compiled scripts
IsCompiled() {
If A_IsCompiled {
 msg =
 (LTrim Join`s
 Sorry, but it is not possible to run this script correctly if it
 is compiled. The program will exit.
 )
 Msgbox(msg, "IconX w250 bold -Owner",version)
 ExitApp
 }
}

CheckAHKVersion(req) {
If (A_AhkVersion < req) {
 msg =
 (LTrim Join`s
 This script needs AutoHotkey version %req% or newer
 to run correctly (you are using version %A_AhkVersion%).
 `nGo to web page to download new version now?
 )
 If (Msgbox(msg, "ButtonsYes|No IconI c8B0000 Default1 bold s10 w320 -Owner", version) = "Yes")
  Run, % Web() "http://www.autohotkey.com/download/"
 ExitApp
 }
}

IniRead(file,section,key,def="") {
IniRead, var, %file%, %section%, %key%, %def%
If var = ERROR
 ErrorLevel = 1
return var
}

TrimWhiteSpace(str) {
Loop {
        StringLeft, isSpace, str, 1
        If isSpace is not space
                break
        If ( isSpace = "" )
        return
        StringTrimLeft, str, str, 1
 }
Loop {
        StringRight, isSpace, str, 1
        If isSpace is not space
                break
        If ( isSpace = "" )
        return
        StringTrimRight, str, str, 1
 }
return str
}

StrMid(str,str1,str2,startPos1=1,startPos2=1,caseSense=0) {
If startPos1 =
 startPos1 = 1
If startPos2 =
 startPos2 = 1
StringTrimLeft,o,str,InStr(str,str1,cS,startPos1) + StrLen(str1) - 1
StringLeft,o,o,InStr(o,str2,caseSense,startPos2)-1
return o
}

;##### Msgbox #####
Msgbox(message="",Options="",Title="",FontName="",GuiNumber=66) 
{

        global MessageBoxIcon,MessageBoxText,MessageBoxButton1,MessageBoxButton2,MessageBoxButton3,MessageBoxButtonName1,MessageBoxButtonName2,MessageBoxCheckbox

        Gui, %GuiNumber%:Default
        Gui, Destroy
        autotrim = %a_autotrim%   ;store it so we can reset it later
        AutoTrim Off   ;necessary because of the "Options" param
        Options = %a_space%%Options%%a_space%   ;leading and trailing spaces (for StrEnd())
        If message = 
                message = Press okay to continue.   ;this is the default for the normal Msgbox command also

        ;the "Buttons" option can be numeric (1-3) or a string seperated by pipes (|).
        ;the default is "Okay"
        If (InStr(Options, "Buttons") = 0 || InStr(Options, "Buttons1"))
                buttons = Okay
        else IfInString, Options, Buttons2
                buttons = Okay|Cancel
        else IfInString, Options, Buttons3
                buttons = Yes|No|Cancel
        else
                buttons := StrEnd(Options,"buttons")

        ;If Owner is unspecified, use A_Gui (if non-blank)
        ;else, use Gui#1 as owner (unless -Owner" is present in Options)
        ;in any case, we check if the owner exists before using it
        If ! InStr(Options, "-Owner") 
        {
                owner := StrEnd(Options,"owner")
                If ! owner  
                {
                        If a_gui
                                owner = %a_gui%
                        else
                                owner = 1
                }
                Gui, %owner%: +LastfoundExist

                If WinExist() 
                {
                        ;unless specified otherwise, disable the owner.
                        ;note that this causes that neat flickering when
                        ;the user tries to interact with the owner
                        IfNotInString, Options, -Modal
                                Gui, %owner%: +Disabled
                        Gui, +Owner%owner%
                        WinGetPos, x, y, w, h   ;get the position of the owner
                }
                else
                        owner =
        }

        IfNotInString, Options, -Toolwindow
                Gui, +Toolwindow
        IfInString, Options, +AlwaysOnTop
                Gui, +AlwaysOnTop
        IfInString, Options, -Caption
                Gui, -Caption
        IfInString, Options, +0x800000
                Gui, +0x800000
        Gui, +lastfound -SysMenu
        GuiID := WinExist()   ;used later in the Hotkey command

        ;get BackgroundColor and TextColor, as well as bold/italic
        BgColor := StrEnd(Options, "Background")
        color := StrEnd(Options, "c")
        IfInString, Options, %a_space%bold%a_space%
                bold = bold
        IfInString, Options, %a_space%italic%a_space%
                italic = italic
        size := StrEnd(Options, "s")

        ;change these default values to whatever you  prefer
        If FontName =
                FontName = Comic Sans MS
        If BgColor =
                BgColor = FFFACD
        If color =
                color = black
        If size =
                size = 8

        Gui, Color, %BgColor%
        Gui, Font, s%size% %bold% %italic% c%color%, %fontName%
        Gui, Margin, 5, 5

        icon := StrEnd(Options, "Icon")
        ;the corresponding icon #'s
        If Icon = !
                i = 2
        else if icon = ?
                i = 3
        else if icon = x
                i = 4
        else if icon = i
                i = 5

        ;it gets a bit ugly now because of the sectioning with/without the icon...
        If icon 
        {
                Gui, Add, Picture, vMessageBoxIcon Section Icon%i%, User32.dll
                ys = ys
                xs = xs
        }

        width := StrEnd(Options, "w")
        Gui, Add, Text, vMessageBoxText %ys% w%width%, %message%

        Gui, Font, norm   ;I think buttons with bold font are ugly ;)

        button_h := StrEnd(Options, "h")   ;just in case anyone wants to specify the button height...
        If button_h =
                button_h = 20
        If button_h not integer
                button_h = 20

        ;add the buttons:
        Loop, Parse, buttons, |
        {
                StringReplace, b, a_loopfield, _, %a_space%,1
                numButtons++   ;for the subroutine that positions the buttons
                If a_index = 1
                        Gui, Add, Button, vMessageBoxButton%a_index% Section h%button_h% %xs% gMessageBox_MessageBoxButtonPushed, %b%
                else
                        Gui, Add, Button, vMessageBoxButton%a_index% ys h%button_h% gMessageBox_MessageBoxButtonPushed, %b%
        }

        checkboxText := StrEnd(Options,"Checkbox")
        StringReplace, checkboxText, checkboxText, _, %a_space%,1
        If checkboxText <>
                Gui, Add, Checkbox, vMessageBoxCheckbox %xs%, %checkboxText%

        default_button := StrEnd(Options, "Default")

        ;if default_button is unspecified, use the last button
        If default_button =
                default_button = %numButtons%

        ;to have NO default button, specify Default0
        If default_button <> 0
                GuiControl, +Default, MessageBoxButton%default_button%
        GuiControl,  Focus, MessageBoxButton%default_button%

        ;this works for the real Msgbox, so we need it too :)
        Hotkey, IfWinActive, ahk_id%GuiID%
        Hotkey, ^c, MessageBox_CopyMessageBoxTextToClipboard

        Gui, Show, Autosize Hide, %title%
        Gosub, MessageBox_MoveMessageBoxButtons   ;move the buttons

        ;if we have no owner, just show the Gui in the middle of the screen
        ;else, position is in the middle of its owner
        If owner 
        {
                Gui, +Lastfound
                WinGetPos,,,msg_w,msg_h
                msg_x := x + w/2 - msg_w/2
                msg_y := y + h/2 - msg_h/2
                Gui, Show, x%msg_x% y%msg_y%, %title%
        } 
        else
                Gui, Show,, %title%

        ;this thread can't be critical (otherwise the MessageBox_ButtonPushed thread
        ;would be buffered endlessly...)
        Critical Off
        WinWaitClose      ;wait until the user clicks one of the buttons

        ;turn off the hotkey and reset autotrim
        Hotkey, ^c, MessageBox_CopyMessageBoxTextToClipboard, Off
        Autotrim %autotrim%
        If MessageBoxCheckbox = 1
                ErrorLevel = 1
        else
                ErrorLevel = 0
        If owner
                Gui %owner%:Default
        else
                Gui, 1:Default
        
        return return_value   ;return the return value set by the ButtonPushed thread

        MessageBox_MessageBoxButtonPushed:
                ;if we've been asked to redraw:
                StringRight, num, a_guicontrol, 1   ;the button #
                GuiControlGet, return_value,,%a_guicontrol%
                StringReplace, return_value, return_value, & ;get rid of the ampersand

                If owner
                        Gui, %owner%: -Disabled
                Gui, Submit
                Gui, Destroy
                return

        ;the hotkey thread
        MessageBox_CopyMessageBoxTextToClipboard:
                clipboard = %message%
                return

        ;center the buttons:
        MessageBox_MoveMessageBoxButtons:
                Gui %GuiNumber%:Default
                WinGetPos,,,gw
                gw -= 6
                GuiControlGet, txt, Pos, MessageBoxText
                
                If ! icon
                        GuiControl, Move, MessageBoxText, % "x" gw/2 - txtW/2

                Loop 3
                        GuiControlGet, p%a_index%, Pos, MessageBoxButton%a_index%

                If numButtons = 1
                        GuiControl, Move, MessageBoxButton1, % "x" gw/2 - p1w/2
                else if (numButtons = 2)  
                {
                        GuiControl, Move, MessageBoxButton1, % "x" gw/2 - ((p1w + p2w + 5)/2)
                        GuiControl, Move, MessageBoxButton2, % "x" gw/2 - ((p1w + p2w + 5)/2) + p1w + 5
                } 
                else if (numButtons = 3) 
                {
                        GuiControl, Move, MessageBoxButton1, % "x" gw/2 - ((p1w + p2w + p3w + 10)/2)
                        GuiControl, Move, MessageBoxButton2, % "x" gw/2 - ((p1w + p2w + p3w + 10)/2) + p1w + 5
                        GuiControl, Move, MessageBoxButton3, % "x" gw/2 - ((p1w + p2w + p3w + 10)/2) + p1w + p2w + 10
                } 
                return
}

SelectFolder()
{
        defaultFolder = C:\Program Files

        IfNotExist, C:\
                defaultFolder = 
        else
                defaultFolder = C:\ *C:\Program Files

        FileSelectFolder, installFolder, , 1, Select the folder where you would like to install DeMonster:

        return installFolder    
}

Web() 
{
        RegRead, htmlOpenPath, HKCR, htmlfile\shell\open\command
        Return, %htmlOpenPath%
}

StrEnd(O,str) 
{
        IfNotInString, O, %a_space%%str%
                return
        StringMid, e, O, InStr(O, " " str) + StrLen(str) + 1, InStr(O, a_space, "", InStr(O, " " str) + 1) - InStr(O, " " str) - StrLen(str) - 1

        return e
}

;++##\\Installation - end
;++##\\MainScript
;------------------------------------------------------------------------------------------------
;       DeMonster :: DeMonster.ahk (Main)
;------------------------------------------------------------------------------------------------
;       Date: 2006-09-22
;------------------------------------------------------------------------------------------------
;       Author(s): APerfect10
;------------------------------------------------------------------------------------------------
;       See web page for more details.
;
;       http://overcards.com/wiki/moin.cgi/DeMonster
;
;       All rights reserved. Use at your own risk.
;------------------------------------------------------------------------------------------------
;________________________________________________________________________________________________
;
;       DO NOT EDIT THIS SCRIPT!
;________________________________________________________________________________________________

#NoEnv
#SingleInstance Force
#Persistent

setWorkingDir %A_ScriptDir%

;--==Comment==--#Include Includes/include.Common.ahk

LoadSettings()

v := GetVersion()
version = DeMonster v%v%
Menu, Tray, Tip, %version%

Menu()

SetTimer, DM_NewWindow_Label, 50
SetTimer, DM_NoSpamProcess_Label, 500
SetTimer, DM_MonsterProcess_Label, 5000

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Hotkeys  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Hotkey, %dm_hotkey_sitout%, DM_Sitout_Label, UseErrorLevel 
Hotkey, %dm_hotkey_return%, DM_Return_Label, UseErrorLevel
Hotkey, %dm_hotkey_closeParty%, DM_CloseParty_Label, UseErrorLevel
Hotkey, %dm_hotkey_ReloadAll%, DM_ReloadAll_Label, UseErrorLevel 
Hotkey, %dm_hotkey_ReloadActive%, DM_ReloadActive_Label, UseErrorLevel 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Modules   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;--==Comment==--#Include Modules/module.DeMonster.ahk
;--==Comment==--#Include Modules/module.NoSpam.ahk

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Global Variables   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

WinCnt = 0 ; Window Count
MonCnt = 0 ; Monster Count
paused = 0
SitOutNow = 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   labels   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DM_NewWindow_Label:
        DM_NewWindowProcess()
        return

DM_ReloadAll_Label:
        SetTimer, DM_NewWindow_Label, Off
        DM_ReloadAll()
        SetTimer, DM_NewWindow_Label, On
        return

DM_ReloadActive_Label:
        DM_ReloadActiveTable()
        return

DM_SitoutNow_Label:
        Lib_DM_Sitout_Party(0)
        Goto DM_SitOut_Common_Label

DM_SitoutLater_Label:
        Lib_DM_Sitout_Party(1)
        Goto DM_SitOut_Common_Label

DM_Sitout_Label:
        Lib_DM_Sitout_Party(dm_play_until_blinds)
        Goto DM_SitOut_Common_Label

DM_SitOut_Common_Label:

        SitOutNow = 1
        Menu()
        return

DM_Return_Label:
        Lib_DM_Return_Party()

        SitOutNow = 0
        Menu()
        return

DM_CloseParty_Label:
        DM_CloseParty()
        return

DM_Settings_Label:
        DM_Settings()
        return

DM_About_Label:
        SetTitleMatchMode, 2
        IfWinExist, About DeMonster ahk_class AutoHotkeyGUI
                WinActivate, About DeMonster ahk_class AutoHotkeyGUI
        else
                Run, About.ahk
        return

DM_Reload_Label:        
        Reload
        return

DM_PauseToggle_Label:
        If( paused ){
                Pause, Off
                paused = 0
                Menu()
        }else{
                paused = 1
                Menu()
                Pause, On
        }       

        return


DM_VersionCheck_Label:
        Run, "http://overcards.com/wiki/moin.cgi/DeMonster",,UseErrorLevel
        return

DM_ExitScript_Label:
        DetectHiddenWindows, On
        SetTitleMatchMode, 2
        IfWinExist, About DeMonster ahk_class AutoHotkeyGUI
                WinClose, About DeMonster ahk_class AutoHotkeyGUI
        IfWinExist, DeMonster Settings ahk_class AutoHotkeyGUI
                WinClose, DeMonster Settings ahk_class AutoHotkeyGUI
        DetectHiddenWindows, Off
        ExitApp
                
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   Main Functions   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Menu()
{
        Global paused, SitOutNow

        Menu, Tray, NoStandard
        Menu, Tray, DeleteAll
        Menu, Tray, Add, &About DeMonster, DM_About_Label
        Menu, Tray, Add, Check for &Updates, DM_VersionCheck_Label
        Menu, Tray, Add
        Menu, Tray, Add, Reload Script, DM_Reload_Label 

        If( paused )
                Menu, Tray, Add, &Resume Script, DM_PauseToggle_Label
        else
                Menu, Tray, Add, &Pause Script, DM_PauseToggle_Label

        Menu, Tray, Add
        If( SitOutNow )
                Menu, Tray, Add, Return, DM_Return_Label
        else
        {
                Menu, sitoutSubmenu, add, Sit Out Now, DM_SitoutNow_Label
                Menu, sitoutSubmenu, add, Play until blinds, DM_SitoutLater_Label
                Menu, tray, add, Sit Out, :sitoutSubmenu
        }

        Menu, Tray, Add
        Menu, Tray, Add, &Settings, DM_Settings_Label
        Menu, Tray, Add
        Menu, Tray, Add, E&xit, DM_ExitScript_Label
}

DM_NewWindowProcess()
{
        Global dm_pin_jackpot, dm_hide_jackpot

        If( Lib_DM_NewWindow() )
                DM_NewSpamProcess()

        If( Lib_DM_NewMonsterTable() )
        {
                If(dm_pin_jackpot || dm_hide_jackpot)
                        DM_NewMonsterProcess()
        }
        
}

DM_NewSpamProcess()
{
        Global dm_no_spam, dm_auto_close_popup

        If( (!dm_no_spam) && (dm_auto_close_popup) )
        {
                WinGet, idList, List, Message from PartyPoker.com ahk_class #32770
                Loop, %idList%
                {
                        winID := idList%A_Index%
                        If( Lib_DM_IsVisCtrl("Internet Explorer_Server1", winID) )
                                WinClose, ahk_id%winID%
                }
        }

        Loop
        {
                If( !DM_NoSpamProcess() )
                        return
        }

}

DM_NewMonsterProcess()
{
        Loop
        {
                If( !DM_MonsterProcess() )
                        return
        }
}

DM_CloseParty()
{
        Global dm_closeParty, dm_leaveTable_control

        WinGet, list, list, Good Luck ahk_class #32770,,PartyPoker.com: Poker Lobby ahk_class #32770
        Loop, %list%
        {
                winID := list%A_Index%
                Lib_DM_ClickControl(winID, dm_leaveTable_control)
        
                IfWinExist, ahk_class #32770, want to stand-up and leave
                {
                        WinGet, wID, ID, ahk_class #32770, want to stand-up and leave
                        ControlSend, Button1, {ENTER}, ahk_id%wID%
                }

                IfWinExist, ahk_class #32770, fold and leave the table
                {
                        WinGet, wID, ID, ahk_class #32770, fold and leave the table
                        ControlSend, Button1, {ENTER}, ahk_id%wID%
                }
        }

        If( dm_closeParty ){
                LobbyID := Lib_DM_Get_LobbyID()
                WinClose, ahk_id%LobbyID%
        }
}

DM_Settings()
{
        DetectHiddenWindows, On
        SetTitleMatchMode, 2
        IfWinExist, DeMonster Settings ahk_class AutoHotkeyGUI
        {
                WinShow, DeMonster Settings ahk_class AutoHotkeyGUI
                WinActivate, DeMonster Settings ahk_class AutoHotkeyGUI
        }
        else    
                Run, Settings.ahk,,1

        DetectHiddenWindows, Off
        return
}

DM_ReloadAll()
{
        SetKeyDelay, 150

        DM_ReloadParty()



        SoundBeep, , 50
}

DM_ReloadParty()
{       
        SetTitleMatchMode, 2
        WinGet, idList, list, Good Luck ahk_class #32770,  , PartyPoker.com:
        Loop, %idList%
        {
                winID := idList%a_index%
                DM_ReloadPartyTable(winID)
        }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  library (poker)    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Lib_DM_Get_LobbyID()
{
        SetTitleMatchMode, 2
        WinGet, winID, ID, PartyPoker.com: Poker Lobby - Good Luck ahk_class #32770
        return winID
}

DM_ReloadActiveTable()
{
        Global dm_ActivateMouseOver
        
        If( dm_ActivateMouseOver )
                MouseGetPos, x, y, winID
        else
                WinGet, winID, ID, A

        WinGetClass, class, ahk_id %winID%
        if (class = "#32770")
                DM_ReloadPartyTable(winID)



        SoundBeep,,50
}

DM_ReloadPartyTable(winID)
{       
        SetTitleMatchMode, 2

        ControlGet, result, Visible, , Button5, ahk_id %winID%
        if ( !result )
                return

        ControlClick, AfxWnd421, ahk_id%winID%  

        Winwait, Buy-In ahk_class #32770,,0
        If(!ErrorLevel)
        {
                BuyIn()

                If( DM_PartyErrors() )
                        WinClose, ahk_id%buyID%
        }

        DM_PartySpam()

        return
}

DM_PartyErrors()
{
        IfWinExist, PartyPoker.com ahk_class #32770, Please enter an amount
        {
                WinClose
                return true
        }

        IfWinExist, PartyPoker.com ahk_class #32770, You can bring a maximum
        {       
                WinClose
                return true
        }
        
        IfWinExist, PartyPoker.com ahk_class #32770, You do not have sufficient funds
        {
                WinClose
                return true
        }

        return false
}

DM_PartySpam()
{
        IfWinExist, PartyPoker.com ahk_class #32770, You can have maximum       
        {       
                WinClose
                return  
        }

        IfWinExist, PartyPoker.com, Additional chips
        {
                WinClose
                return
        }

        return
}

Lib_DM_Sitout_Party(play_until_blinds)
{
        SetTitleMatchMode, 2
        WinGet, tables, List, Good Luck ahk_class #32770,Auto Post Blind,Lobby
        Loop, %tables%
        {
                winID := tables%a_index%
                If(Lib_DM_IsVisCtrl("Button5", winID))
                {
                        If( play_until_blinds ){
                                Control, Uncheck, , Button3, ahk_id %winID%
                        }
                        else{
                                Control, Check, , Button5, ahk_id %winID%
                        }
                }
        }
}

Lib_DM_Return_Party()
{
        SetTitleMatchMode, 2
        WinGet, tables, List, Good Luck ahk_class #32770,Auto Post Blind,Lobby
        Loop, %tables%
        {
                winID := tables%a_index%
                If(Lib_DM_IsVisCtrl("Button5", winID))
                {
                        Control, Uncheck, , Button5, ahk_id %winID%
                }
        }
}



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  library (general)  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Lib_DM_NewWindow()
{
        global WinCnt

        SetTitleMatchMode, 2

        WinGet, wCnt, Count,ahk_class #32770,,Monster #,Taking you to

        if(wCnt <> WinCnt){
                WinCnt := wCnt
                return %WinCnt%
        }

        WinCnt := wCnt
        return false
}
        
Lib_DM_NewMonsterTable()
{
        global MonCnt

        SetTitleMatchMode, 2
        WinGet, mCnt, Count, Monster # ahk_class #32770

        if(mCnt > MonCnt)
        {       
                MonCnt := mCnt
                return %MonCnt%
        }

        MonCnt := mCnt
        return false
}

Lib_DM_ClickControl(winID, buttonName)
{       
        Control, Enable, , %buttonName%, ahk_id%winID%
        Control, Check, , %buttonName%, ahk_id%winID%

        return (ErrorLevel)
}

Lib_DM_IsVisCtrl(ctrl, win, matchMode=1) 
{
        mm = %a_titleMatchMode%
        SetTitleMatchMode %matchMode%
        ControlGet, vis, Visible,, %ctrl%, ahk_id%win%
        SetTitleMatchMode %mm%
        return vis
}

Lib_DM_IsChecked(winID, ctrl)
{
        ControlGet, val, Checked, , %ctrl%, ahk_id%winID%
        return val
}

;++##\\MainScript - end
;++##\\Settings
;------------------------------------------------------------------------------------------------
;       DeMonster :: Settings
;------------------------------------------------------------------------------------------------
;       Date: 2006-09-22
;------------------------------------------------------------------------------------------------
;       Author(s): APerfect10
;------------------------------------------------------------------------------------------------
;________________________________________________________________________________________________
;
;       DO NOT EDIT THIS FILE
;________________________________________________________________________________________________

#NoEnv
#SingleInstance Ignore
#Persistent
#NoTrayIcon
;--==Comment==--#Include Includes/include.Common.ahk

hlp = DeMonsterHelp.txt

BuiltNoSpam = 0
BuiltHotkeys = 0

Process_Label:
        Process()
        return

Process()
{
        LoadSettings()
        SettingsGUI()
}

SaveSettings()
{
        Global 

        ; Monster Settings
        IniWrite, %dm_auto_close_popup%, %ini%, Monster, dm_auto_close_popup
        IniWrite, %dm_pin_jackpot%, %ini%, Monster, dm_pin_jackpot
        IniWrite, %dm_hide_jackpot%, %ini%, Monster, dm_hide_jackpot
        IniWrite, %dm_hide_lobby_jackpot%, %ini%, Monster, dm_hide_lobby_jackpot
        IniWrite, %dm_minimize_lobby_news%, %ini%, Monster, dm_minimize_lobby_news
        
        ; No Spam Settings
        IniWrite, %dm_auto_join_waiting_list%, %ini%, NoSpam, dm_auto_join_waiting_list
        IniWrite, %dm_auto_join_first_available%, %ini%, NoSpam, dm_auto_join_first_available
        IniWrite, %dm_auto_buyin%, %ini%, NoSpam, dm_auto_buyin
        IniWrite, %dm_buyin_amount%, %ini%, NoSpam, dm_buyin_amount
        IniWrite, %dm_auto_leave_table%, %ini%, NoSpam, dm_auto_leave_table
        IniWrite, %dm_auto_post_bb%, %ini%, NoSpam, dm_auto_post_bb
        IniWrite, %dm_Wait_for_bb%, %ini%, NoSpam, dm_Wait_for_bb
        IniWrite, %dm_auto_login%, %ini%, NoSpam, dm_auto_login
        IniWrite, %dm_no_spam%, %ini%, NoSpam, dm_no_spam
        IniWrite, %dm_auto_handhistory%, %ini%, NoSpam, dm_auto_handhistory
        IniWrite, %dm_default_chat%, %ini%, NoSpam, dm_default_chat

        ; Hotkeys :: Sitout & Return
        IniWrite, %dm_hotkey_sitout%, %ini%, Hotkeys, dm_hotkey_sitout
        IniWrite, %dm_play_until_blinds%, %ini%, Hotkeys, dm_play_until_blinds
        IniWrite, %dm_hotkey_return%, %ini%, Hotkeys, dm_hotkey_return
        IniWrite, %dm_hotkey_LeaveTables%, %ini%, Hotkeys, dm_hotkey_LeaveTables
        IniWrite, %dm_closeParty%, %ini%, Hotkeys, dm_CloseParty

        ; Hotkeys :: Stack Reloader
        IniWrite, %dm_hotkey_ReloadAll%, %ini%, Hotkeys, dm_hotkey_ReloadAll
        IniWrite, %dm_hotkey_ReloadActive%, %ini%, Hotkeys, dm_hotkey_ReloadActive
        IniWrite, %dm_ActivateMouseOver%, %ini%, Hotkeys, dm_ActivateMouseOver
        
                

}
        
SettingsGUI()
{
        Global

        Menu, FileMenu, Add, &Save, SaveMenu
        Menu, FileMenu, Add, E&xit, SettingsGuiClose
        Menu, MyMenuBar, Add, &File, :FileMenu
        Menu, HelpMenu, Add, &About, AboutMenu
        Menu, MyMenuBar, Add, &Help, :HelpMenu
        Gui, Menu, MyMenuBar

        Gui, Font, bold s14 Comic Sans MS
        Gui, Add, Text, x16 y8 w460 h30 +Center, DeMonster Settings
        Gui, Add, Picture, x376 y8 w48 h48 , DeMonster.ico
        Gui, Font, norm s9
        Gui, Add, Button, Default x151 y400 w80 h25 gSave, Save
        Gui, Add, Button, x251 y400 w80 h25 gSettingsGuiClose, Cancel
        Gui, Font, s10
        Gui, Add, Tab, vcurrentTab gSwitchTabs_Label x16 y40 w460 h340 , Monster|No Spam|Hotkeys
        Gui, Font, s9

        DeMonsterGUI()

        Gui, Show, x131 y91 h451 w489, DeMonster Settings

;       Sleep, 250

;       NoSpamGUI()
;       HotkeysGUI()

        Return
}

DeMonsterGUI()
{
        Global

        Gui, Tab, Monster
        Gui, Add, CheckBox, x36 y92 w148 h20 vdm_auto_close_popup Checked%dm_auto_close_popup%, Auto Close Monster Popup
        Gui, Add, CheckBox, x36 y120 w120 h20 vdm_pin_jackpot Checked%dm_pin_jackpot%, Pin Monster Jackpot
        Gui, Add, CheckBox, x36 y150 w160 h20 vdm_hide_jackpot Checked%dm_hide_jackpot%, Hide Monster Jackpot (table)
        Gui, Add, CheckBox, x36 y180 w160 h20 vdm_hide_lobby_jackpot Checked%dm_hide_lobby_jackpot%, Hide Monster Jackpot (lobby)
        Gui, Add, CheckBox, x36 y210 w130 h20 vdm_minimize_lobby_news Checked%dm_minimize_lobby_news%, Minimize Lobby News
        Gui, Add, Picture, gMonsterPopup_Label x190 y92 w16 h15 , HelpIcon.ico
        Gui, Add, Picture, gPinJackpot_Label x161 y120 w16 h15 , HelpIcon.ico
        Gui, Add, Picture, gHideJackpot_Label x201 y149 w16 h15 , HelpIcon.ico
        Gui, Add, Picture, gHideJackpotLobby_Label x201 y180 w16 h15 , HelpIcon.ico
        Gui, Add, Picture, gLobbyNews_Label x172 y210 w16 h15 , HelpIcon.ico

}

NoSpamGUI()
{
        Global

        Gui, Tab, No Spam
        Gui, Add, CheckBox, x36 y90 w130 h20 vdm_auto_join_waiting_list Checked%dm_auto_join_waiting_list%, Auto Join Waiting List
        Gui, Add, CheckBox, x36 y120 w140 h20 vdm_auto_join_first_available Checked%dm_auto_join_first_available%, Auto Join First Available
        Gui, Add, CheckBox, x36 y150 w80 h20 vdm_auto_buyin Checked%dm_auto_buyin%, Auto Buy-in
        Gui, Add, CheckBox, x266 y180 w110 h20 vdm_auto_leave_table Checked%dm_auto_leave_table%, Auto Leave Table
        Gui, Add, DropDownList, x136 y150 w100 h21 vdm_buyin_amount R15, Amount (in BB)||100|95|90|85|80|75|70|65|60|55|50|45|40|35|30|25|20|15|10|5
        GuiControl, ChooseString, ComboBox1,%dm_buyin_amount%
        Gui, Add, CheckBox, x36 y180 w120 h20 vdm_auto_post_bb Checked%dm_auto_post_bb%, Auto Post Big Blind
        Gui, Add, CheckBox, x36 y210 w130 h20 vdm_wait_for_bb Checked%dm_Wait_for_bb%, Auto Wait for Big Blind
        Gui, Add, CheckBox, x266 y90 w80 h20 vdm_auto_login Checked%dm_auto_login%, Auto Login
        Gui, Add, CheckBox, x266 y120 w70 h20 vdm_no_spam Checked%dm_no_spam%, No Spam!
        Gui, Add, CheckBox, x266 y150 w110 h20 vdm_auto_handhistory Checked%dm_auto_handhistory%, Auto Hand History
        Gui, Add, DropDownList, x36 y280 w120 h20 vdm_default_chat AltSubmit R7 Choose%dm_default_chat%, Disabled||Dealer: Normal|Dealer:Summary|Dealer:Silent|No Player Chat|Summary without Chat|Totally Silent
        Gui, Font, bold, 
        Gui, Add, Text, x36 y260 w110 h20 +Center, Chat Options
        Gui, Font, norm, 
        Gui, Add, Picture, x36 y247 w365 h1 , pixel.gif
        Gui, Add, Picture, x168 y90 w16 h15 gWaitingList_Label, HelpIcon.ico
        Gui, Add, Picture, x176 y120 w16 h15 gFirstAvailable_Label, HelpIcon.ico
        Gui, Add, Picture, x114 y149 w16 h15 gBuyin_Label, HelpIcon.ico
        Gui, Add, Picture, x154 y179 w16 h15 gPostBB_Label, HelpIcon.ico
        Gui, Add, Picture, x169 y210 w16 h15 gWaitBB_Label, HelpIcon.ico
        Gui, Add, Picture, x346 y90 w16 h15 gLogin_Label, HelpIcon.ico
        Gui, Add, Picture, x337 y120 w16 h15 gNoSpam_label, HelpIcon.ico
        Gui, Add, Picture, x377 y150 w16 h15 gHandHistory_Label, HelpIcon.ico
        Gui, Add, Picture, x377 y180 w16 h15 gLeaveTable_Label, HelpIcon.ico
        Gui, Add, Picture, x140 y261 w16 h15 gChat_Label, HelpIcon.ico

}

HotkeysGUI()
{
        Global

        Gui, Tab, Hotkeys
        Gui, Font, bold, 
        Gui, Add, Text, x36 y80 w250 h20 +Center, Sitout and Return
        Gui, Add, Picture, x215 y77 w16 h15 gSitoutAndReturn_Label, HelpIcon.ico
        Gui, Add, Picture, x36 y100 w250 h1 , pixel.gif
        Gui, Font, norm, 

        Gui, Add, Text, x96 y114 w40 h20 , Sitout
        Gui, Add, Hotkey, x36 y110 w50 h20 , %dm_hotkey