Jump to content

Last Question


Recommended Posts

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("Diablo II - Title!", 312, 81,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("D2 Normal", 30, 50, 100, 23)
$Button_2 = GuiCtrlCreateButton("D2 Window", 170, 50, 100, 23)
$Label_3 = GuiCtrlCreateLabel("Welkom Jimmy!", 30, 10, 110, 20)
$Checkbox_4 = GuiCtrlCreateCheckbox("Auto Login", 200, 0, 90, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_2
        If FileExists("C:\Program Files\Diablo II\Diablo II.exe") Then
            Run(@ProgramfilesDir & "\Diablo II\Diablo II.exe -w -skiptobnet", @ProgramfilesDir & "\Diablo II", @SW_MAXIMIZE)
        Else
            MsgBox(64,"Sorry", "The file was not found", 3)
        EndIf
            Case $msg = $Button_1
        If FileExists("C:\Program Files\Diablo II\Diablo II.exe") Then
            Run(@ProgramfilesDir & "\Diablo II\Diablo II.exe -skiptobnet", @ProgramfilesDir & "\Diablo II", @SW_MAXIMIZE)
        Else
            MsgBox(64,"Sorry", "The file was not found", 3)
        EndIf
;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

now i want if some1 press at the 'Auto-Login' button ( Checkbox_4 ) that it will autologin WITH controlsend which is:

AutoItSetOption("WinTitleMatchMode", 4) 

; Get the handle of the diablo window 
$handle = WinGetHandle("classname=Diablo II", "") 
If @error Then 
    MsgBox(4096, "Error", "Could not find correct window.") 
    exit 
Else 
$i = 0
Do
    
    


;   MsgBox(4096, "success", "The window handle is " & $handle) 
   ; Send some text directly to this window's edit control 
   ;ControlClick("handle=" & $handle, "", "", "left") 
    Opt("SendKeyDelay",35)
    ControlSend("handle=" & $handle, "", "", "{TAB}") 
    ControlSend("handle=" & $handle, "", "", "Accountname") 
    ControlSend("handle=" & $handle, "", "", "{TAB}")
    ControlSend("handle=" & $handle, "", "", "Password")
    ControlSend("handle=" & $handle, "", "", "{ENTER}")  
    $i = $i + 1   
    Until $i = 1

EndIf 

exit

well thats the last thing for today thnx :D

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
Share on other sites

Hey, on the previous topics i've read, i saw that you're quite unexperienced with coding? U need to script yourself instead of other people do your job :/, if you want something but it's too high for you, ask it instead of spamming and creating lots of topics... :D

For help or to understand more about Autoit, you should open SciTE and then press F1 and write MsgBox or GUI. There's alot of information there. I just began 3 days ago and i already can make a few Gui's..

- ImMenSe

Link to comment
Share on other sites

well maybe you think i dont try something,, but i already tried:

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("Diablo II - Title!", 312, 81,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("D2 Normal", 30, 50, 100, 23)
$Button_2 = GuiCtrlCreateButton("D2 Window", 170, 50, 100, 23)
$Label_3 = GuiCtrlCreateLabel("Welkom Jimmy!", 30, 10, 110, 20)
$Checkbox_4 = GuiCtrlCreateCheckbox("Auto Login", 200, 0, 90, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_2
        If FileExists("C:\Program Files\Diablo II\Diablo II.exe") Then
            Run(@ProgramfilesDir & "\Diablo II\Diablo II.exe -w -skiptobnet", @ProgramfilesDir & "\Diablo II", @SW_MAXIMIZE)
        Else
            MsgBox(64,"Sorry", "The file was not found", 3)
        EndIf
            Case $msg = $Button_1
        If FileExists("C:\Program Files\Diablo II\Diablo II.exe") Then
            Run(@ProgramfilesDir & "\Diablo II\Diablo II.exe -skiptobnet", @ProgramfilesDir & "\Diablo II", @SW_MAXIMIZE)
        Else
            MsgBox(64,"Sorry", "The file was not found", 3)
        EndIf
    Case $msg = $Checkbox_4
        Then
AutoItSetOption("WinTitleMatchMode", 4)

; Get the handle of the diablo window
$handle = WinGetHandle("classname=Diablo II", "")
If @error Then
    MsgBox(4096, "Error", "Could not find correct window.")
    exit
Else
$i = 0
Do
    
    


;   MsgBox(4096, "success", "The window handle is " & $handle)
; Send some text directly to this window's edit control
;ControlClick("handle=" & $handle, "", "", "left")
    Opt("SendKeyDelay",35)
    ControlSend("handle=" & $handle, "", "", "{TAB}")
    ControlSend("handle=" & $handle, "", "", "Accountname")
    ControlSend("handle=" & $handle, "", "", "{TAB}")
    ControlSend("handle=" & $handle, "", "", "Password")
    ControlSend("handle=" & $handle, "", "", "{ENTER}")  
    $i = $i + 1  
    Until $i = 1

EndIf

exit
;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

but well that dont work so then i just need help.

sorry, that i just started with Autoit. :/

and thats why they builded Forums!

Edited by aceloc

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
Share on other sites

This should do the trick.... at least you did "try"

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

Opt("SendKeyDelay", 35)
Opt("WinTitleMatchMode", 4)

$checked = IniRead("Setup.ini", "Settings", "AutoLoad", "0")

GUICreate("Diablo II - Title!", 312, 81, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GUICtrlCreateButton("D2 Normal", 30, 50, 100, 23)
$Button_2 = GUICtrlCreateButton("D2 Window", 170, 50, 100, 23)
$Label_3 = GUICtrlCreateLabel("Welkom Jimmy!", 30, 10, 110, 20)
$Checkbox_4 = GUICtrlCreateCheckbox("Auto Login", 200, 0, 90, 30)
If $checked = 1 Then 
    GUICtrlSetState(-1, $GUI_CHECKED)
    Log_in()
EndIf
GUISetState()


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            If FileExists("C:\Program Files\Diablo II\Diablo II.exe") Then
                Run(@ProgramFilesDir & "\Diablo II\Diablo II.exe -w -skiptobnet", @ProgramFilesDir & "\Diablo II", @SW_MAXIMIZE)
            Else
                MsgBox(64, "Sorry", "The file was not found", 3)
            EndIf
        Case $msg = $Button_1
            If FileExists("C:\Program Files\Diablo II\Diablo II.exe") Then
                Run(@ProgramFilesDir & "\Diablo II\Diablo II.exe -skiptobnet", @ProgramFilesDir & "\Diablo II", @SW_MAXIMIZE)
            Else
                MsgBox(64, "Sorry", "The file was not found", 3)
            EndIf
        Case $msg = $Checkbox_4
            If BitAND(GUICtrlRead($Checkbox_4), $GUI_CHECKED) = $GUI_CHECKED Then
                IniWrite("Setup.ini", "Settings", "AutoLoad", "1")
                Log_in()
            Else
                IniWrite("Setup.ini", "Settings", "AutoLoad", "0")
            EndIf
          ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

; ---------------- Functions --------------------

Func Log_in()
    
  ; Get the handle of the diablo window
    $handle = WinGetHandle("classname=Diablo II", "")
    If @error Then
        MsgBox(4096, "Error", "Could not find correct window.")
        Return
    Else
        $i = 0
        Do
          ; MsgBox(4096, "success", "The window handle is " & $handle)
          ; Send some text directly to this window's edit control
          ;ControlClick("handle=" & $handle, "", "", "left")
            
            ControlSend("handle=" & $handle, "", "", "{TAB}")
            ControlSend("handle=" & $handle, "", "", "Accountname")
            ControlSend("handle=" & $handle, "", "", "{TAB}")
            ControlSend("handle=" & $handle, "", "", "Password")
            ControlSend("handle=" & $handle, "", "", "{ENTER}")
            $i = $i + 1
        Until $i = 1
    EndIf
    
EndFunc ;==>Log_in

************* not tested... i did not write the function

8)

EDITED

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

well its not really 'solved' the problem is jes the ControlSend Part works now but if i press on 'auto-Login'

then i get the error 'Could not find correct window.'

and i tried it with Sleep(12000) but the problem is if i clicked on Auto-Login// Then you cant click on 'D2Normal//D2Window'

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
Share on other sites

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

Opt("SendKeyDelay", 35)
Opt("WinTitleMatchMode", 4)

$checked = IniRead("Setup.ini", "Settings", "AutoLoad", "0")

GUICreate("Diablo II - Title!", 312, 81, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GUICtrlCreateButton("D2 Normal", 30, 50, 100, 23)
$Button_2 = GUICtrlCreateButton("D2 Window", 170, 50, 100, 23)
$Label_3 = GUICtrlCreateLabel("Welkom Jimmy!", 30, 10, 110, 20)
$Checkbox_4 = GUICtrlCreateCheckbox("Auto Login", 200, 0, 90, 30)
If $checked = 1 Then GUICtrlSetState(-1, $GUI_CHECKED)
GUISetState()


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            If FileExists("C:\Program Files\Diablo II\Diablo II.exe") Then
                Run(@ProgramFilesDir & "\Diablo II\Diablo II.exe -w -skiptobnet", @ProgramFilesDir & "\Diablo II", @SW_MAXIMIZE)
                If IniRead("Setup.ini", "Settings", "AutoLoad", "0") = 1 Then Log_in()
            Else
                MsgBox(64, "Sorry", "The file was not found", 3)
            EndIf
        Case $msg = $Button_1
            If FileExists("C:\Program Files\Diablo II\Diablo II.exe") Then
                Run(@ProgramFilesDir & "\Diablo II\Diablo II.exe -skiptobnet", @ProgramFilesDir & "\Diablo II", @SW_MAXIMIZE)
                If IniRead("Setup.ini", "Settings", "AutoLoad", "0") = 1 Then Log_in()
            Else
                MsgBox(64, "Sorry", "The file was not found", 3)
            EndIf
        Case $msg = $Checkbox_4
            If BitAND(GUICtrlRead($Checkbox_4), $GUI_CHECKED) = $GUI_CHECKED Then
                IniWrite("Setup.ini", "Settings", "AutoLoad", "1")
            Else
                IniWrite("Setup.ini", "Settings", "AutoLoad", "0")
            EndIf
           ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

; ---------------- Functions --------------------

Func Log_in()
    
    Sleep(2000); dont know how long??????
    
   ; Get the handle of the diablo window
    $handle = WinGetHandle("classname=Diablo II", "")
    If @error Then
        MsgBox(4096, "Error", "Could not find correct window.")
        Return
    Else
        $i = 0
        Do
           ;    MsgBox(4096, "success", "The window handle is " & $handle)
           ; Send some text directly to this window's edit control
           ;ControlClick("handle=" & $handle, "", "", "left")
            
            ControlSend("handle=" & $handle, "", "", "{TAB}")
            ControlSend("handle=" & $handle, "", "", "Accountname")
            ControlSend("handle=" & $handle, "", "", "{TAB}")
            ControlSend("handle=" & $handle, "", "", "Password")
            ControlSend("handle=" & $handle, "", "", "{ENTER}")
            $i = $i + 1
        Until $i = 1
    EndIf
    
EndFunc  ;==>Log_in

8)

NEWHeader1.png

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...