Steam Hearthstone Script
Steam Hearthstone Script
exe"
Client = "Hearthstone.exe"
' if nothing was passed in, we are starting from scratch, so start the launcher
If WScript.Arguments.length = 0 Then
Home = WScript.ScriptFullName
Home = Left(Home, InStr(Home, WScript.ScriptName)-1)
'run the launcher
Set objShell = WScript.CreateObject("Shell.Application")
objShell.ShellExecute Launcher, "", Home
' create the file that the elevated script will copy executables's path and com
mandline to
set fso = CreateObject("Scripting.FileSystemObject")
set tempfolder = fso.GetSpecialFolder(2)
tempname = tempfolder & "\" & "steam.tmp"
set tempfile = fso.CreateTextFile(tempname)
tempfile.close()
'run this script but signal that it needs to elevate by giving it the tempfile
name as an argument
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "cscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34)
& " " & tempname, "", "runas", 2
WScript.Echo "Waiting for other script to finish..."
' check every second if the temporary file has been updated with the commandlin
e info
Do While True
'check the filesize of the tempfile
set tempfile = fso.GetFile(tempname)
If tempfile.Size > 0 Then Exit Do
WScript.Sleep 1000
Loop
ExecutablePath = Home
set tempfile = fso.OpenTextFile(tempname)
CommandLine = tempfile.ReadLine
tempfile.close()
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute Client, CommandLine, ExecutablePath
fso.DeleteFile tempname
WScript.Quit
Else
' we are elevated now
WScript.Echo "Waiting for launcher to start client..."
'Get Windows Manager object
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\
\.\root\cimv2")
' check every second for client that was launched by launcher
While True
'Get info on processes named Client
Set InstanceList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & Client & "'")