Server Questions

miltec

Hi All

I'm Running a server on a 2008r2 box, is there a was of bypassing the shutdown conformation? and how can I make the server run batch files automaticly?
 
You can use AutoHotkey to automate a lot of stuff on the server. I will post some examples later.
 
Here is a sample function for AutoHotkey that will let you send chat msgs to a dedicated server. Take this code and get creative with it. The "Window Spy" that comes with AutoHotkey is very helpful when writing scripts like this. Here is the code:
Code:
Chat(srvName, msg)
{
	WinGet, ids, list,ahk_class #32770
	Loop, %ids%
	{
		id := ids%A_Index%
		ControlGetText, curSrvName, Static13,ahk_id %id%
		if (curSrvName = srvName)
		{
			ControlSetText, Edit1, %msg%, ahk_id %id%
			ControlClick, Button9,ahk_id %id%
		}
	}
}

Call the function like this:
Code:
Chat("Server Name","Stop wrecking people Penisboy!")

I put the server name in there because I run multiple dedicated servers on the same machine and wanted to be able to script them individually. If you have a batch script on your server that you want to run then do something like this:
Code:
Chat("leet racing league","/batch penisboybatch")

You can automate other stuff to like advancing sessions, closing the server and starting it back up. I run a bunch of scripts like this with the windows tack scheduler to restart our server before races and stuff like that. I also have automated messages for stuff like. 10mins lift in qualy. Just get creative.

Here is a function to close a restart a server:
Code:
RestartServer(srvName)
{
	WinGet, ids, list,ahk_class #32770
	Loop, %ids%
	{
		id := ids%A_Index%
		ControlGetText, curSrvName, Static13,ahk_id %id%
		if (curSrvName = srvName)
		{
			WinKill, ahk_id %id%
			ControlClick, Button1,Exit Confirmation
		}
	}
	Sleep, 3000
	Run, "C:\Program Files\rFactor Dedicated\%srvName%\rFactor Dedicated.exe" +profile "%srvName%" +oneclick +fullproc,C:\Program Files\rFactor Dedicated\%srvName%
}

As you can see the srvName variable dictates the name of the server and the PLR profile. My server name and PLR names match on my servers. You will probably have to match this if your servers aren't as organized. Anyway, this should give you some ideas on ways to automate the server.

BTW, All of these scripts will work even when the server is minimized.
 
Hi Noel, Thanks
I'm trying to use Autohotkey but I'm having problems.

How do you set the servername on the relevant window?

All the server windows are "ISI Dedicated Server"
 
Last edited:
By reading the control name Static13 using the ControlGetText function. Static13 contains the server name.
 

Back
Top