Sign in to follow this  
Followers 0
jacob_1998_1999

Automation Gone Crazy.

14 posts in this topic

I have been out of school for awhile and I decided to pick up autoit for a what I thought 'simple' automation task.

Simply put, I am running two programs and checking (as simply as possible) that it stays connected to the latter program.

All goes well to some extent.. I'm sure there is just something slightly wrong with my source that I am missing.. its 3:14 now. :think: after fiddling with this for several hours, I've decided to post my source for some hopefully helpful criticizm and much needed help and guidance.

I am aware that my coding is messy; I would like to apologize in advance.

$SCrack = ("C:\Program Files\Silkroad\SCrackbin\SCrack.exe")
$SRO = ("C:\Program Files\Silkroad\Silkroad.exe")
$SROExe = ("sro_client.exe")
$SROClient = ("SRO_Client")
$Account = ("########") 
$Password = ("#############")
$SROLauncher = ("Silkroad Online Launcher")
$Connected = 0
$Disconnected = 0
;=================================================

While   $Connected = 0
    StartPrograms()
    Connect()
Wend
If $Connected = 1 Then
    StartBot()
EndIf
While $Connected = 1
    While   $Disconnected = 0
        sleep (2500)
        ControlSend($SROClient, "", "", "{ENTER}")
        Sleep (5000)
        If  ProcessExists ($SROExe) Then
        $Disconnected = 0
        Else
        $Disconnected = 1
        $Connected = 0
        WinKill ($SROExe)
        EndIf   
    Wend
While   $Connected = 0
    StartPrograms()
    Connect()
Wend
If $Connected = 1 Then
    StartBot()
Else
    
EndIf
Wend
;==================================================
Func StartPrograms()
Run($SCrack)
Sleep(4000)
Run($SRO)
EndFunc

Func Connect()
WinActive ($SROLauncher)
    Sleep (5000)
    ControlClick ($SROLauncher, "", 1000)

Sleep (7500)

WinActivate ($SROClient)
    Sleep (1000)
      MouseClick ("Left", 674, 550, 1, 0)
    Sleep (2000)
      MouseClick ("Left", 674, 550, 1, 0)
    Sleep (2000)
    Send ($Account)
    Sleep (1000)
    Send ("{TAB}")
    Send ($Password)
    Sleep (1000)
    WinActivate ($SROClient)
    Send ("{ENTER}")

Sleep(7500)

MouseClick ("Left", 397, 500, 3, 5); Press first character
Sleep (5000)
MouseClick ("Left", 992, 939, 2, 0); press start
If  WinExists ($SROClient) = 1  Then 
    $Connected = 1
Else
    $Connected = 0
EndIf
EndFunc

Func StartBot()
Sleep(10000)
MouseWheel("down", 5);Just to expand visual distance ingame
sleep (100)
Send("{INSERT}")
sleep(100)
MouseClick ("Left", 800, 337, 1, 10);close pet inventory
sleep(200)
MouseClick ("Left", 11, 960, 4, 3); Expands Chat window
sleep(2000)
Send("e");open AutoMatch
sleep(1000)
MouseClick ("Left", 513, 717, 1, 10); Press AutoMatch
sleep(1000)
MouseClick ("Left", 596, 659, 1, 10); Press Confirm
sleep(1000)
Send("e")
EndFunc

The problem arises after the first complete loop. The StartBot Function repeats endlessly. Again.. I look forward to any help that could be given.

Jacob.

Coder in Training.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

maybe

$SCrack = ("C:\Program Files\Silkroad\SCrackbin\SCrack.exe")
$SRO = ("C:\Program Files\Silkroad\Silkroad.exe")
$SROExe = ("sro_client.exe")
$SROClient = ("SRO_Client")
$Account = ("########")
$Password = ("#############")
$SROLauncher = ("Silkroad Online Launcher")
$Connected = 0
$Disconnected = 0
;=================================================

While    $Connected = 0
    StartPrograms()
    Connect()
Wend
If $Connected = 1 Then
    StartBot()
EndIf
While $Connected = 1
    While    $Disconnected = 0
        sleep (2500)
        ControlSend($SROClient, "", "", "{ENTER}")
        Sleep (5000)
        If  ProcessExists ($SROExe) Then
        $Disconnected = 0
        Else
        $Disconnected = 1
        $Connected = 0
        WinKill ($SROExe)
        EndIf   
    Wend
While   $Connected = 0
    StartPrograms()
    Connect()
    If $Connected = 1 Then
    StartBot()
    EndIf
Wend

Wend
;==================================================
Func StartPrograms()
Run($SCrack)
Sleep(4000)
Run($SRO)
EndFunc

