Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Automated Anagram Game via AHK


  • Please log in to reply
6 replies to this topic
hobdiddy
  • Guests
  • Last active:
  • Joined: --
a little script i wrote. still trying to learn ahk... sry for not crediting com/iweb/something else im sure. i need to focus on commenting next time. if anyone wants to contribute to this project the origin is http://truecheaters....read.php?t=5620

no where near perfect but check it out ;)

;=======================================================
Name:="Chicktionary Boss X+"
SName:="CBX+"
ScriptVersion:="1.5.4 Final"
;=======================================================
COM_Init()
#SingleInstance,Force
#Include COM.ahk
#NoTrayIcon

IniRead,SV_New,%A_ScriptDir%\Config.ini,ScriptVersion,%ScriptVersion%,0

If ( SV_New = 0 )
{
GoSub,Disclaimer
IniWrite,1,%A_ScriptDir%\Config.ini,ScriptVersion,%ScriptVersion%
}

Gui,4:+ToolWindow
Gui,4:Margin,5,5
Gui,4:Add,Progress,x5 h10 w450 c3deb1f Background19620c vLoad,0
Gui,4:Show,,%Name% %ScriptVersion% - Loading... 

SetWorkingDir,%A_ScriptDir%
FileInstall,GFX\Donate.png,%A_Temp%\Donate.png,1
SetWorkingDir,%A_Temp%
		
Menu,Tray,NoStandard
Menu,Tray,Tip,%Name% %ScriptVersion%
Menu,Tray,Add,[%Name% %ScriptVersion%],Gui_Hide
Menu,Tray,Default,[%Name% %ScriptVersion%]
Menu,Tray,Disable,[%Name% %ScriptVersion%]
Menu,Tray,Add
Menu,Tray,Add,Reload
Menu,Tray,Add,Exit
		GuiControl,4:,Load,15
Menu,FileMenu,Add,Accounts
Menu,FileMenu,Add,Settings
Menu,FileMenu,Add
Menu,FileMenu,Add,Reload
Menu,FileMenu,Add,Exit
Menu,HelpMenu,Add,Disclaimer
Menu,HelpMenu,Add,Help
Menu,Gui_Menu,Add,&File,:FileMenu
Menu,Gui_Menu,Add,&Help,:HelpMenu

;Set Defaults
;=======================================================

Loc:=UserProfile "\Local Settings\Temporary Internet Files\*"
Loop,Parse,UserProfile,\
{
If ( A_Index = 2 and A_LoopField = "Users" )
	Loc:=UserProfile "\AppData\Local\Microsoft\Windows\Temporary Internet Files\*"
}

IniRead,DeC,%A_ScriptDir%\Config.ini,DeCaptcher,On,0
IniRead,DUser,%A_ScriptDir%\Config.ini,DeCaptcher,DUser,%A_Space%
IniRead,DPass,%A_ScriptDir%\Config.ini,DeCaptcher,DPass,%A_Space%
IniRead,Rand,%A_ScriptDir%\Config.ini,WordList,Randomize,1

IniRead,D_TH,%A_ScriptDir%\Config.ini,Settings,DeCap Threshold,3
IniRead,S_TH,%A_ScriptDir%\Config.ini,Settings,Search Threshold,3
IniRead,W_TH,%A_ScriptDir%\Config.ini,Settings,Wait Threshold,5
IniRead,TSCheck,%A_ScriptDir%\Config.ini,Settings,TSCheck,0
IniRead,Hours,%A_ScriptDir%\Config.ini,Settings,Start Time,0000
IniRead,DeProxy,%A_ScriptDir%\Config.ini,Settings,DeProxy,%A_Space%

EX:=1
EY:=0
EZ:=0
P:=0
Plus:=0
SwitchUser:=0

3_LimD:=21
4_LimD:=20
5_LimD:=13
6_LimD:=7
7_LimD:=2

IniRead,Bugd,%A_ScriptDir%\Config.ini,Skip,Bugd,%A_Space%

IniRead,3_Lim,%A_ScriptDir%\Config.ini,LenLimit,3_Lim,%3_LimD%
IniRead,4_Lim,%A_ScriptDir%\Config.ini,LenLimit,4_Lim,%4_LimD%
IniRead,5_Lim,%A_ScriptDir%\Config.ini,LenLimit,5_Lim,%5_LimD%
IniRead,6_Lim,%A_ScriptDir%\Config.ini,LenLimit,6_Lim,%6_LimD%
IniRead,7_Lim,%A_ScriptDir%\Config.ini,LenLimit,7_Lim,%7_LimD%

0_Hex:="0x30"
1_Hex:="0x31"
2_Hex:="0x32"
3_Hex:="0x33"
4_Hex:="0x34"
5_Hex:="0x35"
6_Hex:="0x36"
7_Hex:="0x37"
8_Hex:="0x38"
9_Hex:="0x39"

A_Hex:="0x41"
B_Hex:="0x42"
C_Hex:="0x43"
D_Hex:="0x44"
E_Hex:="0x45"
F_Hex:="0x46"
G_Hex:="0x47"
H_Hex:="0x48"
I_Hex:="0x49"
J_Hex:="0x4A"
K_Hex:="0x4B"
L_Hex:="0x4C"
M_Hex:="0x4D"
N_Hex:="0x4E"
O_Hex:="0x4F"
P_Hex:="0x50"
Q_Hex:="0x51"
R_Hex:="0x52"
S_Hex:="0x53"
T_Hex:="0x54"
U_Hex:="0x55"
V_Hex:="0x56"
W_Hex:="0x57"
X_Hex:="0x58"
Y_Hex:="0x59"
Z_Hex:="0x5A"

;Create Gui
;=======================================================
COM_AtlAxWinInit()
Gui,1:+LastFound
GuiID:=WinExist()
Gui,1:Add,Text,x0 y0 w1 h1,Seed
pwb:=COM_AtlAxGetControl(COM_AtlAxCreateContainer(GuiID,0,0,645,335, "Shell.Explorer") )
Gui,1:Menu,Gui_Menu
Gui,1:Margin,2,2

url:="http://club.live.com/Pages/Home/HomePage.aspx"
COM_Invoke(pwb, "Navigate", url)
scs:=iWeb_complete(pwb)

Gui,1:Add,Button,x650 y0 w10 h335 Section gEX

Gui,1:Add,GroupBox,xs+15 y5 w150 h185,| Delay Configuration |
		GuiControl,4:,Load,30
Gui,1:Add,Text,xs+20 yp+20  w60 Right,New Game:
Gui,1:Add,Edit,x+2 yp-3 w60 r1 Center Disabled vNG_MINNG_MAX
Gui,1:Add,Text,x+2 yp+3 vNG gNG,<<
Gui,1:Add,Text,xs+20 y+10 w60 Right,Start Game:
Gui,1:Add,Edit,x+2 yp-3 w60 r1 Center Disabled vSG_MINSG_MAX
Gui,1:Add,Text,x+2 yp+3 vSG gSG,<<
Gui,1:Add,Text,xs+20 y+10 w60 Right,Load Game:
Gui,1:Add,Edit,x+2 yp-3 w60 r1 Center Disabled vLG_MINLG_MAX
Gui,1:Add,Text,x+2 yp+3 vLG gLG,<<
Gui,1:Add,Text,xs+20 y+10 w60 Right,Play Again:
Gui,1:Add,Edit,x+2 yp-3 w60 r1 Center Disabled vPA_MINPA_MAX
Gui,1:Add,Text,x+2 yp+3 vPA gPA,<<
		GuiControl,4:,Load,45
Gui,1:Add,Text,xs+20 y+10 w60 Right,Letter:
Gui,1:Add,Edit,x+2 yp-3 w60 r1 Center Disabled vLT_MINLT_MAX
Gui,1:Add,Text,x+2 yp+3 vLT gLT,<<
Gui,1:Add,Text,xs+20 y+10 w60 Right,Enter:
Gui,1:Add,Edit,x+2 yp-3 w60 r1 Center Disabled vEN_MINEN_MAX
Gui,1:Add,Text,x+2 yp+3 vEN gEN,<<
Gui,1:Add,Text,xs+20 y+10 w60 Right,Clear:
Gui,1:Add,Edit,x+2 yp-3 w60 r1 Center Disabled vCL_MINCL_MAX
Gui,1:Add,Text,x+2 yp+3 vCL gCL,<<
	GoSub,Prep_Delay
