Sign in to follow this  
Followers 0
kings

New to this

7 posts in this topic

Hey im new to this so im gonna ask probally the easiest question in the world.

I want to leave a game running and if it exits a window pops up so i wanted to make a script that sees this and clicks the button, exits the other script and starts it again

and im stuck on the first bit lol

this is what i did but i cant even get the script to start any help would be great, Thanks.

If (PixelGetColor(517,419) = 12970456) then

MouseMove(517,419,2)

MouseClick("left",517,419,2)

EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

hey, welcome to the forums

try this:

if you have the game name, check what it's window is called when it's running, and do this:

While WinActive("Game Window Name") ; fill in your window name
        While (PixelGetColor(517,419) = 12970456) ; 
            MouseClick("left",517,419,2) ; the 2 is the speed in milliseconds, i prefer a longer time, like 500 
            Sleep(500) ; Also mouseclick will Move AND click, so you don't need mousemove ;)
        WEnd
        Sleep(200) ; give it something to do if the color doesn't appear
    WEnd

hope it works :whistle:

Edited by omglol

Share this post


Link to post
Share on other sites

thanks for the welcome.

any chance you can look at this

; <AUT2EXE VERSION: 3.1.1.0>

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-START: C:\Documents and Settings\***.au3>
; ----------------------------------------------------------------------------

; <AUT2EXE VERSION: 3.1.1.0>

; ----------------------------------------------------------------------------
; 
; ----------------------------------------------------------------------------

 $login=inputbox("Restarter","Give Login:")
$password=inputbox("Restarter","Give Password:")
$character=inputbox("Restarter","Wich character to Select (1,2,3):")
HotKeySet("{PAUSE}", "Pause")
Global $Paused
while 1=1
sleep(1500)
if WinExists("SRO_Client") then
sleep(10)
else

 Run("C:\Documents and Settings\*** 1234 /18 0 0")

 while (PixelGetColor(22,757) <> 16744576) and (WinExists("Error") <> 1) and (WinExists("NetError","") <> 1)
 sleep(500)
 wend
 if WinExists("Error") or WinExists("NetError","") then
  WinActivate("Error")
  sleep(200)
  WinActivate("NetError","")
  ControlClick("Error","","Button1","left")
  sleep(200)
  ControlClick("NetError","","Button1","left")
  sleep(2000)
 else
  WinActivate("SRO_Client")
  loginStart()
 EndIf
endif
wend
func loginStart()
 sleep(200)
 ControlSend("SRO_Client", "", "", "{Enter}")
 sleep(1000)
 Send($login)
 sleep(1000)
 ControlSend("SRO_Client", "", "", "{TAB}")
 sleep(1000)
 send($password)
 sleep(1000)
 ControlSend("SRO_Client", "", "", "{Enter}")
 sleep(4000)
 while PixelGetColor(254,87) <> 14402189 and PixelGetColor(491,424) <> 16710616
  ControlSend("SRO_Client", "", "", "{Enter}")
  sleep(4000)
 wend
 if (PixelGetColor(528,425) = 16710616) then
  MouseMove(513,423,0)
  MouseClick("left",513,423,1)
  sleep(2000)
 else
  if (PixelGetColor(254,87) = 14402189) then
   sleep(3000)
   If $character=1 then
    MouseMove(325,348,0)
    MouseClick("left",325,348,2)
    MouseClick("left",325,348,2)
   EndIf
   If $character=2 then
    MouseMove(521,362,0)
    MouseClick("left",521,362,2)
    MouseClick("left",521,362,2)
   EndIf
   If $character=3 then
    MouseMove(704,374,0)
    MouseClick("left",704,374,2)
    MouseClick("left",704,374,2)
   EndIf
   sleep(800)
   If (PixelGetColor(789,231) = 16765009) then
    SoundPlay("C:\Windows\media\notify.wav")
    sleep(2200)
    MouseMove(791,710,0)
    MouseClick("left",791,710,2)
    Sleep(20000)
    ControlSend("SRO_Client", "", "", "{INSERT}")
   else
    if (PixelGetColor(528,425) = 16710616) then
     MouseMove(513,423,0)
     MouseClick("left",513,423,1)
     sleep(2000)
    else
     MouseMove(996,712,0)
     MouseClick("left",996,712,1)
     sleep(3500)
     loginStart()
    Endif
   Endif
  Endif
 endif
EndFunc
Func Pause()
    $Paused = NOT $Paused
While  $Paused
        Sleep (400)
WEnd
EndFunc; => Pause()

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: E:\sooperdooperlogin.au3>
; ----------------------------------------------------------------------------


; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: C:\Documents and Settings\****\Desktop\****.au3>
; ----------------------------------------------------------------------------

what im trying to do is not have to put in the details ive tried doing send login so i thought this would work but it never

$login=inputbox("Restarter","Give Login:")

send("login")

$password=inputbox("Restarter","Give Password:")

send("password")

$character=inputbox("Restarter","Wich character to Select (1,2,3):")

