Jump to content

Help with a program restarter


wootn0w
 Share

Recommended Posts

Sup guys, here is my problem: Half Life dedicated server doesnt restart automatically, so when ever i want to restart it for a password reset over rcon, the server will just shut down. I got the movement and clicks and repeating code done (just need to put in specific values) but i cant figure out a methode (looked at some other posts) to wait until a specific window closes... any hints ? ill search on maybe i find something but help is appriciated.

here is my current code:

;wait for the window to close hlds

;do until window = 0 then

;move mouse to hlds.exe and double click

MouseMove(x, y)

MouseClick("left")

MouseClick("left")

;wait 10 seconds until server boot's then click once to start

Sleep(10000)

MouseMove(x, y)

MouseClick("left")

;repeat from beginning

Link to comment
Share on other sites

maybe this ???

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("{F!}", "Set_Run")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d

;;;; Body of program would go here;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;


Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"by  QTasc","This is a message. ")
EndFunc


Func Set_Run()

Do
    $win = WinWaitClose("?TITLE of WINDOW?") ;wait for the window to close hlds
Until $win = 0  


;move mouse to hlds.exe and double click
MouseMove(x, y)
MouseClick("left")
MouseClick("left")

;wait 10 seconds until server boot's then click once to start
Sleep(10000)
MouseMove(x, y)
MouseClick("left")


;repeat from beginning
EndFunc

hope that helps

8)

NEWHeader1.png

Link to comment
Share on other sites

K i got the part of the if window is closed do this im working on my own version now ;) thx for the info. I got one question though. Is there a Goto command ? cause that would be sweeeet

for instance if x = x do this else goto beginning of script

EDIT:I just searched and noticed some post about there not being a goto command too bad would make life easier well here is my code so far, im trying to find another way with a conditional statement of some sort. if you could lead me ahead plz thx

CODE:

Do

$win = WinWaitClose("window title here") ;wait for the window to close hlds

Until $win = 0

$win = $win

If $win = 0 Then

;move mouse to hlds.exe and double click

MouseMove(574, 22)

MouseClick("left")

MouseClick("left")

;wait 10 seconds until server boot's then click once to start

Sleep(10000)

MouseMove(527, 520)

MouseClick("left")

Sleep(100000)

Else

EndIf

Edited by wootn0w
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...