Jump to content

Script Help


Sardith
 Share

Recommended Posts

#include <GUIConstants.au3>

Global $Directory

;Name
GUICreate("Darkages Spammer", 297, 258, -1, -1, -1)

;Min/Max/Close
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

;State when ran 
GUISetState(@SW_SHOW)

;Check if you added a friendlist
$exist = RegRead("HKLM\SOFTWARE", "DAfriendlist")
If $exist = "" Then
    Directory()
Else
EndIf

;Min/Max/Close Funcations
Func SpecialEvents()
  
    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE
            
            Exit
           
        Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE
            
        Case @GUI_CTRLID = $GUI_EVENT_RESTORE
               
    EndSelect
    
EndFunc


;Options
Opt("GUICoordMode",1)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)


;Buttons & Labels; with functions
GUICtrlCreateButton("Change Friendlist Directory", 65, 198, 170, 25)
GUICtrlSetOnEvent(-1, "Directory")

GUICtrlCreateLabel("Insert = Spammer", 107,  245, 177 , 13)

Func Directory()
$DAlist= FileOpenDialog("Choose Friendlist directory", "C:\Program Files\KRU\Dark Ages", "(*.cfg)", 1 + 2, "Friendlist.cfg")

If @error Then
    MsgBox(4096,"Path Error","No Friendlist.cfg chosen.")
Else
    $Directory = StringReplace($DAlist, "|", @CRLF)
    
    RegWrite("HKLM\SOFTWARE", "DAfriendlist", "REG_SZ", $Directory)
    
    MsgBox(4096,"Chosen Path","Click on Change Friendlist Directory, to change it." & @CRLF & $Directory)
EndIf
EndFunc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$hWnd = WinGetHandle("Darkages")
$Message = "Looking for Group."

HotKeySet("{INSERT}", "Spam")



Func Spam()
$file = FileOpen($Directory, 0)
   ;add above
    For $i=1 To 20
    $Name = FileReadLine($file, $i)
    Sleep(10)
    If $Name = "" Then
    Sleep(100)
    Else
_SendWhisper($hWnd, $Name, $Message) ; Sends it to the friends that exist on your friends list.
Sleep(100)
EndIf
Next
EndFunc
 

While 1
    Sleep(100)
WEnd

Func OnAutoItExit()
FileClose($Directory)
EndFunc

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Shynd's post Message (Whats needed)
Func _MakeLong($LoWord, $HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc

Func _SendKeys($hWnd, $keys)
    If $hWnd <= 0 Or StringLen($keys) = 0 Then
        SetError(-1)
        Return False
    EndIf
    
    $keys = StringUpper($keys)
    
    $keys = StringReplace($keys, "`", Chr(0xC0))
    $keys = StringReplace($keys, "~", Chr(0xC0))
    $keys = StringReplace($keys, "-", Chr(0xBD))
    $keys = StringReplace($keys, "=", Chr(0xBB))
    $keys = StringReplace($keys, "{ENTER}", Chr(0xD))
    $keys = StringReplace($keys, "{TAB}", Chr(0x9))
    $keys = StringReplace($keys, "{ESC}", Chr(0x1B))
    $keys = StringReplace($keys, "{F5}", Chr(0x74))
    $keys = StringReplace($keys, "{F12}", Chr(0x7B))
    $keys = StringReplace($keys, "{SHIFT}", "+")
    
    Local $i, $ret
    Local $shiftdown = False
    
    For $i = 1 To StringLen($keys)
        If StringMid($keys, $i, 1) = "+" Then
            DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x002A0001)
            DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x402A0001)
            $shiftdown = True
            Sleep(1)
            ContinueLoop
        Else
            $ret = DllCall("user32.dll", "int", "MapVirtualKey", "int", Asc(StringMid($keys, $i, 1)), "int", 0)
            If IsArray($ret) Then
                DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]))
                Sleep(1)
                DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]) + 0xC0000000)
                Sleep(1)
            EndIf
        EndIf
        If $shiftdown Then
            DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", 0x10, "long", 0xC02A0001)
            Sleep(1)
            $shiftdown = False
        EndIf
    Next
    
    Return True
EndFunc

Func _SendText($hWnd, $str)
    If $hWnd = 0 Or StringLen($str) = 0 Then
        SetError(-1)
        Return
    EndIf
    
    For $i = 1 To StringLen($str)
        DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x102, "int", Asc(StringMid($str, $i, 1)), "long", 0)
        Sleep(1)
    Next
EndFunc

Func _SendWhisper($hWnd, $name, $str)
    If $hWnd = 0 Or StringLen($str) = 0 Or StringLen($name) = 0 Then
        SetError(-1)
        Return
    EndIf
    
    _SendKeys($hWnd, "{ESC}+" & Chr(0xDE))
    Sleep(50)
    _SendText($hWnd, $name)
    Sleep(1)
    _SendKeys($hWNd, "{ENTER}")
    Sleep(30)
    _SendText($hWnd, $str)
    Sleep(30)
    _SendKeys($hWnd, "{ENTER}")
EndFunc

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

It syntax's fine, when I hit the "Change Friendlist Directory", select my directory. Then hit Insert with Darkages open, it just ends the script. It ends with no errors.

Any help would be great.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

It syntax's fine, when I hit the "Change Friendlist Directory", select my directory. Then hit Insert with Darkages open, it just ends the script. It ends with no errors.