Gui,1:Add,Button,xs+15 y+20 w60 vPause gPause,Pause
Gui,1:Add,Button,x+30 yp w60 Default vExecute gExecute,Execute
		GuiControl,4:,Load,60
Gui,1:Add,GroupBox,xs+15 y+10 w150 h100,| DeCaptcher Settings |
Gui,1:Add,DDL,xp+20 yp+20 w120 AltSubmit Choose%DeC% vDec gDeC,Off [Manual Entry]||Standard|Plus [Assisted Entry]|Minus [No Refund]
Gui,1:Add,Text,xs+20 y+10 w60 Right,Login:
Gui,1:Add,Edit,x+2 yp-3 w75 r1 vDUser,%DUser%
Gui,1:Add,Text,xs+20 y+5 w60 Right,Password:
Gui,1:Add,Edit,x+2 yp-3 w75 Password r1 vDPass,%DPass%
	GoSub,DeC
Gui,1:Add,CheckBox, xs+20 y+15 w150 Center Checked%Rand% vRand, Randomize Words
		GuiControl,4:,Load,75
Gui,1:Add,Picture,xs+40 y365 w88 h22 E0x200,Donate.png
Gui,1:Add,Picture,xp yp w92 h26 vm0 gDonate,Donate.png

Gui,1:Add,Button,x0 y340 w645 h10 Section gEY
Gui,1:Add,Button,x+2 yp-3 w15 h15 Section gEZ

Gui,1:Add,Groupbox,x10 ys+20 w80 h45,| Answer |
Gui,1:Add,Text,xp+10 yp+20 w60 Center vASet,N/A
		GuiControl,4:,Load,90
Gui,1:Add,GroupBox,x+25 ys+20 w540 h45,| Answer Limits per Length |
Gui,1:Add,Text,xp+10 yp+20,Seven:
Gui,1:Add,Edit,x+5 yp-3 w40 r1 Center v7_Lim,%7_Lim%
Gui,1:Add,Text,x+20 yp+3,Six:
Gui,1:Add,Edit,x+5 yp-3 w40 r1 Center v6_Lim,%6_Lim%
Gui,1:Add,Text,x+20 yp+3,Five:
Gui,1:Add,Edit,x+5 yp-3 w40 r1 Center v5_Lim,%5_Lim%
Gui,1:Add,Text,x+20 yp+3,Four:
Gui,1:Add,Edit,x+5 yp-3 w40 r1 Center v4_Lim,%4_Lim%
Gui,1:Add,Text,x+20 yp+3,Three:
Gui,1:Add,Edit,x+5 yp-3 w40 r1 Center v3_Lim,%3_Lim%
Gui,1:Add,Button, x+20 yp-2 w60 vLim_Default gLim_Default,Default
		GuiControl,4:,Load,100
Gui,4:Destroy
Gui,1:Show,w820 h355 Center,%Name% %ScriptVersion% by Hobdiddy
Return

Accounts:
;=======================================================
Edit:=0
Gui,1:+Disabled
Gui,5:+Owner1 
Gui,5:Default
Gui,5:Margin,5,2
Gui,5:Add,ListView,x2 y2 w400 r15 -Multi Grid Checked gCL_Edit,Email|Password|Game|Tickets

