Snarg Posted July 31, 2004 Share Posted July 31, 2004 (edited) This application allows you to build a 'mute list' in Diablo in order to automaticly mute known spammers. expandcollapse popupAutoItSetOption ("SendKeyDelay", 10) $SettingsFile = @SCRIPTDIR & '\Settings.ini' SplashTextOn ('ShutUp 2.0', 'ShutUp 2.0 by Snarg (Supa.Snarg@gmail.com)', 200, 75) Sleep (5000) SplashOff () WinWaitActive ( "Diablo II") ;====== Main Body ======================= While 1 $MuteNames = HotKeySet ("{PGUP}", "ShutUp") $AddNames = HotKeySet ("{INS}", "NewNames") $RemoveName = HotKeySet ("{PGDN}", "DelName") Select Case $MuteNames = 0 ShutUp () Case $AddNames = 0 NewNames () Case $RemoveName = 0 DelName () Case WinWaitClose ("Diablo II") IamDone () EndSelect WEnd ; =========== Subroutines =============== Func ShutUp () WinWaitActive ("Diablo II") Local $A, $I, $File $NumberOfNames = IniRead ($SettingsFile, 'Settings', 'NumberOfNames', "ERROR") $FileHandle = FileOpen ("ShutUpList.txt", 0) If $File = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $A = 1 For $I = 1 to $NumberOfNames $Name = FileReadLine ($FileHandle, $A) Send ("/squelch " & $Name & '{ENTER}') Sleep (500) $A = $A + 1 Next FileClose ($FileHandle) EndFunc ;======================================================================== Func NewNames () Local $File $NumberOfNames = IniRead ($SettingsFile, 'Settings', 'NumberOfNames', "ERROR") $AddName = InputBox ("Add Name", "Enter the name to add:", "") If $AddName = 1 Then EndIf $FileHandle = FileOpen ("ShutUpList.txt", 1) If $File = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine ($FileHandle, @LF & $AddName) FileClose ($FileHandle) $NumberOfNames = $NumberOfNames + 1 IniWrite ($SettingsFile, 'Settings', 'NumberOfNames', $NumberOfNames) WinActivate ("Diablo II") EndFunc ;======================================================================== Func DelName () Local $A, $I, $File, $Line $NumberOfNames = IniRead ($SettingsFile, 'Settings', 'NumberOfNames', "ERROR") $RemName = InputBox ("Delete Name", "Enter the name to be deleted:", "") $Count = 0 $FileHandle = FileOpen ("ShutUpList.txt", 0) If $File = -1 Then MsgBox (0, "Error", "Unable to open file.") Exit EndIf $File2 = FileOpen ("TempNameList.txt", 2) If $File2 = -1 Then MsgBox (0, "Error", "Unable to open file.") Exit EndIf While 1 $SearchLine = FileReadLine ($FileHandle) If @error = -1 Then ExitLoop If $SearchLine <> "" Then If $SearchLine <> $RemName Then If $Count = 0 Then FileWrite ($File2, $SearchLine) Else FileWrite ($File2, @CRLF & $SearchLine) EndIf $Count = $Count + 1 Else $Out = MsgBox (4, $SearchLine &" found","Delete?") If $out=7 Then If $Count = 0 Then FileWrite ($File2, $SearchLine) Else FileWrite ($File2, @CRLF & $SearchLine) EndIf $Count = $Count + 1 EndIf EndIf EndIf Wend FileClose ($FileHandle) FileClose ($File2) FileCopy ("TempNameList.txt", "ShutUpList.txt", 1) FileDelete ("TempNameList.txt") $NumberOfNames = $Count IniWrite ($SettingsFile, 'Settings', 'NumberOfNames', $NumberOfNames) WinActivate ("Diablo II") EndFunc ;======================================================================== Func IamDone () Exit EndFunc Edited July 5, 2006 by Snarg A little reading goes a long way. Post count means nothing. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now