Send("1)

HotKeySet("{PAUSE}", "Pause")

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

this aint working so heres what im trying to do

im using the long script to log into a game for me but somtimes it exits to desktop then it says "cant find SRO_Client.exe" in a pop up box. SO i have to manually click "ok" then close the old script down and reopen the script to work again.

does that make sence?

so im trying to update this or even run a few scrpts at once that will click the "can not find" box for me, close the old script and open the new one.

Edited by kings

Share this post


Link to post
Share on other sites

So what you want to do is? make the error disapear somehow?

i don't think the error has something to do with the script... but what do i know i suck at scripting :whistle:

Share this post


Link to post
Share on other sites

So what you want to do is? make the error disapear somehow?

i don't think the error has something to do with the script... but what do i know i suck at scripting :whistle:

lol not as much as i do

im trying to make the error dissapear, exit the and reload the script all in a oner

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

this is the new script and i think it will do what i want but im not sure

; <AUT2EXE VERSION: 3.1.1.0>

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-START: C:\Documents and Settings\Adam\Desktop\54.au3>
; ----------------------------------------------------------------------------

; <AUT2EXE VERSION: 3.1.1.0>

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-START: C:\Documents and Settings\Adam\Desktop\adam1.au3>
; ----------------------------------------------------------------------------

; <AUT2EXE VERSION: 3.1.1.0>

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-START: E:\sooperdooperlogin.au3>
; ----------------------------------------------------------------------------

Run("C:\Documents and Settings\Adam\Desktop\heehee\srobot 1234 /18 0 0")


  sleep(200)

 $login=inputbox("Restarter","Give Login:")
$password=inputbox("Restarter","Give Password:")
$character=inputbox("Restarter","Wich character to Select (1,2,3):")
HotKeySet("{PAUSE}", "Pause")
Global $Paused
while 1=1
sleep(1500)
if WinExists("SRO_Client") then
sleep(500)
else



 Run("C:\Program Files\Silkroad\sro_client.exe 1234 /18 0 0")

 while (PixelGetColor(22,757) <> 16744576) and (WinExists("Error") <> 1) and (WinExists("NetError","") <> 1)
 sleep(500)
 wend
 if WinExists("Error") or WinExists("NetError","") then
  WinActivate("Error")
  sleep(200)
  WinActivate("NetError","")
  ControlClick("Error","","Button1","left")
  sleep(200)
  ControlClick("NetError","","Button1","left")
  sleep(2000)
 else
  WinActivate("SRO_Client")
  loginStart()
 EndIf
endif
wend
func loginStart()
 sleep(200)
 ControlSend("SRO_Client", "", "", "{Enter}")
 sleep(1000)
 Send($login)
 sleep(1000)
 ControlSend("SRO_Client", "", "", "{TAB}")
 sleep(1000)
 send($password)
 sleep(1000)
 ControlSend("SRO_Client", "", "", "{Enter}")
 sleep(4000)
 while PixelGetColor(254,87) <> 14402189 and PixelGetColor(491,424) <> 16710616
  ControlSend("SRO_Client", "", "", "{Enter}")
  sleep(4000)
 wend
 if (PixelGetColor(528,425) = 16710616) then
  MouseMove(513,423,0)
  MouseClick("left",513,423,1)
  sleep(2000)
 else
  if (PixelGetColor(254,87) = 14402189) then
   sleep(3000)
   If $character=1 then
    MouseMove(325,348,0)
    MouseClick("left",325,348,2)
    MouseClick("left",325,348,2)
   EndIf
   If $character=2 then
    MouseMove(521,362,0)
    MouseClick("left",521,362,2)
    MouseClick("left",521,362,2)
   EndIf
   If $character=3 then
    MouseMove(704,374,0)
    MouseClick("left",704,374,2)
    MouseClick("left",704,374,2)
   EndIf
   sleep(800)
   If (PixelGetColor(789,231) = 16765009) then
    SoundPlay("C:\Windows\media\notify.wav")
    sleep(2200)
    MouseMove(791,710,0)
    MouseClick("left",791,710,2)
    Sleep(20000)
    ControlSend("SRO_Client", "", "", "{INSERT}")
   else
    if (PixelGetColor(528,425) = 16710616) then
     MouseMove(513,423,0)
     MouseClick("left",513,423,1)
     sleep(2000)
    else
     MouseMove(996,712,0)
     MouseClick("left",996,712,1)
     sleep(3500)
     loginStart()
    Endif
   Endif
  Endif
 endif
EndFunc
Func Pause()
    $Paused = NOT $Paused
While  $Paused
        Sleep (400)
WEnd
While WinActive("SRO_Client")
        While (PixelGetColor(517,419) = 12970456) 
            MouseClick("left",517,419,2)
            Sleep(500)
        WEnd
        Sleep(200)
    WEnd
While WinActive("Error")
        While (PixelGetColor(516,425) = 0)
            MouseClick("left",516,425,2)
            Sleep(500)
        WEnd
        Sleep(200)
    WEnd
EndFunc; => Pause()

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: E:\sooperdooperlogin.au3>
; ----------------------------------------------------------------------------


; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: C:\Documents and Settings\Adam\Desktop\adam1.au3>
; ----------------------------------------------------------------------------


; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: C:\Documents and Settings\Adam\Desktop\54.au3>

; ----------------------------------------------------------------------------

Edited by kings

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