All_Tix:=0
Loop
{
IniRead,CL_User,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_User,%A_Space%
If ( CL_User = "" )
Break
IniRead,Checked,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,Checked,1
IniRead,CL_Pass,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_Pass
IniRead,CL_Game,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_Game,Chicktionary
IniRead,CL_Tix,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_Tix,N/A
If ( Checked = 1 )
LV_Add("Check",CL_User,CL_Pass,CL_Game,CL_Tix)
Else
LV_Add("",CL_User,CL_Pass,CL_Game,CL_Tix)
LV_ModifyCol()
CL_Last:=A_Index

If ( CL_Tix = "N/A" )
Continue

ATix:=CL_Tix
StringReplace,ATix,ATix,`,

TTix+=ATix
}

If ( StrLen(TTix) > 3 )
{
StringTrimRight,TTixL,TTix,3
StringRight,TTixR,TTix,3
TTix:=TTixL "," TTixR
}

If ( TTix = "" )
TTix:=0
If ( CL_Last = "" )
CL_Last:=0

Gui,5:Add,Text,x+5 yp,Email:
Gui,5:Add,Edit,xp y+2 w100 vCL_User
Gui,5:Add,Text,xp y+5,Password:
Gui,5:Add,Edit,xp y+2 w100 h20 Password vCL_Pass
Gui,5:Add,Text,xp y+5,Game:
Gui,5:Add,DropDownList,xp y+2 w100 vCL_Game,Chicktionary||Spelling Bee|Word Slugger
Gui,5:Add,Button,xp y+10 w48 Disabled vCL_Up gCL_Up,Up
Gui,5:Add,Button,x+2 yp w48 Disabled vCL_Down gCL_Down,Down
Gui,5:Add,Button,xp-50 y+10 w100 Default vCL_Add gCL_Add,Add
Gui,5:Add,Button,xp y+2 w100 Disabled vCL_Remove gCL_Remove,Remove
Gui,5:Add,Button,xp y+2 w100 vCL_Rand gCL_Rand,Randomize
Gui,5:Add,Button,xp y+25 w100 vCL_Save gCL_Save,Save
Gui,5:Show,,Account Manager [%CL_Last%] Total Accounts with [%TTix%] Tickets - %SName%
Return

CL_Edit:
If ( A_GuiEvent = "DoubleClick" )
{
If ( A_EventInfo = 0 )
Return
Edit:=1
CurrentRow:=A_EventInfo
Loop
{
LV_GetText(CL_User,A_Index,1)
If ( CL_User = "" )
Break
EndRow:=A_Index
}
SendMessage, 4140, A_EventInfo - 1, 0xF000, SysListView321
CheckedM := (ErrorLevel >> 12) - 1
LV_GetText(CL_User,A_EventInfo,1)
LV_GetText(CL_Pass,A_EventInfo,2)
LV_GetText(CL_GameM,A_EventInfo,3)
LV_GetText(CL_Tix,A_EventInfo,4)
CL_UserM:=CL_User
CL_PassM:=CL_Pass
CL_TixM:=CL_Tix
GuiControl,5:,CL_User,%CL_User%
GuiControl,5:,CL_Pass,%CL_Pass%
GuiControl,5:,CL_Add,Change
GuiControl,5:Enable,CL_Remove
GuiControl,5:Enable,CL_Up
GuiControl,5:Enable,CL_Down
GuiControl,5:Disable,CL_Save
GuiControl,5:Disable,CL_Rand
}
Return

CL_Up:
If ( CurrentRow = 1 ) 
	Return
Accounts:=""
Loop
{
LV_GetText(CL_User,A_Index,1)
If ( CL_User = "" )
Break
SendMessage, 4140, A_Index - 1, 0xF000, SysListView321
Checked := (ErrorLevel >> 12) - 1
LV_GetText(CL_Pass,A_Index,2)
LV_GetText(CL_Game,A_Index,3)
LV_GetText(CL_Tix,A_Index,4)

If ( A_Index = CurrentRow )
	Continue
If ( A_Index = CurrentRow - 1 )
	Accounts .= CL_UserM ";" CL_PassM ";" CL_GameM ";" CL_TixM ";" CheckedM "|"
	Accounts .= CL_User ";" CL_Pass ";" CL_Game ";" CL_Tix ";" Checked "|"
}
CurrentRow-=1
GoSub,CL_Move
Return

CL_Down:
If ( CurrentRow = EndRow ) 
	Return
Accounts:=""
Loop
{
LV_GetText(CL_User,A_Index,1)
If ( CL_User = "" )
Break
SendMessage, 4140, A_Index - 1, 0xF000, SysListView321
Checked := (ErrorLevel >> 12) - 1
LV_GetText(CL_Pass,A_Index,2)
LV_GetText(CL_Game,A_Index,3)
LV_GetText(CL_Tix,A_Index,4)

If ( A_Index = CurrentRow )
	Continue
Accounts .= CL_User ";" CL_Pass ";" CL_Game ";" CL_Tix ";" Checked "|"
If ( A_Index = CurrentRow + 1 )
	Accounts .= CL_UserM ";" CL_PassM ";" CL_GameM ";" CL_TixM ";" CheckedM "|"
}
CurrentRow+=1
GoSub,CL_Move
Return

CL_Add:
Gui,5:Submit,NoHide
If ( CL_User = "" or CL_Pass = "" )
Return
GuiControl,5:,CL_User
GuiControl,5:,CL_Pass
If Edit = 0
LV_Add("Check",CL_User,CL_Pass,CL_Game,"N/A")
If Edit = 1
{
Edit = 0
LV_Modify(CurrentRow,"",CL_User,CL_Pass,CL_Game)
GuiControl,5:,CL_Add,Add
GuiControl,5:Disable,CL_Up
GuiControl,5:Disable,CL_Down
GuiControl,5:Disable,CL_Remove
GuiControl,5:Enable,CL_Save
GuiControl,5:Enable,CL_Rand
}
ControlFocus,Edit1
LV_ModifyCol()
Return

CL_Remove:
Edit = 0
GuiControl,5:,CL_User
GuiControl,5:,CL_Pass
GuiControl,5:,CL_Add,Add
GuiControl,5:Disable,CL_Up
GuiControl,5:Disable,CL_Down
GuiControl,5:Disable,CL_Remove
GuiControl,5:Enable,CL_Save
GuiControl,5:Enable,CL_Rand
LV_Delete(CurrentRow)
ControlFocus,Edit1
LV_ModifyCol()
Return

CL_Rand:
Accounts:=""
Loop
{
LV_GetText(CL_User,A_Index,1)
If ( CL_User = "" )
Break
SendMessage, 4140, A_Index - 1, 0xF000, SysListView321
Checked := (ErrorLevel >> 12) - 1
LV_GetText(CL_Pass,A_Index,2)
LV_GetText(CL_Game,A_Index,3)
LV_GetText(CL_Tix,A_Index,4)
Accounts .= CL_User ";" CL_Pass ";" CL_Game ";" CL_Tix ";" Checked "|"
}
Sort,Accounts,Random D|
CL_Move:
LV_Delete()
Loop,Parse,Accounts,|
{
If ( A_LoopField = "" )
Break
Loop,Parse,A_LoopField,;
{
If A_Index = 1
CL_User:=A_LoopField
If A_Index = 2
CL_Pass:=A_LoopField
If ( A_Index = 3 )
CL_Game:=A_LoopField
If ( A_Index = 4 )
CL_Tix:=A_LoopField
If ( A_Index = 5 )
Checked:=A_LoopField
If ( CL_Tix = "" )
CL_Tix:="N/A"
}
If ( Checked = 1 )
LV_Add("Check",CL_User,CL_Pass,CL_Game,CL_Tix)
Else
LV_Add("",CL_User,CL_Pass,CL_Game,CL_Tix)
LV_ModifyCol()
}
Return

CL_Save:
N = 0
Accounts:=""
Loop
{
LV_GetText(CL_User,A_Index,1)
If ( CL_User = "" )
Break
SendMessage, 4140, A_Index - 1, 0xF000, SysListView321
Checked := (ErrorLevel >> 12) - 1
IniWrite,%Checked%,%A_ScriptDir%\Accounts.bak,Account_%A_Index%,Checked
IniWrite,%CL_User%,%A_ScriptDir%\Accounts.bak,Account_%A_Index%,CL_User
LV_GetText(CL_Pass,A_Index,2)
LV_GetText(CL_Game,A_Index,3)
LV_GetText(CL_Tix,A_Index,4)
IniWrite,%CL_Pass%,%A_ScriptDir%\Accounts.bak,Account_%A_Index%,CL_Pass
IniWrite,%CL_Game%,%A_ScriptDir%\Accounts.bak,Account_%A_Index%,CL_Game
IniWrite,%CL_Tix%,%A_ScriptDir%\Accounts.bak,Account_%A_Index%,CL_Tix
}
FileMove,%A_ScriptDir%\Accounts.bak,%A_ScriptDir%\Accounts.ini,1

5GuiClose:
Gui,1:-Disabled
Gui,5:Destroy
Return

Settings:
;=======================================================
Gui,6:+Owner1
Gui,1:+Disabled
Gui,6:Margin,5,5
Gui,6:Add,GroupBox,x5 y5 w150 h90 Section,| Error Thresholds |
Gui,6:Add,Text,xs+5 yp+20 w60 Right,DeCaptcher:
Gui,6:Add,Edit,x+2 yp-3 w75 r1 Center vD_TH,%D_TH%
Gui,6:Add,Text,xs+5 y+5 w60 Right,Search:
Gui,6:Add,Edit,x+2 yp-3 w75 r1 Center vS_TH,%S_TH%
Gui,6:Add,Text,xs+5 y+5 w60 Right,Wait:
Gui,6:Add,Edit,x+2 yp-3 w75 r1 Center vW_TH,%W_TH%

Gui,6:Add,GroupBox,x5 y+20 w150 h45 Section,| Auto-Start |
Gui,6:Add,CheckBox,xs+5 yp+20 w40 Center vTSCheck gTSCheck Checked%TSCheck%,@
Gui,6:Add,Edit,x+1 yp-3 w60 Disabled Limit4 Center vHours,%Hours%
GoSub,TSCheck
Gui,6:Add,Text,x+5 yp+3,Hours

Gui,6:Add,GroupBox,x5 y+20 w150 h45 Section,| DeCap Proxy |
Gui,6:Add,Edit,xs+5 yp+20 w120 Center vDeProxy,%DeProxy%
Gui,6:Add,Button,xs y+20 w60 Default gSave_TH,Save
Gui,6:Show,,Settings - %SName%
Return

TSCheck:
Gui,Submit,NoHide
If ( TSCheck = 0 )
GuiControl,6:Disable,Hours
If ( TSCheck = 1 )
GuiControl,6:Enable,Hours
Return

Save_TH:
Gui,6:Submit,NoHide
IniWrite,%D_TH%,%A_ScriptDir%\Config.ini,Settings,DeCap Threshold
IniWrite,%S_TH%,%A_ScriptDir%\Config.ini,Settings,Search Threshold
IniWrite,%W_TH%,%A_ScriptDir%\Config.ini,Settings,Wait Threshold
IniWrite,%TSCheck%,%A_ScriptDir%\Config.ini,Settings,TSCheck
IniWrite,%Hours%,%A_ScriptDir%\Config.ini,Settings,Start Time
IniWrite,%DeProxy%,%A_ScriptDir%\Config.ini,Settings,DeProxy
6GuiClose:
Gui,1:-Disabled
Gui,6:Destroy
Return

Execute: ;Begin Main
;===========================================================================================================
COM_Invoke(pwb, "Silent=", True)

SDay := A_Day

Gui,1:Submit,NoHide
GuiControl,1:Disable,Execute
GuiControl,1:Disable,NG
GuiControl,1:Disable,SG
GuiControl,1:Disable,LG
GuiControl,1:Disable,PA
GuiControl,1:Disable,LT
GuiControl,1:Disable,EN
GuiControl,1:Disable,CL
GuiControl,1:Disable,DeC
GuiControl,1:Disable,DUser
GuiControl,1:Disable,DPass
GuiControl,1:Disable,Rand

GuiControl,1:,7_Lim,0
GuiControl,1:,6_Lim,0
GuiControl,1:,5_Lim,0
GuiControl,1:,4_Lim,0
GuiControl,1:,3_Lim,0

GuiControl,1:Disable,7_Lim
GuiControl,1:Disable,6_Lim
GuiControl,1:Disable,5_Lim
GuiControl,1:Disable,4_Lim
GuiControl,1:Disable,3_Lim
GuiControl,1:Disable,Lim_Default

IniWrite,%DeC%,%A_ScriptDir%\Config.ini,DeCaptcher,On
IniWrite,%DUser%,%A_ScriptDir%\Config.ini,DeCaptcher,DUser
IniWrite,%DPass%,%A_ScriptDir%\Config.ini,DeCaptcher,DPass
IniWrite,%Rand%,%A_ScriptDir%\Config.ini,WordList,Randomize

IniWrite,%3_Lim%,%A_ScriptDir%\Config.ini,LenLimit,3_Lim
IniWrite,%4_Lim%,%A_ScriptDir%\Config.ini,LenLimit,4_Lim
IniWrite,%5_Lim%,%A_ScriptDir%\Config.ini,LenLimit,5_Lim
IniWrite,%6_Lim%,%A_ScriptDir%\Config.ini,LenLimit,6_Lim
IniWrite,%7_Lim%,%A_ScriptDir%\Config.ini,LenLimit,7_Lim

Logz:
;=======================================================
CL_Number += 1
CL_Name:=""
CL_Tix:=""
DeIncorrect:=0

Loop
{
IniRead,CL_User,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_User,%A_Space%
If ( CL_User = "" )
Break
CL_Total:=A_Index
}

IniRead,CL_UserP,%A_ScriptDir%\Accounts.ini,Account_%CL_Number%,CL_User,%A_Space%
If ( CL_UserP = "" )
Goto,Done
IniRead,CheckedP,%A_ScriptDir%\Accounts.ini,Account_%CL_Number%,Checked,1
If ( CheckedP = 0 )
Goto,Logz
IniRead,CL_PassP,%A_ScriptDir%\Accounts.ini,Account_%CL_Number%,CL_Pass
IniRead,CL_GameP,%A_ScriptDir%\Accounts.ini,Account_%CL_Number%,CL_Game

	FileAppend,[%A_Hour%:%A_Min%:%A_Sec%] Logging In - %CL_UserP% `n,%A_ScriptDir%\CBX+ActivityLog.txt

Login(pwb, CL_UserP, CL_PassP)

Sleep,5000

pdoc:=COM_Invoke(pwb,"document")
documentElement:=COM_Invoke(pdoc,"documentElement")
innerHTML:=COM_Invoke(documentElement,"innerHTML")

IfInString,innerHTML,password is incorrect
{
	FileAppend,[%A_Hour%:%A_Min%:%A_Sec%] Password is Incorrect - %CL_UserP% `n,%A_ScriptDir%\CBX+ActivityLog.txt
Goto,Logz
}

GoSub,Update

StringReplace,CL_GameP,CL_GameP,%A_Space%,_

url:="http://club.live.com/Pages/Games/GamePlay.aspx?game=" CL_GameP "&mode=play"
COM_Invoke(pwb, "Navigate", url)
scs:=iWeb_complete(pwb)
COM_Invoke(pwb, "Refresh")
scs:=iWeb_complete(pwb)

Start: ;Check For Limit
;=======================================================
STime:=A_TickCount
Url:="http://club.live.com/Pages/Games/GamePlay.aspx?game=" CL_GameP "&mode=play"
UrlDownloadToFile,%Url%,%A_Temp%\CBX_Trash.txt
FileRead,Html,%A_Temp%\CBX_Trash.txt
IfInString,Html,Congratulations
	Goto,Logz

StringReplace,CL_Game,CL_GameP,_,%A_Space%
Loop
{
IniRead,CP_User,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_User,%A_Space%
If ( CP_User = "" )
Break
If ( CL_UserP <> CP_User )
Continue
IniWrite,%CL_Game%,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_Game
}

WinSetTitle,ahk_id %GuiID%,,[%CL_Number% / %CL_Total%] %CL_Name% | I:%ITix% C:%CL_Tix% Tickets %DTime%- %SName% %ScriptVersion%

Url := COM_Invoke(pwb, "LocationUrl")
If ( Url <> "http://club.live.com/Pages/Games/GamePlay.aspx?game=" CL_GameP "&mode=play" )
{
ErrorWait:=A_TickCount + 6000
Loop
{
If ( A_TickCount >= ErrorWait )
Break
WaitDisplay:=ErrorWait - A_TickCount
StringTrimRight,WaitDisplay,WaitDisplay,3
If ( WaitDisplay = "" )
	WaitDisplay := 0
If ( WaitDisplay <> ShowWait )
{
WinSetTitle,ahk_id %GuiID%,,Error Found`, Waiting %WaitDisplay% seconds - %SName% %ScriptVersion%
ShowWait:=WaitDisplay
}
}
url:="http://club.live.com/Pages/Games/GamePlay.aspx?game=" CL_GameP "&mode=play"
COM_Invoke(pwb, "Navigate", url)
scs:=iWeb_complete(pwb)
Goto,Start
}

	FormatTime,FTime,,yyyyMMddHHmmss

