Großes Script - viel Hilfe benötigt

05/21/2011 10:43 Ludder231#1
Hi,

ich hab hier mal ein für mich etwas größeres projekt angefangen...

ich möchte für das Spiel Diablo II einen Spammbot machen der immer in verschiedene Game-Sessions reingeht und einen Text absendet.

PHP Code:
if _Singleton("Diaspambot.exe",1) = 0 Then ;aktuell halten
    msgbox
(16, "Runtime Error", "Die exe wird bereits ausgeführt!")
    exit
endif

if 
ProcessExists("Game.exe") Then
Msgbox
(0,"Warnung","Der Process 'Game.exe' existiert bereits und muss beendet werden!" & @CRLF & _ 
""  & @CRLF & _
"Diablo II wird automatisch beendet!")
winclose("Diablo II")
if 
not @error Then
    winWaitClose
("Diablo II")
    endif
EndIf    

global 
$Input1Add, $Input2Add, $Input3Add, $listview, $radio1, $radio2, $radio3, $radio4, $radio5, $radio6, $radio7, $radio8

#RequireAdmin
#include <misc.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\ludder.luca\desktop\diaform.kxf
$Form1 = GUICreate("DBot by Ludder", 581, 428, -1, -1)
$Button1 = GUICtrlCreateButton("Run", 176, 192, 59, 25)
$Tab1 = GUICtrlCreateTab(8, 248, 561, 129)
$TabSheet1 = GUICtrlCreateTabItem("Common Log")
GUICtrlCreateTabItem("")
$Button2 = GUICtrlCreateButton("Stop", 240, 192, 59, 25)
$Button3 = GUICtrlCreateButton("Add", 304, 192, 59, 25)
$Button4 = GUICtrlCreateButton("Edit", 368, 192, 59, 25)
$Button5 = GUICtrlCreateButton("Remove", 432, 192, 59, 25)
$Button6 = GUICtrlCreateButton("Save", 496, 192, 59, 25)
$Group1 = GUICtrlCreateGroup("Profile", 16, 16, 553, 217)
$listview = GUICtrlCreateListView("Profile Names| Runs | Restarts | Status", 24, 40, 529, 136)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button7 = GUICtrlCreateButton("Exit", 496, 384, 75, 25)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
            
        case 
$button2
            winclose
("Diablo II" ,"")
            
        case 
$Button3




