|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBScript - Verify a running program
Hey, I have a question about a subject I haven't come across yet in my book.
How do you find a particular program that is running, and tell your script to make it the active screen and close it when the script is done doing some ... clerical stuff ?? For example, you have a script that is copying files to a directory on the server (or on your personal PC). You had windows explorer running in the background from some earlier something you were doing before starting the script. you want your script to grab the current windows explorer (which is running in the background with three other programs) and make it active, switch to the folder you are copying files to (for entertainment purposes, you want to watch the files magically appear ), and when the copying is done, close the windows explorer.Hope that made sense. If not, I'll try again. ![]() Thanks in advance. |
|
#2
|
||||
|
||||
|
Since Windows Explorer runs in a window you can use the WshShell object's AppActivate method. The problem is that you'll need to know what folder Explorer is open to because you'll need the exact title string. For example, on this machine, if Explorer is open to the C: drive, it looks like this:
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#3
|
|||
|
|||
|
Verify and start and .EXE if not running
the problem I have is I have 2 .EXE that I need to verify their running state. If they are not running I need the script to throw an error code. How would I go about doing this?
The 2 .EXE’s are SQLSQM.EXE, Fabric.exe Thanks |
|
#4
|
||||||||
|
||||||||
|
In WMI, processes are typically named by their executable. You can query the Win32_Process class for all running processes and then check an executable name against the Caption property.
vb Code:
vb Code:
|
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > VBScript - Verify a running program |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|