CL_Loop:=2
If ( CL_GameP = "Chicktionary" )
CL_Loop:=1

GuiControl,1:Disable,PA
GuiControl,1:Enable,NG
Min:="NG_MIN"
Max:="NG_MAX"
GoSub,Rand_Delay
Sleep,%Delay%

;SinglePlayer
If ( CL_GameP = "Chicktionary" )
{
Param1:="0x00000000"
Param2:="0x00e000af"


Loop,%CL_Loop%
{
PostMessage, 0x201, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONDOWN
PostMessage, 0x202, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONUP
}
}

GuiControl,1:Disable,NG
GuiControl,1:Enable,SG

Min:="SG_MIN"
Max:="SG_MAX"
GoSub,Rand_Delay
Sleep,%Delay%

;PlayNewGame
If ( CL_GameP = "Chicktionary" )
{
Param1:="0x00000000"
Param2:="0x010b012f"
}
If ( CL_GameP = "Spelling_Bee" )
{
Param1:="0x00000000"
Param2:="0x00ed0177"
}
If ( CL_GameP = "Word_Slugger" )
{
Param1:="0x00000000"
Param2:="0x00ed017a"
}

Loop,%CL_Loop%
{
PostMessage, 0x201, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONDOWN
PostMessage, 0x202, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONUP
}
GuiControl,1:Disable,SG
GuiControl,1:Enable,LG

Min:="LG_MIN"
Max:="LG_MAX"
GoSub,Rand_Delay
Sleep,%Delay%
GuiControl,1:Disable,LG

Captcha:
;=======================================================
FileDelete,%A_ScriptDir%\CAPTCHA.JPG
Found:=0
WinSetTitle,ahk_id %GuiID%,,Searching for Captcha - %SName% %ScriptVersion%

Loop
{
	If ( Found = 1 or A_Index > W_TH )
		Break

Loop,%Loc%.*,0,1
{
	IfInString,A_LoopFileName,CAPTCHAChallenge
	{
		FileGetTime,CTime,%A_LoopFileLongPath%,M
		If ( CTime > FTime )
		{
			Found:=1
			FileCopy,%A_LoopFileLongPath%,%A_ScriptDir%\CAPTCHA.JPG,1
		}
	}
}
Sleep,1000
}

	FormatTime,FTime,,yyyyMMddHHmmss

If ( Found = 0 )
Goto,Find_Letters

Sleep,1000