#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\ludder.luca\desktop\formadd.kxf
$FormAdd = GUICreate("Profile Settings", 494, 349, -1, -1)
$Label1Add = GUICtrlCreateLabel("Profile Name:", 12, 12, 67, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Input1Add = GUICtrlCreateInput("", 88, 8, 193, 21)
$Group1 = GUICtrlCreateGroup("Loader Settings", 16, 40, 465, 113)
$Label1Add = GUICtrlCreateLabel("Path:", 40, 85, 26, 17)
$Input2Add = GUICtrlCreateInput("", 72, 80, 265, 21)
$Button1Add = GUICtrlCreateButton("...", 344, 80, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Game Settings", 16, 168, 465, 121)
$Label1Add = GUICtrlCreateLabel("Account Name:", 24, 195, 75, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Input3Add = GUICtrlCreateInput("", 112, 192, 121, 21)
$Label1 = GUICtrlCreateLabel("Position", 248, 192, 41, 17)
$Radio1 = GUICtrlCreateRadio("1", 304, 192, 25, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio2 = GUICtrlCreateRadio("2", 336, 192, 25, 17)
$Radio3 = GUICtrlCreateRadio("3", 304, 216, 25, 17)
$Radio4 = GUICtrlCreateRadio("4", 336, 216, 25, 17)
$Radio5 = GUICtrlCreateRadio("5", 304, 240, 25, 17)
$Radio6 = GUICtrlCreateRadio("6", 336, 240, 25, 17)
$Radio7 = GUICtrlCreateRadio("7", 304, 264, 25, 17)
$Radio8 = GUICtrlCreateRadio("8", 336, 264, 25, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$OKAdd = GUICtrlCreateButton("OK", 400, 304, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
exit
            case 
$OKAdd
                 GUISetState
($FormAdd, @sw_hide)
                
IniWrite(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Path", guictrlread($Input2Add))
                
IniWrite(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Acc", guictrlread($Input3Add))
                
IniWrite(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Profil", guictrlread($Input1Add))
                if 
GUICtrlRead($radio1) = $GUI_CHECKED then
                IniWrite
(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Pos", guictrlread($Radio1))
                ElseIf 
GUICtrlRead($radio2) = $GUI_CHECKED then
                IniWrite
(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Pos", guictrlread($Radio2))
                ElseIf 
GUICtrlRead($radio3) = $GUI_CHECKED then
                IniWrite
(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Pos", guictrlread($Radio3))
                ElseIf 
GUICtrlRead($radio4) = $GUI_CHECKED then
                IniWrite
(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Pos", guictrlread($Radio4))
                ElseIf 
GUICtrlRead($radio5) = $GUI_CHECKED then
                IniWrite
(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Pos", guictrlread($Radio5))
                ElseIf 
GUICtrlRead($radio6) = $GUI_CHECKED then
                IniWrite
(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Pos", guictrlread($Radio6))
                ElseIf 
GUICtrlRead($radio7) = $GUI_CHECKED then
                IniWrite
(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Pos", guictrlread($Radio7))
                ElseIf 
GUICtrlRead($radio8) = $GUI_CHECKED then
                IniWrite
(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Pos", guictrlread($Radio8))
                
$item1 = GUICtrlCreateListViewItem(guictrlread($input1add)&"|"&"||", $listview)
                
                
                endif
    EndSwitch
WEnd

            
        


            
            
        
case $button1
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form22 = GUICreate("Password Dialog", 251, 93, -1, -1)
$PasswordEdit = GUICtrlCreateInput("", 8, 32, 233, 21)
$ButtonOk = GUICtrlCreateButton("OK", 86, 64, 75, 25, $BS_NOTIFY)
$ButtonCancel = GUICtrlCreateButton("Cancel", 167, 64, 75, 25, $BS_NOTIFY)
$EnterPassLabel = GUICtrlCreateLabel("Enter password", 8, 12, 77, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        case 
$ButtonOK
            GUISetState
(@sw_hide, "Password Dialog")
            
GUISetState(@SW_MINIMIZE, "DBot by Ludder")
            
Opt("SendKeyDelay", 20)
            
Run(guictrlread($input2add))
            
WinSetState("Diablo II", "", @sw_lock)
            
WinWaitActive("Diablo II") 
            
sleep(5000)
            
ControlClick("Diablo II", "", "", "Left", 1, 479, 335)
            
sleep(100)
            
ControlClick("Diablo II", "", "", "Left", 1, 479, 335)
            
sleep(500)
            
ControlSend("Diablo II", "", "", Iniread(@WindowsDir&"\DBot.ini", guictrlread($input1add), "Path", guictrlread($Input2Add)))
            
sleep(500)
            
ControlClick("Diablo II", "", "", "Left", 1, 483, 394)
            
sleep(100)
            
ControlClick("Diablo II", "", "", "Left", 1, 483, 394)
            
sleep(500)
            
ControlSend("Diablo II", "", "", guictrlread($passwordEdit))
            
sleep(300)
            
ControlClick("Diablo II", "", "", "Left", 1, 401, 466)
            
sleep(3500)
            if 
GUICtrlRead($radio1) = $GUI_CHECKED then
                ControlClick
("Diablo II", "", "", "Left", 1, 203, 148) ;checken
                sleep
(100)
                
ControlClick("Diablo II", "", "", "Left", 1, 203, 148) ;checken
            
ElseIf GUICtrlRead($radio2) = $GUI_CHECKED then
                ControlClick
("Diablo II", "", "", "Left", 1, 484, 139) ;checken
                Sleep
(100)
                
ControlClick("Diablo II", "", "", "Left", 1, 484, 139);checken
            
ElseIf gUICtrlRead($radio3) = $GUI_CHECKED then
                ControlClick
("Diablo II", "", "", "Left", 1, 218, 243);checken
                Sleep
(100)
                
ControlClick("Diablo II", "", "", "Left", 1, 218, 243);checken
            
ElseIf gUICtrlRead($radio4) = $GUI_CHECKED then
                ControlClick
("Diablo II", "", "", "Left", 1, 515, 239);checken
                Sleep
(100)
                
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);checken
                
;ElseIf gUICtrlRead($radio5) = $GUI_CHECKED then
                
;ControlClick("Diablo II", "", "", "Left", 1, 515, 239)
                ;
Sleep(100)
                ;
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);
                
            ;ElseIf 
gUICtrlRead($radio6) = $GUI_CHECKED then
                
;ControlClick("Diablo II", "", "", "Left", 1, 515, 239)
                ;
Sleep(100)
                ;
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);
            endif
                
            case 
$buttoncancel
                    
exit
        
            
    EndSwitch
WEnd
            
            
        
EndSwitch
WEnd
func _exit
()
    exit
endfunc 
1. Wie kann ich $FormAdd schließen ohne gleich das ganze srcipt zu schließen
2. Wie kann ich machen, dass bei $listview ein neues Item angelegt wird das den Namen hat von $input1add hat.


3. Wie funktioniert das mit dem Global?(In dem script werden z.B:
if GUICtrlRead($radio1) = $GUI_CHECKED then
ControlClick("Diablo II", "", "", "Left", 1, 203, 148)
sleep(100)
ControlClick("Diablo II", "", "", "Left", 1, 203, 148)

nicht ausgeführt)


4. Hat wer verbesserung Vorschläge?
05/21/2011 11:32 omer36#2
nr3 hab ich nicht ganz verstanden...


PHP Code:
If _Singleton("Diaspambot.exe", 1) = 0 Then ;aktuell halten
    MsgBox
(16, "Runtime Error", "Die exe wird bereits ausgeführt!")
    Exit
EndIf

If 
ProcessExists("Game.exe") Then
    MsgBox
(0, "Warnung", "Der Process 'Game.exe' existiert bereits und muss beendet werden!" & @CRLF & _
            
"" & @CRLF & _
            
"Diablo II wird automatisch beendet!")
    
WinClose("Diablo II")
    If 
Not @error Then
        WinWaitClose
("Diablo II")
    EndIf
EndIf

Global 
$Input1Add, $Input2Add, $Input3Add, $listview, $radio1, $radio2, $radio3, $radio4, $radio5, $radio6, $radio7, $radio8



#RequireAdmin
#include <misc.au3>
#include <ButtonConstants.au3>
#include <GUIListBox.au3>
#include <TabConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\ludder.luca\desktop\diaform.kxf
$Form1 = GUICreate("DBot by Ludder", 581, 428, -1, -1)
$Button1 = GUICtrlCreateButton("Run", 176, 192, 59, 25)
$Tab1 = GUICtrlCreateTab(8, 248, 561, 129)
$TabSheet1 = GUICtrlCreateTabItem("Common Log")
GUICtrlCreateTabItem("")
$Button2 = GUICtrlCreateButton("Stop", 240, 192, 59, 25)
$Button3 = GUICtrlCreateButton("Add", 304, 192, 59, 25)
$Button4 = GUICtrlCreateButton("Edit", 368, 192, 59, 25)
$Button5 = GUICtrlCreateButton("Remove", 432, 192, 59, 25)
$Button6 = GUICtrlCreateButton("Save", 496, 192, 59, 25)
$Group1 = GUICtrlCreateGroup("Profile", 16, 16, 553, 217)
$listview = GUICtrlCreateListView("Profile Names| Runs | Restarts | Status", 24, 40, 529, 136)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button7 = GUICtrlCreateButton("Exit", 496, 384, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\ludder.luca\desktop\formadd.kxf
$FormAdd = GUICreate("Profile Settings", 494, 349, -1, -1)
$Label1Add = GUICtrlCreateLabel("Profile Name:", 12, 12, 67, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Input1Add = GUICtrlCreateInput("", 88, 8, 193, 21)
$Group1 = GUICtrlCreateGroup("Loader Settings", 16, 40, 465, 113)
$Label1Add = GUICtrlCreateLabel("Path:", 40, 85, 26, 17)
$Input2Add = GUICtrlCreateInput("", 72, 80, 265, 21)
$Button1Add = GUICtrlCreateButton("...", 344, 80, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Game Settings", 16, 168, 465, 121)
$Label1Add = GUICtrlCreateLabel("Account Name:", 24, 195, 75, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Input3Add = GUICtrlCreateInput("", 112, 192, 121, 21)
$Label1 = GUICtrlCreateLabel("Position", 248, 192, 41, 17)
$radio1 = GUICtrlCreateRadio("1", 304, 192, 25, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$radio2 = GUICtrlCreateRadio("2", 336, 192, 25, 17)
$radio3 = GUICtrlCreateRadio("3", 304, 216, 25, 17)
$radio4 = GUICtrlCreateRadio("4", 336, 216, 25, 17)
$radio5 = GUICtrlCreateRadio("5", 304, 240, 25, 17)
$radio6 = GUICtrlCreateRadio("6", 336, 240, 25, 17)
$radio7 = GUICtrlCreateRadio("7", 304, 264, 25, 17)
$radio8 = GUICtrlCreateRadio("8", 336, 264, 25, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$OKAdd = GUICtrlCreateButton("OK", 400, 304, 75, 25)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###


#Region ### START Koda GUI section ### Form=
$Form22 = GUICreate("Password Dialog", 251, 93, -1, -1)
$PasswordEdit = GUICtrlCreateInput("", 8, 32, 233, 21)
$ButtonOk = GUICtrlCreateButton("OK", 86, 64, 75, 25, $BS_NOTIFY)
$ButtonCancel = GUICtrlCreateButton("Cancel", 167, 64, 75, 25, $BS_NOTIFY)
$EnterPassLabel = GUICtrlCreateLabel("Enter password", 8, 12, 77, 17, 0)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg 
= GUIGetMsg(1)
    Switch 
$nMsg[1]
        Case 
$Form1 ;//erste form start
            
Switch $nMsg[0]
                Case 
$GUI_EVENT_CLOSE
                    
Exit
                Case 
$Button1
                    GUISetState
(@SW_HIDE, $Form1)
                    
GUISetState(@SW_SHOW, $Form22)
                Case 
$Button2
                    WinClose
("Diablo II", "")
                Case 
$Button3
                    GUISetState
(@SW_HIDE, $Form1)
                    
GUISetState(@SW_SHOW, $FormAdd)
                Case 
$Button4
                    
;;
                Case 
$Button5
                    
;;
                Case 
$Button6
                    
;;
                Case 
$Button7
                    
Exit
            EndSwitch ;
//erste form ende
        
Case $Form22 ;//zweite form start
            
Switch $nMsg[0]
                Case 
$GUI_EVENT_CLOSE
                    GUISetState
(@SW_HIDE, $Form22)
                    
GUISetState(@SW_SHOW, $Form1)
                Case 
$ButtonOk
                    GUISetState
(@SW_HIDE, "Password Dialog")
                    
GUISetState(@SW_MINIMIZE, "DBot by Ludder")
                    
Opt("SendKeyDelay", 20)
                    
Run(GUICtrlRead($Input2Add))
                    
WinSetState("Diablo II", "", @SW_LOCK)
                    
WinWaitActive("Diablo II")
                    
Sleep(5000)
                    
ControlClick("Diablo II", "", "", "Left", 1, 479, 335)
                    
Sleep(100)
                    
ControlClick("Diablo II", "", "", "Left", 1, 479, 335)
                    
Sleep(500)
                    
ControlSend("Diablo II", "", "", IniRead(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Path", GUICtrlRead($Input2Add)))
                    
Sleep(500)
                    
ControlClick("Diablo II", "", "", "Left", 1, 483, 394)
                    
Sleep(100)
                    
ControlClick("Diablo II", "", "", "Left", 1, 483, 394)
                    
Sleep(500)
                    
ControlSend("Diablo II", "", "", GUICtrlRead($PasswordEdit))
                    
Sleep(300)
                    
ControlClick("Diablo II", "", "", "Left", 1, 401, 466)
                    
Sleep(3500)
                    If 
GUICtrlRead($radio1) = $GUI_CHECKED Then
                        ControlClick
("Diablo II", "", "", "Left", 1, 203, 148) ;checken
                        Sleep
(100)
                        
ControlClick("Diablo II", "", "", "Left", 1, 203, 148) ;checken
                    
ElseIf GUICtrlRead($radio2) = $GUI_CHECKED Then
                        ControlClick
("Diablo II", "", "", "Left", 1, 484, 139) ;checken
                        Sleep
(100)
                        
ControlClick("Diablo II", "", "", "Left", 1, 484, 139);checken
                    
ElseIf GUICtrlRead($radio3) = $GUI_CHECKED Then
                        ControlClick
("Diablo II", "", "", "Left", 1, 218, 243);checken
                        Sleep
(100)
                        
ControlClick("Diablo II", "", "", "Left", 1, 218, 243);checken
                    
ElseIf GUICtrlRead($radio4) = $GUI_CHECKED Then
                        ControlClick
("Diablo II", "", "", "Left", 1, 515, 239);checken
                        Sleep
(100)
                        
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);checken
                        
;ElseIf gUICtrlRead($radio5) = $GUI_CHECKED then
                        
;ControlClick("Diablo II", "", "", "Left", 1, 515, 239)
                        ;
Sleep(100)
                        ;
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);

                        ;ElseIf 
gUICtrlRead($radio6) = $GUI_CHECKED then
                        
;ControlClick("Diablo II", "", "", "Left", 1, 515, 239)
                        ;
Sleep(100)
                        ;
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);
                    EndIf
                Case 
$ButtonCancel
                    
Exit

            EndSwitch ;
//zweite form ende
        
Case $FormAdd ;//dritte form start
            
Switch $nMsg[0]
                Case 
$GUI_EVENT_CLOSE
                    GUISetState
(@SW_HIDE, $FormAdd)
                    
GUISetState(@SW_SHOW, $Form1)
                Case 
$OKAdd
                    GUISetState
(@SW_HIDE, $FormAdd)
                    
GUISetState(@SW_SHOW, $Form1)
                    
IniWrite(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Path", GUICtrlRead($Input2Add))
                    
IniWrite(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Acc", GUICtrlRead($Input3Add))
                    
IniWrite(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Profil", GUICtrlRead($Input1Add))
                    
$item1 = GUICtrlCreateListViewItem(GUICtrlRead($Input1Add) & "|" & "||", $listview)
                    If 
GUICtrlRead($radio1) = $GUI_CHECKED Then
                        IniWrite
(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio1))
                    ElseIf 
GUICtrlRead($radio2) = $GUI_CHECKED Then
                        IniWrite
(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio2))
                    ElseIf 
GUICtrlRead($radio3) = $GUI_CHECKED Then
                        IniWrite
(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio3))
                    ElseIf 
GUICtrlRead($radio4) = $GUI_CHECKED Then
                        IniWrite
(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio4))
                    ElseIf 
GUICtrlRead($radio5) = $GUI_CHECKED Then
                        IniWrite
(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio5))
                    ElseIf 
GUICtrlRead($radio6) = $GUI_CHECKED Then
                        IniWrite
(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio6))
                    ElseIf 
GUICtrlRead($radio7) = $GUI_CHECKED Then
                        IniWrite
(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio7))
                    ElseIf 
GUICtrlRead($radio8) = $GUI_CHECKED Then
                        IniWrite
(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio8))
                    EndIf

            EndSwitch ;
//dritte form ende
    
EndSwitch
WEnd



Func _exit
()
    Exit
EndFunc   ;==>_exit 
falls noch was nicht stimmt sag bescheid
05/21/2011 11:47 Ludder231#3
DANKE! für die schnelle und perfekte lösung aller meiner Probleme :D

Bloß wie mach ich das das was in der ini gespeichert wurde jz wieder in Item 1 angezeigt wird wenn man die exe neu startet? Also den Profil name?
05/21/2011 13:46 KDeluxe#4
Input:
PHP Code:
GUICtrlCreateInput(IniRead(), ...) 
;
oder:
GUICtrlSetData($Input, IniRead()) 
Radio:
PHP Code:
GUICtrlCreateRadio()
GUICtrlSetState(-1, IniRead()) ;"default" = 0 oder 4 
05/21/2011 15:29 Ludder231#5
Hier ist jz das script. Es geht :D
PHP Code:
If _Singleton("Diaspambot.exe", 1) = 0 Then ;aktuell halten
    MsgBox
(16, "Runtime Error", "Die exe wird bereits ausgeführt!")
    Exit
EndIf

if 
ProcessExists("Game.exe") Then
    MsgBox
(0, "Warnung", "Der Process 'Game.exe' existiert bereits und muss beendet werden!" & @CRLF & _
            
"" & @CRLF & _
            
"Diablo II wird automatisch beendet!")
    
WinClose("Diablo II")
    If 
Not @error Then
        WinWaitClose
("Diablo II")
    EndIf
EndIf

Global 
$Input1Add, $Input2Add, $Input3Add, $listview, $radio1, $radio2, $radio3, $radio4, $radio5, $radio6, $radio7, $radio8, $item1



#RequireAdmin
#Include <File.au3>

#include <misc.au3>
#include <ButtonConstants.au3>
#include <GUIListBox.au3>
#include <TabConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\ludder.luca\desktop\diaform.kxf
$Form1 = GUICreate("DBot by Ludder", 581, 428, -1, -1)
$Button1 = GUICtrlCreateButton("Run", 176, 192, 59, 25)
$Tab1 = GUICtrlCreateTab(8, 248, 561, 129)
$TabSheet1 = GUICtrlCreateTabItem("Common Log")
GUICtrlCreateTabItem("")
$Button2 = GUICtrlCreateButton("Stop", 240, 192, 59, 25)
$Button3 = GUICtrlCreateButton("Add", 304, 192, 59, 25)
$Button4 = GUICtrlCreateButton("Edit", 368, 192, 59, 25)
$Button5 = GUICtrlCreateButton("Remove", 432, 192, 59, 25)
$Button6 = GUICtrlCreateButton("Save", 496, 192, 59, 25)
$Group1 = GUICtrlCreateGroup("Profile", 16, 16, 553, 217)
$listview = GUICtrlCreateListView("Profile Names| Runs | Restarts | Status", 24, 40, 529, 136)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button7 = GUICtrlCreateButton("Exit", 496, 384, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\ludder.luca\desktop\formadd.kxf
$FormAdd = GUICreate("Profile Settings", 494, 349, -1, -1)
$Label1Add = GUICtrlCreateLabel("Profile Name:", 12, 12, 67, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Input1Add = GUICtrlCreateInput("", 88, 8, 193, 21)
$Group1 = GUICtrlCreateGroup("Loader Settings", 16, 40, 465, 113)
$Label1Add = GUICtrlCreateLabel("Path:", 40, 85, 26, 17)
$Input2Add = GUICtrlCreateInput("", 72, 80, 265, 21)
$Button1Add = GUICtrlCreateButton("...", 344, 80, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Game Settings", 16, 168, 465, 121)
$Label1Add = GUICtrlCreateLabel("Account Name:", 24, 195, 75, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Input3Add = GUICtrlCreateInput("", 112, 192, 121, 21)
$Label1 = GUICtrlCreateLabel("Position", 248, 192, 41, 17)
$radio1 = GUICtrlCreateRadio("1", 304, 192, 25, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$radio2 = GUICtrlCreateRadio("2", 336, 192, 25, 17)
$radio3 = GUICtrlCreateRadio("3", 304, 216, 25, 17)
$radio4 = GUICtrlCreateRadio("4", 336, 216, 25, 17)
$radio5 = GUICtrlCreateRadio("5", 304, 240, 25, 17)
$radio6 = GUICtrlCreateRadio("6", 336, 240, 25, 17)
$radio7 = GUICtrlCreateRadio("7", 304, 264, 25, 17)
$radio8 = GUICtrlCreateRadio("8", 336, 264, 25, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$OKAdd = GUICtrlCreateButton("OK", 400, 304, 75, 25)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###


#Region ### START Koda GUI section ### Form=
$Form22 = GUICreate("Password Dialog", 251, 93, -1, -1)
$PasswordEdit = GUICtrlCreateInput("", 8, 32, 233, 21)
$ButtonOk = GUICtrlCreateButton("OK", 86, 64, 75, 25, $BS_NOTIFY)
$ButtonCancel = GUICtrlCreateButton("Cancel", 167, 64, 75, 25, $BS_NOTIFY)
$EnterPassLabel = GUICtrlCreateLabel("Enter password", 8, 12, 77, 17, 0)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###



While 1
    $nMsg 
= GUIGetMsg(1)
    Switch 
$nMsg[1]
    Case 
$Form1
        
            
Switch $nMsg[0]
                
                Case 
$GUI_EVENT_CLOSE
                    
Exit
                Case 
$Button1
                    
                    GUISetState
(@SW_HIDE, $Form1)
                    
GUISetState(@SW_SHOW, $Form22)
                Case 
$Button2
                    WinClose
("Diablo II", "")
                Case 
$Button3
                    GUISetState
(@SW_HIDE, $Form1)
                    
GUISetState(@SW_SHOW, $FormAdd)
                Case 
$Button4
                    
;;
                Case 
$Button5
                    
;;
                Case 
$Button6
                    
;;
                Case 
$Button7
                    
Exit
                
                    
            EndSwitch 
        Case 
$Form22 
            
Switch $nMsg[0]
                Case 
$GUI_EVENT_CLOSE
                    GUISetState
(@SW_HIDE, $Form22)
                    
GUISetState(@SW_SHOW, $Form1)
                Case 
$ButtonOk
                    GUISetState
(@SW_HIDE, "Password Dialog")
                    
GUISetState(@SW_MINIMIZE, "DBot by Ludder")
                    
Opt("SendKeyDelay", 20)
                    
                    
Run(GUICtrlRead($Input2Add)&" -skiptobnet -w")
                    if @
error Then
                        msgbox
(16, "", "File doesn't exist")
                        endif
                    
WinSetState("Diablo II", "", @SW_LOCK)
                    
                    
WinWaitActive("Diablo II")
                    
Sleep(5000)
                    
ControlClick("Diablo II", "", "", "Left", 1, 479, 335)
                    
Sleep(100)
                    
ControlClick("Diablo II", "", "", "Left", 1, 479, 335)
                    
Sleep(500)
                    
ControlSend("Diablo II", "", "", IniRead(@WindowsDir & "\DBot.ini", GUICtrlRead($Input1Add), "Acc", GUICtrlRead($Input3Add)))
                    
Sleep(500)
                    
ControlClick("Diablo II", "", "", "Left", 1, 483, 394)
                    
Sleep(100)
                    
ControlClick("Diablo II", "", "", "Left", 1, 483, 394)
                    
Sleep(500)
                    
ControlSend("Diablo II", "", "", GUICtrlRead($PasswordEdit))
                    
Sleep(300)
                    
ControlClick("Diablo II", "", "", "Left", 1, 401, 466)
                    
Sleep(3500)
                    If 
GUICtrlRead($radio1) = $GUI_CHECKED Then
                        ControlClick
("Diablo II", "", "", "Left", 1, 203, 148) ;checken
                        Sleep
(100)
                        
ControlClick("Diablo II", "", "", "Left", 1, 203, 148) ;checken
                    
ElseIf GUICtrlRead($radio2) = $GUI_CHECKED Then
                        ControlClick
("Diablo II", "", "", "Left", 1, 484, 139) ;checken
                        Sleep
(100)
                        
ControlClick("Diablo II", "", "", "Left", 1, 484, 139);checken
                    
ElseIf GUICtrlRead($radio3) = $GUI_CHECKED Then
                        ControlClick
("Diablo II", "", "", "Left", 1, 218, 243);checken
                        Sleep
(100)
                        
ControlClick("Diablo II", "", "", "Left", 1, 218, 243);checken
                    
ElseIf GUICtrlRead($radio4) = $GUI_CHECKED Then
                        ControlClick
("Diablo II", "", "", "Left", 1, 515, 239);checken
                        Sleep
(100)
                        
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);checken
                        
;ElseIf gUICtrlRead($radio5) = $GUI_CHECKED then
                        
;ControlClick("Diablo II", "", "", "Left", 1, 515, 239)
                        ;
Sleep(100)
                        ;
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);

                        ;ElseIf 
gUICtrlRead($radio6) = $GUI_CHECKED then
                        
;ControlClick("Diablo II", "", "", "Left", 1, 515, 239)
                        ;
Sleep(100)
                        ;
ControlClick("Diablo II", "", "", "Left", 1, 515, 239);
                    EndIf
                    
                    
sleep(1500)
                    
ControlClick("Diablo II", "", "", "Left", 1, 91, 468)
                    for 
$i = 1 to 100
                    sleep
(2000)
                    
ControlClick("Diablo II", "", "", "Left", 1, 709, 463)
                    
sleep(5000)
                    
ControlClick("Diablo II", "", "", "left", 1, 470, 232)
                    
sleep(100)
                    
ControlClick("Diablo II", "", "", "left", 1, 470, 232)
                    
sleep(6000)
                    
ControlSend("Diablo II", "", "", "{enter}")
                    
sleep(200)
                    
ControlSend("Diablo II", "", "", "Cxy3.com")
                    
sleep(600)
                    
ControlSend("Diablo II", "", "", "{enter}")
                    
sleep(10000)
                    
ControlSend("Diablo II", "", "", "{ESC}")
                    
sleep(200)
                    
Controlclick("Diablo II", "", "", "Left", 1, 401, 258)
                    
sleep(60000)
                
Next
                
exit
                    
                    
                Case 
$ButtonCancel
                    
Exit

            EndSwitch 
        Case 
$FormAdd 
            
Switch $nMsg[0]
                Case 
$GUI_EVENT_CLOSE
                    GUISetState
(@SW_HIDE, $FormAdd)
                    
GUISetState(@SW_SHOW, $Form1)
                    
                case 
$button1add
                    $fileopen 
= FileOpenDialog("Auswählen", @DesktopCommonDir & "\", "Diablo II Game.exe(*Game.exe;)", 1 + 4)
                    guictrlsetdata(
$input2add, $fileopen)
                Case 
$OKAdd
                    GUISetState(@SW_HIDE, 
$FormAdd)
                    GUISetState(@SW_SHOW, 
$Form1)
                    IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Path", GUICtrlRead($Input2Add))
                    IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Acc", GUICtrlRead($Input3Add))
                    IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Profil", GUICtrlRead($Input1Add))
                    
$item1 = GUICtrlCreateListViewItem(GUICtrlRead($Input1Add) & "|"& "||", $listview) ; runs eintragen lassen...
                    If GUICtrlRead(
$radio1) = $GUI_CHECKED Then
                        IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio1))
                    ElseIf GUICtrlRead(
$radio2) = $GUI_CHECKED Then
                        IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio2))
                    ElseIf GUICtrlRead(
$radio3) = $GUI_CHECKED Then
                        IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio3))
                    ElseIf GUICtrlRead(
$radio4) = $GUI_CHECKED Then
                        IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio4))
                    ElseIf GUICtrlRead(
$radio5) = $GUI_CHECKED Then
                        IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio5))
                    ElseIf GUICtrlRead(
$radio6) = $GUI_CHECKED Then
                        IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio6))
                    ElseIf GUICtrlRead(
$radio7) = $GUI_CHECKED Then
                        IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio7))
                    ElseIf GUICtrlRead(
$radio8) = $GUI_CHECKED Then
                        IniWrite(@WindowsDir & "
\DBot.ini", GUICtrlRead($Input1Add), "Pos", GUICtrlRead($radio8))
                    EndIf

            EndSwitch 
    EndSwitch
WEnd



Func _exit()
    Exit
EndFunc 
05/22/2011 14:01 Ludder231#6
Quote:
Originally Posted by KillerDeluxe View Post
Input:
PHP Code:
GUICtrlCreateInput(IniRead(), ...) 
;
oder:
GUICtrlSetData($Input, IniRead()) 
Radio:
PHP Code:
GUICtrlCreateRadio()
GUICtrlSetState(-1, IniRead()) ;"default" = 0 oder 4 
Ja aber was ist denn wenn es keinen festen Wert zum asulesen gibt, also wenn der immer anders heißt?

Code:
[1312312] <- soll ausgelesen werden(heißt aber immer anders, je nachdem wie der Profilname heißt den man eingegeben hat)
Path=E:\bla.exe
Acc=Jonny
Profil=1312312
Pos=1
05/22/2011 14:15 KDeluxe#7
IniReadSectionNames()

Den Rest müsstest du mit der Hilfe schaffen.