Func Connect()
WinActive ($SROLauncher)
    Sleep (5000)
    ControlClick ($SROLauncher, "", 1000)

Sleep (7500)

WinActivate ($SROClient)
    Sleep (1000)
      MouseClick ("Left", 674, 550, 1, 0)
    Sleep (2000)
      MouseClick ("Left", 674, 550, 1, 0)
    Sleep (2000)
    Send ($Account)
    Sleep (1000)
    Send ("{TAB}")
    Send ($Password)
    Sleep (1000)
    WinActivate ($SROClient)
    Send ("{ENTER}")

Sleep(7500)

MouseClick ("Left", 397, 500, 3, 5); Press first character
Sleep (5000)
MouseClick ("Left", 992, 939, 2, 0); press start
If   WinExists ($SROClient) = 1  Then
    $Connected = 1
Else
    $Connected = 0
EndIf
EndFunc

Func StartBot()
Sleep(10000)
MouseWheel("down", 5);Just to expand visual distance ingame
sleep (100)
Send("{INSERT}")
sleep(100)
MouseClick ("Left", 800, 337, 1, 10);close pet inventory
sleep(200)
MouseClick ("Left", 11, 960, 4, 3); Expands Chat window
sleep(2000)
Send("e");open AutoMatch
sleep(1000)
MouseClick ("Left", 513, 717, 1, 10); Press AutoMatch
sleep(1000)
MouseClick ("Left", 596, 659, 1, 10); Press Confirm
sleep(1000)
Send("e")
EndFunc

********* not tested

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Not quite so simple. ;/

The object of this is to check for a disconnect and then loop back to the beginning and restart both programs, without my interaction.

start programs

connect to server

start bot

check for disconnect

if disconnect, repeat.

Share this post


Link to post
Share on other sites

changes

While   $Connected = 0
    StartPrograms()
    Connect()
    If $Connected = 1 Then
    StartBot()
    EndIf
Wend

see above post

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

While I am testing this.. I have yet another program. :think:

Is there a way.. That in my Disconnect() Function, I can check to see if the program is Non-Responsive?

(Sometimes the game freezes, and my check for disconnect method doesn't work.. i.e. Task Manager: SRO_Client - Status = 'Not Responding')

I do thank you for your speedy and helpful replies. :">

EDIT:

I have read through the Process Section in the documentation.. however I didn't see anything that suited my cause.

Edited by jacob_1998_1999

Share this post


Link to post
Share on other sites

SCrack.exe - Is that like the CEO of the Plumbing Association or A new drug orginization?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

SCrack.exe - Is that like the CEO of the Plumbing Association or A new drug orginization?

xD Nice. :think: It is a nice little exe that injects a dll file with a bypass.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

seems you are using the process name in the winkill

WinKill ( "title" [, "text"])

that should be the "Title" not the exe ( unless thats the title also )

after that you could use

ProcessClose($SROExe)

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

seems you are using the process name in the winkill

that should be the "Title" not the exe ( unless thats the title also )

after that you could use

ProcessClose($SROExe)

8)

Thats my problem.. When the program is non responsive.. It accepts keystrokes, but doesn't register as disconnected. I need a way to check the processes to see if it is actually, responsive.

--Yes, the title is the same as the process.

Edited by jacob_1998_1999

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

--Yes, the title is the same as the process.

i dont understand

ControlSend($SROClient, "", "", "{ENTER}");- uses title - correct
        Sleep (5000)
        If  ProcessExists ($SROExe) Then; uses process name - correct
        $Disconnected = 0
        Else
        $Disconnected = 1
        $Connected = 0
        WinKill ($SROExe); uses process name ???????? - not correct, should be title

no????

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

i dont understand

ControlSend($SROClient, "", "", "{ENTER}");- uses title - correct
        Sleep (5000)
        If  ProcessExists ($SROExe) Then; uses process name - correct
        $Disconnected = 0
        Else
        $Disconnected = 1
        $Connected = 0
        WinKill ($SROExe); uses process name ???????? - not correct, should be title

no????

8)

oi, yes. Corrected.. However my problem still exists. The Client still accepts keystrokes, Not allowing the program to know if it is truely active, or merely frozen(Screen literally freezes, and becomes NonResponsive).

Share this post


Link to post
Share on other sites

after winkill()

did you try

ProcessClose($SROExe)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I did.

The problem arises when, the disconnect is not triggered.. because of the program not responding..

the program continues to press enter inside the non responsive program.. the ProcessClose is never used in this situation.

Share this post


Link to post
Share on other sites

Anyone? Is there a way to check the task manager for a Non Responsive program?

Share this post


Link to post
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
Sign in to follow this  
Followers 0