DeTick:=A_TickCount
Loop
{
	If ( A_TickCount - DeTick > 30000 )
	{
		url:="http://club.live.com/Pages/Games/GamePlay.aspx?game=" CL_GameP "&mode=play"
		COM_Invoke(pwb, "Navigate", url)
		scs:=iWeb_complete(pwb)
		Goto,Start
	}
	IfExist,%A_ScriptDir%\CAPTCHA.JPG
		Break
}
If ( DeC = 1  or Dec = 3 )
{
	WinSetTitle,ahk_id %GuiID%,,Waiting for Response - %SName% %ScriptVersion%
	Gui,3:Margin,2,2
	Gui,3:Add,Picture,x2 y2 w350 h100 Border,%A_ScriptDir%\CAPTCHA.jpg
	Gui,3:Add,Text,x0 y+5 w75 Center vC_Down
	Gui,3:Add,Edit,x77 yp-3 w100 Center Limit5 vC_Code
	Gui,3:Add,Button,x+20 yp-1 w80 Default gC_Submit,Submit
	Gui,3:Show,,Enter Captcha - %SName%
	If ( Dec = 3 )
	{
		Plus:=1
		PlusStart:=A_TickCount
		Loop
		{
			C_Down:=15000 - ( A_TickCount - PlusStart )
			StringRight,C_DownR,C_Down,3
			StringTrimRight,C_DownL,C_Down,3
			GuiControl,3:,C_Down,%C_DownL%.%C_DownR% sec(s)
			If ( C_Down <= 0)
			{
				Plus:=0
				Gui,3:Destroy
				Break
			}
		}
		Goto,DeCont
	}
	Return
}
DeCont:
FileDelete,%A_ScriptDir%\DeResult.htm
WinSetTitle,ahk_id %GuiID%,,Captcha Found! Sending Result to DeCaptcher - %SName% %ScriptVersion%
RunWait,%A_ScriptDir%\cUrl.exe -x "%DeProxy%" -F "function=picture2" -F "username=%DUser%" -F "password=%DPass%" -F "pict=@%A_ScriptDir%\CAPTCHA.JPG" -F "pict_to=0" -F "pict_type=0" -o "%A_ScriptDir%\DeResult.htm" "http://decaptcher.com/poster/",, UseErrorLevel Hide
DeTick:=A_TickCount
Loop
{
DeSession:=A_TickCount - DeTick
	If ( DeSession > 5000 )
		Goto,DeCont
	IfExist,%A_ScriptDir%\DeResult.htm
		Break
}
WinSetTitle,ahk_id %GuiID%,,Entering Response from DeCaptcher - %SName% %ScriptVersion%
FileRead,DeBack,%A_ScriptDir%\DeResult.htm
If ( Strlen(DeBack) <= 5 )
	Goto,DeCont

Loop,Parse,DeBack,|
{
	If ( A_Index = 2 )
		Major:=A_LoopField
	If ( A_Index = 3 )
		Minor:=A_LoopField
	If ( A_Index = 6 )
		C_Code:=A_LoopField
}
Goto,DeSubmit

C_Submit:
Gui,3:Submit,NoHide
Gui,3:Destroy

DeSubmit: 
WinSetTitle,ahk_id %GuiID%,,Verifing Captcha - %SName% %ScriptVersion%
FormatTime,FTime,,yyyyMMddHHmmss

If ( CL_GameP = "Chicktionary" )
{
Param1:="0x00000000"
Param2:="0x00d70146"
}
If ( CL_GameP = "Spelling_Bee" )
{
Param1:="0x00000000"
Param2:="0x00c90131"
}
If ( CL_GameP = "Word_Slugger" )
{
Param1:="0x00000000"
Param2:="0x00c90132"
}

Loop,%CL_Loop%
{
PostMessage, 0x201, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONDOWN
PostMessage, 0x202, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONUP
}

	Sleep 1000
	Loop,Parse,C_Code
	{
		RegExMatch(A_LoopField,"[a-zA-Z0-9]",C_Letter)
		KCode:=%C_Letter%_Hex
		PostMessage, 0x100, %KCode%,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYDOWN
	}
	Sleep 1000
If ( CL_GameP = "Chicktionary" )
{
Param1:="0x00000000"
Param2:="0x00ff012e"
}
If ( CL_GameP = "Spelling_Bee" )
{
Param1:="0x00000000"
Param2:="0x00ed0131"
}
If ( CL_GameP = "Word_Slugger" )
{
Param1:="0x00000000"
Param2:="0x00ec0135"
}

Loop,%CL_Loop%
{
PostMessage, 0x201, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONDOWN
PostMessage, 0x202, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONUP
}
	Sleep,3000 