Any help would be great.

I wish I could help you, but all I know is one reason that you potentially aren't getting the help you want...

@OP,

For future reference, when posting a thread , make its title remotely pertinent to question/subject you are posting about.

This is the support section of the forum, its meant for questions, so naming a thread "I Have A Problem", or "Question", or "Help Me My, Code Doesn't Work", or "Noob Requesting Assistance" Is redundant, and makes it harder for anyone else who has the same/similar questions as you to find the answer by searching the forums, which in turn means people often have to make extra threads and people who are answering the threads just end up repeating themselves several times over.

It is counter-productive.

Link to comment
Share on other sites

Paulie, are you after a moderator position? I don't even know whats wrong with the script. So, would you be so kind as to tell me what the topic name should be?

Everything has checked out, when I look it over, and syntax the script.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Paulie, are you after a moderator position?

No. As cool as it would be to have the authority, way to much work for me...

I don't even know whats wrong with the script.

What part of it doesn't work? Does it not send the keys? does it immediately quit?

Lets be a little more informative.

So, would you be so kind as to tell me what the topic name should be?

I'd be happy to recommend a better title, but so far, we don't even know what that script is supposed to do... :whistle:

Figure that out, and you pretty much got your thread title too.

Maybe the game you are spamming (GUICreate("Darkages Spammer")is protected by GameGuard?

Link to comment
Share on other sites

The game, has no protection of any sort. It works my beta. It has to do with the gui being added.

Beta without the GUI works fine..

Global $file = FileOpen("C:\Program Files\KRU\Dark Ages\Boostedd\Friendlist.cfg", 0)
$hWnd = WinGetHandle("Darkages")
$Message = "Looking for Group."

HotKeySet("{INSERT}", "Spam")

If $file = -1 Then
    Exit
EndIf

Func Spam()
    For $i=1 To 20
    $Name = FileReadLine($file, $i)
    Sleep(10)
    If $Name = "" Then
    Sleep(100)
    Else
_SendWhisper($hWnd, $Name, $Message) ; Sends it to the friends that exist on your friends list.
Sleep(100)
EndIf
Next
EndFunc
 

While 1
    Sleep(100)
WEnd

Func OnAutoItExit()
FileClose($file)
EndFunc

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Shynd's post Message (Whats needed)
Func _MakeLong($LoWord, $HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc

Func _SendKeys($hWnd, $keys)
    If $hWnd <= 0 Or StringLen($keys) = 0 Then
        SetError(-1)
        Return False
    EndIf
    
    $keys = StringUpper($keys)
    
    $keys = StringReplace($keys, "`", Chr(0xC0))
    $keys = StringReplace($keys, "~", Chr(0xC0))
    $keys = StringReplace($keys, "-", Chr(0xBD))
    $keys = StringReplace($keys, "=", Chr(0xBB))
    $keys = StringReplace($keys, "{ENTER}", Chr(0xD))
    $keys = StringReplace($keys, "{TAB}", Chr(0x9))
    $keys = StringReplace($keys, "{ESC}", Chr(0x1B))
    $keys = StringReplace($keys, "{F5}", Chr(0x74))
    $keys = StringReplace($keys, "{F12}", Chr(0x7B))
    $keys = StringReplace($keys, "{SHIFT}", "+")
    
    Local $i, $ret
    Local $shiftdown = False
    
    For $i = 1 To StringLen($keys)
        If StringMid($keys, $i, 1) = "+" Then
            DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x002A0001)
            DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x402A0001)
            $shiftdown = True
            Sleep(1)
            ContinueLoop
        Else
            $ret = DllCall("user32.dll", "int", "MapVirtualKey", "int", Asc(StringMid($keys, $i, 1)), "int", 0)
            If IsArray($ret) Then
                DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]))
                Sleep(1)
                DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]) + 0xC0000000)
                Sleep(1)
            EndIf
        EndIf
        If $shiftdown Then
            DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", 0x10, "long", 0xC02A0001)
            Sleep(1)
            $shiftdown = False
        EndIf
    Next
    
    Return True
EndFunc

Func _SendText($hWnd, $str)
    If $hWnd = 0 Or StringLen($str) = 0 Then
        SetError(-1)
        Return
    EndIf
    
    For $i = 1 To StringLen($str)
        DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x102, "int", Asc(StringMid($str, $i, 1)), "long", 0)
        Sleep(1)
    Next
EndFunc

Func _SendWhisper($hWnd, $name, $str)
    If $hWnd = 0 Or StringLen($str) = 0 Or StringLen($name) = 0 Then
        SetError(-1)
        Return
    EndIf
    
    _SendKeys($hWnd, "{ESC}+" & Chr(0xDE))
    Sleep(50)
    _SendText($hWnd, $name)
    Sleep(1)
    _SendKeys($hWNd, "{ENTER}")
    Sleep(30)
    _SendText($hWnd, $str)
    Sleep(30)
    _SendKeys($hWnd, "{ENTER}")
EndFunc

Works great. Add a gui, and the ability to select the directory, instead of putting it in the variable "$file = FileOpen("C:\Program Files\KRU\Dark Ages\Boostedd\Friendlist.cfg", 0)"

The gui verison, you can select the directory. Then you hit the Hotkey, and it just ends the script. Yes, you are correct, I needed to add more detail.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...