jacob_1998_1999 Posted April 20, 2006 Share Posted April 20, 2006 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. 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. expandcollapse popup$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. Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2006 Share Posted April 20, 2006 (edited) maybe expandcollapse popup$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 April 20, 2006 by Valuater Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted April 20, 2006 Author Share Posted April 20, 2006 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. Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2006 Share Posted April 20, 2006 changes While $Connected = 0 StartPrograms() Connect() If $Connected = 1 Then StartBot() EndIf Wend see above post 8) Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted April 20, 2006 Author Share Posted April 20, 2006 (edited) While I am testing this.. I have yet another program. 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 April 20, 2006 by jacob_1998_1999 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 20, 2006 Moderators Share Posted April 20, 2006 SCrack.exe - Is that like the CEO of the Plumbing Association or A new drug orginization? 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. Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted April 20, 2006 Author Share Posted April 20, 2006 SCrack.exe - Is that like the CEO of the Plumbing Association or A new drug orginization?xD Nice. It is a nice little exe that injects a dll file with a bypass. Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2006 Share Posted April 20, 2006 (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 April 20, 2006 by Valuater Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted April 20, 2006 Author Share Posted April 20, 2006 (edited) seems you are using the process name in the winkillthat should be the "Title" not the exe ( unless thats the title also )after that you could useProcessClose($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 April 20, 2006 by jacob_1998_1999 Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2006 Share Posted April 20, 2006 (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 April 20, 2006 by Valuater Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted April 20, 2006 Author Share Posted April 20, 2006 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). Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2006 Share Posted April 20, 2006 after winkill() did you try ProcessClose($SROExe) 8) Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted April 20, 2006 Author Share Posted April 20, 2006 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. Link to comment Share on other sites More sharing options...
jacob_1998_1999 Posted April 20, 2006 Author Share Posted April 20, 2006 Anyone? Is there a way to check the task manager for a Non Responsive program? 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