Loop,%Loc%.*,0,1
{
	IfInString,A_LoopFileName,CAPTCHAChallenge
	{
		FileGetTime,CTime,%A_LoopFileLongPath%,M
		If ( CTime > FTime )
		{
			DeIncorrect+=1
			WinSetTitle,ahk_id %GuiID%,,Captcha Incorrect :( Retrying... - %SName% %ScriptVersion%
			FileAppend,[%A_Hour%:%A_Min%:%A_Sec%] Captcha Incorrect (%C_Code%)`n,%A_ScriptDir%\CBX+ActivityLog.txt
			If ( DeC = 2 or DeC = 3 and Plus = 0 )
			RunWait,%A_ScriptDir%\curl.exe -x "%DeProxy%" -F "function=picture_bad2" -F "username=%DUser%" -F "password=%DPass%" -F "major_id=%Major%" -F "minor_id=%Minor%" "http://decaptcher.com/poster/",, UseErrorLevel Hide
			If ( DeIncorrect = 3 )
			{
			CL_Number-=1
			Goto,Logz
			}
			Break
		}
	}
}
Goto,Captcha

DeIncorrect:=0


Find_Letters:
WinSetTitle,ahk_id %GuiID%,,[%CL_Number% / %CL_Total%] %CL_Name% | I:%ITix% C:%CL_Tix% Tickets %DTime%- %SName% %ScriptVersion%
;=======================================================
Loop
{
	If ( A_Index > S_TH )
		Goto,SwitchGame
	;Clear
	Loop,7
	{
		PostMessage, 0x100, 0x08,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYDOWN
		PostMessage, 0x101, 0x08,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYUP
	}

	Min:="CL_MIN"
	Max:="CL_MAX"
	GoSub,Rand_Delay
	Sleep,%Delay%

	Loop,7
	{
		If ( A_Index = 1 )
		{
			If ( CL_GameP = "Chicktionary" )
			{
				Param1:="0x00000000"
				Param2:="0x00e00091"
			}
			If ( CL_GameP = "Spelling_Bee" )
			{
				Param1:="0x00000000"
				Param2:="0x00ac00aa"
			}
			If ( CL_GameP = "Word_Slugger" )
			{
				Param1:="0x00000000"
				Param2:="0x00fa008c"
			}
		}

		If ( A_Index = 2 )
		{
			If ( CL_GameP = "Chicktionary" )
			{
				Param1:="0x00000000"
				Param2:="0x00e100c7"
			}
			If ( CL_GameP = "Spelling_Bee" )
			{
				Param1:="0x00000000"
				Param2:="0x00c700d8"
			}
			If ( CL_GameP = "Word_Slugger" )
			{
				Param1:="0x00000000"
				Param2:="0x00f700c7"
			}
		}

		If ( A_Index = 3 )
		{
			If ( CL_GameP = "Chicktionary" )
			{
				Param1:="0x00000000"
				Param2:="0x00e000fc"
			}
			If ( CL_GameP = "Spelling_Bee" )
			{
				Param1:="0x00000000"
				Param2:="0x00aa0105"
			}
			If ( CL_GameP = "Word_Slugger" )
			{
				Param1:="0x00000000"
				Param2:="0x00f800fe"
			}
		}

		If ( A_Index = 4 )
		{
			If ( CL_GameP = "Chicktionary" )
			{
				Param1:="0x00000000"
				Param2:="0x00e00133"
			}
			If ( CL_GameP = "Spelling_Bee" )
			{
				Param1:="0x00000000"
				Param2:="0x00c60133"
			}
			If ( CL_GameP = "Word_Slugger" )
			{
				Param1:="0x00000000"
				Param2:="0x00f80138"
			}
		}

		If ( A_Index = 5 )
		{
			If ( CL_GameP = "Chicktionary" )
			{
				Param1:="0x00000000"
				Param2:="0x00df0169"
			}
			If ( CL_GameP = "Spelling_Bee" )
			{
				Param1:="0x00000000"
				Param2:="0x00a80163"
			}
			If ( CL_GameP = "Word_Slugger" )
			{
				Param1:="0x00000000"
				Param2:="0x00f6016e"
			}
		}

		If ( A_Index = 6 )
		{
			If ( CL_GameP = "Chicktionary" )
			{
				Param1:="0x00000000"
				Param2:="0x00df019d"
			}
			If ( CL_GameP = "Spelling_Bee" )
			{
				Param1:="0x00000000"
				Param2:="0x00c6018f"
			}
			If ( CL_GameP = "Word_Slugger" )
			{
				Param1:="0x00000000"
				Param2:="0x00fa01a6"
			}
		}

		If ( A_Index = 7 )
		{
			If ( CL_GameP = "Chicktionary" )
			{
				Param1:="0x00000000"
				Param2:="0x00de01d5"
			}
			If ( CL_GameP = "Spelling_Bee" )
			{
				Param1:="0x00000000"
				Param2:="0x00ac01c0"
			}
			If ( CL_GameP = "Word_Slugger" )
			{
				Param1:="0x00000000"
				Param2:="0x00f701dd"
			}
		}

	Loop,%CL_Loop%
	{
		PostMessage, 0x201, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONDOWN
		PostMessage, 0x202, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONUP
	}
	
	Min:="LT_MIN"
	Max:="LT_MAX"
	GoSub,Rand_Delay
	Sleep,%Delay%
}

GuiControl,1:Enable,EN
Min:="EN_MIN"
Max:="EN_MAX"
GoSub,Rand_Delay
Sleep,%Delay%

;Enter
If ( CL_GameP = "Chicktionary" )
{
	Param1:="0x00000000"
	Param2:="0x012c01e3"
}
If ( CL_GameP = "Spelling_Bee" )
{
	Param1:="0x00000000"
	Param2:="0x011301c0"
}
If ( CL_GameP = "Word_Slugger" )
{
	Param1:="0x00000000"
	Param2:="0x014501c7"
}
Loop,%CL_Loop%
{
	PostMessage, 0x201, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONDOWN
	PostMessage, 0x202, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONUP
}
Sleep,1000

GuiControl,1:Disable,EN
GuiControl,1:Enable,CL
Min:="CL_MIN"
Max:="CL_MAX"
GoSub,Rand_Delay
Sleep,%Delay%

;Clear
Loop,7
{
	PostMessage, 0x100, 0x08,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYDOWN
	PostMessage, 0x101, 0x08,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYUP
}

GuiControl,1:Disable,CL

Loop
{
	Letters:=""

pdoc:=COM_Invoke(pwb,"document")
documentElement:=COM_Invoke(pdoc,"documentElement")
innerHTML:=COM_Invoke(documentElement,"innerHTML")

StringGetPos,LPos,innerHTML,q=,R
RegExMatch(innerHtml,"[^&]+",Letters,LPos+3)

	If ( Letters <> "" )
		Break
	Sleep,1000
}

Len:=StrLen(Letters)
If ( Len = 7 )
Break
}

GPot.=Letters "|"

Loop,Parse,GPot,|
{
If ( A_LoopField = "" )
Break
GPotT:=A_Index
}

GPotN:=""
Same:=""
If ( GPotT = 3 )
{
Loop,Parse,GPot,|
{
If ( A_LoopField = "" )
	Break
If ( A_Index <> 1 )
	GPotN.=A_LoopField "|"
Current_Word:=A_LoopField
Loop,Parse,Letters
	StringReplace,Current_Word,Current_Word,%A_LoopField%
If ( Current_Word <> "" )
	Continue
Same+=1
If ( Same = 3 )
	Goto,SwitchGame
}
GPot:=GPotN
SwitchUser:=0
}

StringUpper,Letters,Letters
GuiControl,1:,ASet,%Letters%

;Grab Answers
;=======================================================
;a2zWordfinder
;=================
Url:="http://www.a2zwordfinder.com/cgi-bin/wordfinder.cgi?SearchType=Anagram&MinLetters=3&SortBy=Length&Letters=" Letters "&Search=Find+Words"

UrlDownloadToFile,%Url%,%Name%_a2z.txt
FileRead,html,%Name%_a2z.txt

RegExMatch(html,"[^\.]+",a2z)
StringReplace,a2z,a2z,`,,,1
StringReplace,a2z,a2z,%A_Space%,,1
a2z:=RegExReplace(a2z,"<[^>]+>")
a2z:=RegExReplace(a2z,"[0-9][^`n]+`n")
a2z:=RegExReplace(a2z,"[0-9].+")
StringReplace,a2z,a2z,`n,|,1

;AnagramsSolved
;=================
Url:="http://www.anagramssolved.com/anagram-solutions.html?letters=" Letters

UrlDownloadToFile,%Url%,%Name%_AS.txt
FileRead,html,%Name%_AS.txt

Pos1:=InStr(Html, "3 Letter Words")
Pos2:=InStr(Html, "</div>", false, Pos1)
Count:=Pos2 - Pos1
Count -= 10
AS:=SubStr(Html, Pos1, Count)
StringTrimLeft,AS,AS,14

AS:=RegExReplace(AS, "</li><li>[0-9]+", "")
AS:=RegExReplace(AS, "</li></ul><ul><li>[0-9]+ Letter Words", "")
StringReplace,AS,AS,%A_Space%,|,1

;WordList.txt
;=================
FileRead,CL_WordList,%A_ScriptDir%\CLX+WordList.txt

WL:=""
Loop,Parse,CL_WordList,|
{
Current_Word:=A_LoopField
Loop,Parse,Letters
StringReplace,Current_Word,Current_Word,%A_LoopField%
If ( Current_Word = "" )
WL.=A_LoopField "|"
}

Line:=WL . a2z . AS
StringUpper,Line,Line

Sort,Line,U D|
Sort,Line,Random D|

;Parse & Group Answers
;=======================================================
7_L:=""
6_L:=""
5_L:=""
4_L:=""
3_L:=""

Loop,Parse,Line,|
{
If ( A_LoopField = "" )
	Continue

Len:=StrLen(A_LoopField)

Div:=Len + 1
If ( StrLen(%Len%_L) / Div >= %Len%_Lim )
	Continue

%Len%_L .= A_LoopField "|"
%Len%_Total:=StrLen(%Len%_L) / Div
Countdown:=%Len%_Total
RegExMatch(Countdown,"[^\.]+",Countdown)
GuiControl,1:,%Len%_Lim,%Countdown%
}

;Solve Puzzle
;=======================================================
Answers:=7_L . 6_L . 5_L . 4_L . 3_L

If ( Rand = 1 )
Sort,Answers,Random D|

Loop,Parse,Answers,|
{

Current_Answer:=A_Index + 1

Loop,Parse,Answers,|
{
Next_Answer:=""
If ( Current_Answer = A_Index )
{
Next_Answer:=A_LoopField
Break
}
}

If ( Next_Answer = "" )
Next_Answer:="N/A"
GuiControl,1:,ASet,%Next_Answer%

Loop,Parse,A_LoopField
{
KCode:=%A_LoopField%_Hex
PostMessage, 0x100, %KCode%,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYDOWN
PostMessage, 0x101, %KCode%,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYUP

Min:="LT_MIN"
Max:="LT_MAX"
GoSub,Rand_Delay
Sleep,%Delay%
}

GuiControl,1:Enable,EN

Min:="EN_MIN"
Max:="EN_MAX"
GoSub,Rand_Delay
Sleep,%Delay%

;Enter
If ( CL_GameP = "Chicktionary" )
{
Param1:="0x00000000"
Param2:="0x012c01e3"
}
If ( CL_GameP = "Spelling_Bee" )
{
Param1:="0x00000000"
Param2:="0x011301c0"
}
If ( CL_GameP = "Word_Slugger" )
{
Param1:="0x00000000"
Param2:="0x014501c7"
}
Loop,%CL_Loop%
{
PostMessage, 0x201, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONDOWN
PostMessage, 0x202, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONUP
}
GuiControl,1:Disable,EN
GuiControl,1:Enable,CL

Len:=StrLen(A_LoopField)
%Len%_Total:=%Len%_Total - 1
Countdown:=%Len%_Total
RegExMatch(Countdown,"[^.]+",Countdown)
GuiControl,1:,%Len%_Lim,%Countdown%

Min:="CL_MIN"
Max:="CL_MAX"
GoSub,Rand_Delay
Sleep,%Delay%

Loop,%Len%
{
PostMessage, 0x100, 0x08,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYDOWN
PostMessage, 0x101, 0x08,, Internet Explorer_Server1, ahk_id %GuiID% ; WM_KEYUP
}

GuiControl,1:Disable,CL
}
GuiControl,1:Enable,PA

Min:="PA_MIN"
Max:="PA_MAX"
GoSub,Rand_Delay
Sleep,%Delay%

;PlayAgain
If ( CL_GameP = "Chicktionary" )
{
Param1:="0x00000000"
Param2:="0x00d70146"
}
If ( CL_GameP = "Spelling_Bee" )
{
Param1:="0x00000000"
Param2:="0x00e80132"
}
If ( CL_GameP = "Word_Slugger" )
{
Param1:="0x00000000"
Param2:="0x00f00132"
}
Loop,%CL_Loop%
{
PostMessage, 0x201, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONDOWN
PostMessage, 0x202, %Param1%, %Param2%, Internet Explorer_Server1, ahk_id %GuiID% ; WM_LBUTTONUP
}
ETime .= A_TickCount - STime "|"
PTime:=0
Loop,Parse,ETime,|
{
PTime += A_LoopField
NTimes:=A_Index
}
ATime:=PTime / ( NTimes * 1000 )
RegExMatch(ATime,"[^\.]+\...",ATime)
DTime:="| " ATime " Seconds "

GoSub,Update
Goto,Start

;End Main
;===========================================================================================================


EX: ;Side Panel Right
;==================================================================
If ( EX = 0 )
{
Gui,1:Show,w820 h355
EX:=1
EY:=0
Return
}
If ( EX = 1 )
{
Gui,1:Show,w665
EX:=0
EZ:=0
Return
}

NG:
Min:="NG_MIN"
Max:="NG_MAX"
Goto,MinMax
SG:
Min:="SG_MIN"
Max:="SG_MAX"
Goto,MinMax
LG:
Min:="LG_MIN"
Max:="LG_MAX"
Goto,MinMax
PA:
Min:="PA_MIN"
Max:="PA_MAX"
Goto,MinMax
LT:
Min:="LT_MIN"
Max:="LT_MAX"
Goto,MinMax
EN:
Min:="EN_MIN"
Max:="EN_MAX"
Goto,MinMax
CL:
Min:="CL_MIN"
Max:="CL_MAX"
Goto,MinMax

MinMax:
IniRead,%Min%,%A_ScriptDir%\Config.ini,Delay,%Min%,%A_Space%
IniRead,%Max%,%A_ScriptDir%\Config.ini,Delay,%Max%,%A_Space%
V_Min:=%Min%
V_Max:=%Max%
Gui,2:+Owner1  
Gui,1:+Disabled
Gui,2:Margin,2,2
Gui,2:Add,Text,x0 y10 w240 Center,Set your minimum and maximum delays here.`nNote: Delays are in Miliseconds. [1000ms = 1s]
Gui,2:Add,Progress,x10 y+5 w220 h1,100
Gui,2:Add,Text,x75 y+10 w60 Right,Minimum:
Gui,2:Add,Edit,x+5 yp-3 w80 r1 Center vV_Min,%V_Min%
Gui,2:Add,Text,x75 y+10 w60 Right,Maximum:
Gui,2:Add,Edit,x+5 yp-3 w80 r1 Center vV_Max,%V_Max%
Gui,2:Add,Button,xp y+20 w60 Default gSet,Set
Gui,2:Show,w240,Delay Settings - %SName%
Return

Set:
Gui,2:Submit,NoHide
2GuiClose:
Gui,1:-Disabled
Gui,2:Destroy
IniWrite,%V_Min%,%A_ScriptDir%\Config.ini,Delay,%Min%
IniWrite,%V_Max%,%A_ScriptDir%\Config.ini,Delay,%Max%
GoSub,Rand_Delay
Return

Prep_Delay:
Min:="NG_MIN"
Max:="NG_MAX"
GoSub,Rand_Delay

Min:="SG_MIN"
Max:="SG_MAX"
GoSub,Rand_Delay

Min:="LG_MIN"
Max:="LG_MAX"
GoSub,Rand_Delay

Min:="PA_MIN"
Max:="PA_MAX"
GoSub,Rand_Delay

Min:="LT_MIN"
Max:="LT_MAX"
GoSub,Rand_Delay

Min:="EN_MIN"
Max:="EN_MAX"
GoSub,Rand_Delay

Min:="CL_MIN"
Max:="CL_MAX"
GoSub,Rand_Delay
Return

Rand_Delay:
IniRead,%Min%,%A_ScriptDir%\Config.ini,Delay,%Min%,%A_Space%
IniRead,%Max%,%A_ScriptDir%\Config.ini,Delay,%Max%,%A_Space%
V_Min:=%Min%
V_Max:=%Max%
If ( V_Min = "" or V_Max = "" )
{
	GuiControl,1:,%Min%%Max%,Set ->
	Return	
}
Random,Delay,%V_Min%,%V_Max%

GuiControl,1:,%Min%%Max%,%Delay%
Return

DeC:
Gui,1:Submit,NoHide
If ( Dec = 1 )
{
GuiControl,1:Disable,DUser
GuiControl,1:Disable,DPass
Return
}
If ( Dec <> 1 )
{
GuiControl,1:Enable,DUser
GuiControl,1:Enable,DPass
Return
}
Return

EY: ;Side Panel Bottom
;==================================================================
If ( EY = 0 )
{
Gui,1:Show,w665 h405
EY:=1
EX:=0
Return
}
If ( EY = 1 )
{
Gui,1:Show,h355
EY:=0
EZ:=0
Return
}

Lim_Default:
GuiControl,1:,3_Lim,%3_LimD%
GuiControl,1:,4_Lim,%4_LimD%
GuiControl,1:,5_Lim,%5_LimD%
GuiControl,1:,6_Lim,%6_LimD%
GuiControl,1:,7_Lim,%7_LimD%
Return

EZ: ;Both Panels
;==================================================================
If ( EZ = 0 )
{
Gui,1:Show,w820 h405
EX:=1
EY:=1
EZ:=1
Return
}
If ( EZ = 1 )
{
Gui,1:Show,w665 h355
EX:=0
EY:=0
EZ:=0
Return
}

;Other
;==================================================================
Update:
Url:="http://club.live.com/Pages/Home/HomePage.aspx"
UrlDownloadToFile,%Url%,%Name%-Status.txt
FileRead,html,%Name%-Status.txt
Loop,Parse,html,`n
{
IfInString,A_LoopField,AccountGadget_Handle
{
RegExMatch(A_LoopField,">[^<]+",CL_Name)
StringTrimLeft,CL_Name,CL_Name,1
}
IfInString,A_LoopField,TicketBalance
{
RegExMatch(A_LoopField,"TicketBalance[^<]+",CTix)
StringTrimLeft,CTix,CTix,15
StringReplace,CTix,CTix,`,
}
}

If ( CL_Name = "" )
{
CL_Number-=1
Goto,Logz
}

If ( CL_Tix = "" )
STix:=CTix

ITix:=CTix-STix

If ( StrLen(ITix) > 3 )
{
StringTrimRight,ITixL,ITix,3
StringRight,ITixR,ITix,3
ITix:=ITixL "," ITixR
}

If ( StrLen(CTix) > 3 )
{
StringTrimRight,CTixL,CTix,3
StringRight,CTixR,CTix,3
CTix:=CTixL "," CTixR
}

CL_Tix:=CTix

If ( CTix > 9000 and CTix < 10000 )
CL_Tix:="OVER NINE THOUSAAAAANDD"

StringReplace,CL_GameU,CL_Game,_,%A_Space%

Loop
{
IniRead,CP_User,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_User,%A_Space%
If ( CP_User = "" )
Break
If ( CL_UserP <> CP_User )
Continue
IniWrite,%CL_Tix%,%A_ScriptDir%\Accounts.ini,Account_%A_Index%,CL_Tix
}

WinSetTitle,ahk_id %GuiID%,,[%CL_Number% / %CL_Total%] %CL_Name% | I:%ITix% C:%CL_Tix% Tickets %DTime%- %SName% %ScriptVersion%
Return

SwitchGame:
;========================================
GPot:=""
SwitchUser+=1
If ( SwitchUer = 3 )
Goto,Logz
FileAppend,[%A_Hour%:%A_Min%:%A_Sec%] Switched Game - %CL_GameP% (%Letters%)`n,%A_ScriptDir%\CBX+ActivityLog.txt
If ( CL_GameP = "Chicktionary" )
{
CL_GameP:="Spelling_Bee"
url:="http://club.live.com/Pages/Games/GamePlay.aspx?game=" CL_GameP "&mode=play"
COM_Invoke(pwb, "Navigate", url)
scs:=iWeb_complete(pwb)
Goto,Start
}
If ( CL_GameP = "Spelling_Bee" )
{
CL_GameP:="Word_Slugger"
url:="http://club.live.com/Pages/Games/GamePlay.aspx?game=" CL_GameP "&mode=play"
COM_Invoke(pwb, "Navigate", url)
scs:=iWeb_complete(pwb)
Goto,Start
}
If ( CL_GameP = "Word_Slugger" )
{
CL_GameP:="Chicktionary"
url:="http://club.live.com/Pages/Games/GamePlay.aspx?game=" CL_GameP "&mode=play"
COM_Invoke(pwb, "Navigate", url)
scs:=iWeb_complete(pwb)
Goto,Start
}

Gui_Hide:
Menu,Tray,NoIcon
	Gui,1:-ToolWindow
	WinMove,ahk_id %GuiID%,,%WX%,%WY%
Return

Donate:
GuiControl,Hide,m0
KeyWait,LButton
GuiControl,Show,m0
Msgbox,Donations can be sent via paypal to Hobs.di@gmail.com
Url:="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hobs%2edi%40gmail%2ecom&lc=US&item_name=Bots%20for%20a%20Better%20Life%21¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"
Run,%Url%
Return

Help:
Url:="http://truecheaters.com/showthread.php?t=5620"
Run,%Url%
Return

Disclaimer:
Msgbox,48,Disclaimer - %SName%,%A_Tab%%Name% is the sole property of the author. %Name% is not for sale, lease, or rent unless by the author. Do not disassemble %Name%. Do not repost %Name%, any resources used by %Name%, or any videos of %Name% unless given the approval by the author. Do not use %Name% for illegal activities. %Name% is for educational use only. If the disclaimer is disregarded the author of %Name% will not be held responsible for any actions taken against you.`n`n%A_Tab%By using %Name% you agree to these terms.
Return

Done:
If ( TSCheck = 1 )
{
WinSetTitle,ahk_id %GuiID%,,Waiting until %Hours% Hours - %Name% %ScriptVersion% by Hobdiddy.
CL_Number:=0
StringRight,TSMin,Hours,2
StringTrimRight,TSHour,Hours,2
Loop
{
If ( SDay <> A_Day )
	Break
If ( TSHour = A_Hour )
	If ( TSMin <= A_Min )
		Break
If ( TSHour < A_Hour )
	Break
Sleep,60000
}
SDay:=A_Day
Goto,Logz
}
Msgbox, Finished all accounts
ExitApp

;HotKeys
;==================================================================

Pause:
If ( P = 0 )
{
GuiControl,1:,Pause,Paused
GuiControl,1:Enable,NG
GuiControl,1:Enable,SG
GuiControl,1:Enable,LG
GuiControl,1:Enable,PA
GuiControl,1:Enable,LT
GuiControl,1:Enable,EN
GuiControl,1:Enable,CL
P:=1
Suspend
Pause,,1
Return
}
If ( P = 1 )
{
GuiControl,1:,Pause,Pause
GuiControl,1:Disable,NG
GuiControl,1:Disable,SG
GuiControl,1:Disable,LG
GuiControl,1:Disable,PA
GuiControl,1:Disable,LT
GuiControl,1:Disable,EN
GuiControl,1:Disable,CL
P:=0
Suspend
Pause,,1
Return
}
Return

GuiClose:
MsgBox,4,Confirm Close - %SName%,Are you sure you want to exit?`n`n%A_Tab%Clicking no will hide the window.
IfMsgBox,No
{
	WinGetPos,WX,WY,,,ahk_id %GuiID%
	WinMove,ahk_id %GuiID%,,-1000,-1000
	Gui,1:Hide
	Gui,1:+ToolWindow
	Gui,1:Show
	Menu,Tray,Icon
	TrayTip,%SName% %ScriptVersion%,Double click here to show the window.
	Return
}
ExitApp

Reload:
Reload

4GuiClose:
^!esc::
Exit:
ExitApp

;Functions
;==================================================================
Login(pwb, CUser, CPass)
{
	url:="http://login.live.com/logout.srf?"
	COM_Invoke(pwb, "Navigate", url)
	scs:=iWeb_complete(pwb)
	Sleep 4000
	url:="http://login.live.com/login.srf?wa=wsignin1.0&wreply=http:%2F%2Fclub.live.com"
	COM_Invoke(pwb, "Navigate", url)
	scs:=iWeb_complete(pwb)
	Sleep 3000
	COM_Invoke(pwb, "Navigate", "javascript:onForgetMe(0);")
	Sleep 1000
	SINJS:="javascript:function%20D(a,b){c=b.split('|');d=false;for(q=0;q<c.length;q++){if(c[q]==a)d=true;}return%20d;}function%20E(){f0=document.forms[0];f0['login'].value='" CUser "';f0['passwd'].value='" CPass "';}E()"
	COM_Invoke(pwb, "Navigate", SINJS)
	Sleep 1000
	COM_Invoke(pwb, "Navigate", "javascript:document.forms[0].submit()")
	scs:=iWeb_complete(pwb)
	Return
}

iWeb_complete(pwb)                  ;   returns bool for success or failure
{   
   If  pwb is not Integer         ;   test to see if we have a valid interface pointer
      ExitApp                  ;   ExitApp if we dont
   loop 10                     ;   sets limit if itenerations to 40 seconds 80*500=40000=40 secs
   {   
      If not (rdy:=COM_Invoke(pwb,"readyState") = 4)
         Break            ;   return success
      Sleep,100               ;   sleep half second between cycles
   }
   loop 80                     ;   sets limit if itenerations to 40 seconds 80*500=40000=40 secs
   {   
      If (rdy:=COM_Invoke(pwb,"readyState") = 4)
         Return    1            ;   return success
      Sleep,500               ;   sleep half second between cycles
   }
   Return 0                  ;   lets face it if it got this far it failed
}                            ;   end complete


Slingshot377
  • Guests
  • Last active:
  • Joined: --
LOL@Hobdiddy
This is NOT a small script you beast ;)

Still an AMAZING piece of work
Definitely the most complex AHK script I have seen

Fry
  • Members
  • 885 posts
  • Last active: Jan 17 2011 09:57 PM
  • Joined: 01 Nov 2007
Wow..... This is awsome for getting tickets on club live. Hope you continue development

castiron93
  • Members
  • 3 posts
  • Last active: Jun 01 2009 11:43 PM
  • Joined: 21 Apr 2009
i still love you hob!

7usabball
  • Members
  • 51 posts
  • Last active: Dec 03 2010 10:47 PM
  • Joined: 07 Jan 2009
hobs owns :)

silkcom
  • Members
  • 162 posts
  • Last active: Apr 13 2010 08:12 PM
  • Joined: 23 Jan 2008
Hob do you have the latest one (the one for clubbing)? Awesome script.

Bumblebee3
  • Members
  • 11 posts
  • Last active: Mar 07 2010 04:17 AM
  • Joined: 31 Jul 2009
cool thanks