• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Launch Two Programs At Once

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

KaosInc.

Registered
Joined
Feb 7, 2007
Location
Quebec, Canada
Hi there,

I got kinda tired of having to launch Steam and Xfire when ever I felt the need to play CS or any other Steam game for that matter. I decided to write a small script in order to launch Steam and Xfire at once. The script also is supposed to exit the other program once one of the two is exited. In theory my script should work, however, I can't seem to find out what is wrong. (The OS I am using is Vista)

Could someone look at my windows script?

Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
 
errResult = objWMIService.Create("Steam.exe", null, null, IntSteamID)
errResult = objWMIService.Create("Xfire.exe", null, null, intXfireID)

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colProcesses = objWMIService.ExecNotificationQuery _
    ("Select * From __InstanceDeletionEvent " _ 
            & "Within 1 Where TargetInstance ISA 'Win32_Process'")

Do Until i = 999
    Set objProcess = colProcesses.NextEvent
    If objProcess.TargetInstance.ProcessID = intSteamID Then
        Exit Do
    End If
Loop

Set colProcesses = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where ProcessID = " & intSteamID)

For Each objProcess in colProcesses
    objProcess.Terminate()
Next

Thank you.
 
Last edited:
why not just create a batch file that loads one program then the other? then you simply run the batchfile and that starts both xfire and steam. :)
 
It's the KISS principle. KISS means keep it simple stupid (not an insult at you just the name of the idea) but what it means is that the simpler you make it the more likely you will be more likely to succeed so a simple batch file is way more likely to work and probably easier to diagnose problems from then a big script.

It's kinda like on mythbusters when the simple well thought out machines work over the overly complex which are usually doomed for failure.
 
Red_LightRanger said:
I have always wondered about batch files, how do they work? Sorry for newb question
It's a simple programming language from the DOS days. It was ncluded as part of OSs up through WIN98. A DOS emulator is included with all later OSs. Most of the major DOS commands work, including batch files.

Some fairly sophisticated programming is possible with batch files, along with some very easy, simple stuff.

Google would be a good place to start. Not here.
 
Red_LightRanger said:
I have always wondered about batch files, how do they work? Sorry for newb question

Create a text file with a series of Dos commands. Name it something.bat. Double click it. Watch the magic.

There's more to it than that but you might start your own thread to ask the question.
 
Back