1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| ' delay startup of applications, usefull for resident apps which start with windows
' this script is public domain ! Use it, modify it, do what you want with it
' list of applications (modify with your programs)
myPrograms = Array( _
"%SystemRoot%\system32\notepad.exe", _
"%SystemRoot%\system32\calc.exe", _
"" )
' main startup delay in seconds (set your own delay)
iMainDelay = "1"
' delay between each program in seconds (set your own delay)
iIntermediateDelay = "1"
' Set shell object
Set objShell = CreateObject("Wscript.Shell")
' wait the main delay
wScript.Sleep(iMainDelay * 1000)
' launch software
For Each Program In myPrograms
If Program <> "" Then
Dim i,tb,ProgShort
tb = split(Program,"\")
For i = lbound(tb) to ubound(tb)
ProgShort = tb(i)
next
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process Where Name = '"&ProgShort&"'")
For Each objItem in colItems
objItem.Terminate()
Next
objShell.Run Program
wScript.Sleep(iIntermediateDelay * 1000)
End If
Next |