[help] Searching For A Vbscript Code

hi .

Well people. i was wondering if it is possible to quit an app using a VBScript code, i mean i know how to launch an app with VBScript ...

example.

 Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("F:\programs\ObjectDock\ObjectDock.exe")
WScript.Sleep 500
Set oExec = WshShell.Exec("C:\apps\Tab\Tab.exe")

.....

but what if i not only want to open those app. but what if i want to quit them as weel using a VBScript, ??? do you know what do i must use to quit it ???

So. my question is: What is the Code that i need to use ?

Thanks in advance for your help.

Note: "i use lots of VBScript to launch a COMBO of App, and this way i do not need to launch everysingle app separately, and for another reason",

#143927

Try this.... :blink:

WinClose ( "title" [, "text"] )
WinClose("Untitled - Notepad", "")

WinKill ( "title" [, "text"] )
WinKill("Untitled - ", "")

Terminates a named process.
ProcessClose ( "process" )
ProcessClose("notepad.exe")

'*.vbs
set WShell = WScript.CreateObject("WScript.Shell")
set oExec = WShell.Exec("notepad")
WScript.Sleep 3000
WShell.Popup "Closing Notepad", 2, "",64
oExec.Terminate()

#143934

sid, thanks dude !!

but. when i want to close a process, using --> ProcessClose("firefox.exe") for example. it does not work at all. it says that there is a mismatch with the type of processes and i think fire fox is a process :S

what`s the problem ?

#143952

:blink:

That's strange....well it works for me. Anyway try this..

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
   ("Select * from Win32_Process Where Name = 'notepad.exe'")
For Each objProcess in colProcessList
   objProcess.Terminate()
Next

Just replace notepad.exe with the process you want to close.

#144001

Sid !!! it works BEAUTYFUL !!! yes ... just beautyful. the last approach is the best one.

thanks.

#144088

Sorry fot the doble post, but Sid is there a good tutorial to lean how to write VBScripts ??? where can i find it. (i know if i use google i can find tons ! but if you know about a good one , i definetivelly go for it and stop the searching)

so awaiting your advice.

bye . and thanks.

#144093

Sorry man, I took classes.... :blink:

I'll still look up on google and let you know.

#144108