This is a multi-part message in MIME format.

------=_NextPart_000_00EA_01C52897.FE5D3060
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi everyone,

How can I determine if a process + window name is up & running, like =
"Winzip - SomeExcelFile.xls"?

Using WMI (Win32_Process) I can find out if Winzip is running but what I =
want to do is to have my script wait until a specific instance of Winzip =
(compressing TO a specific file) is still processing or not.

Can it be done at all?

Thanks in advance.


Joseph

philippeoget at hotmail dot com
http://www.geocities.com/philippeoget/a2z/
------=_NextPart_000_00EA_01C52897.FE5D3060
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2523" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi everyone,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>How can I <FONT size=3D2>determine if a =
process +=20
window name is up &amp; running, like "Winzip -=20
SomeExcelFile.xls"?</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Using WMI (Win32_Process) I can find =
out if Winzip=20
is running but what I want to do is to have my script wait until a =
specific=20
instance of Winzip (compressing TO a specific file) is still processing =
or=20
not.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Can it be done at all?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance.</FONT></DIV><FONT =
face=3DArial=20
size=3D2>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Joseph</DIV>
<DIV>&nbsp;</DIV>
<DIV>philippeoget at hotmail dot com<BR><A=20
href=3D"http://www.geocities.com/philippeoget/a2z/">http://www.geocities.=
com/philippeoget/a2z/</A></FONT></DIV></BODY></HTML>

------=_NextPart_000_00EA_01C52897.FE5D3060--

Re: How determine if a process + window name is up & running by Torgeir

Torgeir
Mon Mar 14 08:05:14 CST 2005

Philippe wrote:

> How can I determine if a process + window name is up & running,
> like "Winzip - SomeExcelFile.xls"?
>
> Using WMI (Win32_Process) I can find out if Winzip is running but
> what I want to do is to have my script wait until a specific
> instance of Winzip (compressing TO a specific file) is still
> processing or not.
>
> Can it be done at all?
Hi

Using AutoItX's WinWait method (or some of the other windows handling
methods of AutoItX) is an option.

AutoIt/AutoItX is free and can be found here:
http://www.hiddensoft.com/autoit3/index.php

AutoItX is an ActiveX control version of AutoIt and can be used from a
vbscript/jscript.


Also Enum.exe (command line), Cmdow.exe (command line), or JSSys.dll
(ActiveX control) can be used for this:

http://groups.google.co.uk/groups?threadm=O%24R%23LR4YEHA.3688%40TK2MSFTNGP12.phx.gbl



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: How determine if a process + window name is up & running by Philippe

Philippe
Mon Mar 14 08:39:34 CST 2005

Thanks torgeir, but I am not very keen on using external apps at all, as I
am intent on creating 'portable' scripts, and I cannot know if the client
machines will have such application installed.

--

Joseph

philippeoget at hotmail dot com
http://www.geocities.com/philippeoget/a2z/
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:u1q407JKFHA.2920@TK2MSFTNGP10.phx.gbl...
> Philippe wrote:
>
>> How can I determine if a process + window name is up & running,
>> like "Winzip - SomeExcelFile.xls"?
>>
>> Using WMI (Win32_Process) I can find out if Winzip is running but
>> what I want to do is to have my script wait until a specific
>> instance of Winzip (compressing TO a specific file) is still
>> processing or not.
>>
>> Can it be done at all?
> Hi
>
> Using AutoItX's WinWait method (or some of the other windows handling
> methods of AutoItX) is an option.
>
> AutoIt/AutoItX is free and can be found here:
> http://www.hiddensoft.com/autoit3/index.php
>
> AutoItX is an ActiveX control version of AutoIt and can be used from a
> vbscript/jscript.
>
>
> Also Enum.exe (command line), Cmdow.exe (command line), or JSSys.dll
> (ActiveX control) can be used for this:
>
> http://groups.google.co.uk/groups?threadm=O%24R%23LR4YEHA.3688%40TK2MSFTNGP12.phx.gbl
>
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx



Re: How determine if a process + window name is up & running by Torgeir

Torgeir
Mon Mar 14 09:05:53 CST 2005

Philippe wrote:

> Thanks torgeir, but I am not very keen on using external apps at
> all, as I am intent on creating 'portable' scripts, and I cannot
> know if the client machines will have such application installed.
Hi

Then I'm afraid you will need to use a programming language that
supports calling API's, e.g. VB or C/C++, and create your own exe
file instead of using a script.

For a VB sample see e.g. the FindPart example here:
http://vb.mvps.org/samples/


Alternatively, use AutoIt (not AutoItX) that can convert a AutoIt
script to a standalone exe file you can distribute. You can either
do all your scripting in the AutoIt script language, or combine
the exe file with a VBScript.



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: How determine if a process + window name is up & running by Philippe

Philippe
Mon Mar 14 14:49:45 CST 2005

Torgeir,

Thanks for your reply.

I have been tryimg for yonks to understand WMI and I saw this script,
minutes ago:
The question is, is there a caption property somewhere to be retrieved? Like
'notepad.exe - new file'

Incidentally, what is the purpose of "WITHIN 1 " below?

Thanks for your help.
strComputer = "."
Set objSWbemServices = GetObject("winmgmts:" &_
"{impersonationLevel=impersonate}!" &_
"\\" & strComputer & "\root\cimv2")

Set objEventSource = objSWbemServices.ExecNotificationQuery( _
"SELECT * FROM __InstanceOperationEvent " &_
"WITHIN 1 " &_
"WHERE TargetInstance " &_
"ISA 'Win32_Process' " &_
"AND TargetInstance.Name = 'notepad.exe'")

Set objEventObject = objEventSource.NextEvent()
Select Case objEventObject.Path_.Class
Case "__InstanceCreationEvent"
Wscript.Echo "An instance of notepad.exe was just started."
Case "__InstanceDeletionEvent"
Wscript.Echo "An instance of notepad.exe was just stopped."
Case "__InstanceModificationEvent"
Wscript.Echo "An instance of notepad.exe was just modified."
End Select


Joseph

philippeoget at hotmail dot com
http://www.geocities.com/philippeoget/a2z/
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:u6hbudKKFHA.3484@TK2MSFTNGP12.phx.gbl...
> Philippe wrote:
>
>> Thanks torgeir, but I am not very keen on using external apps at
>> all, as I am intent on creating 'portable' scripts, and I cannot
>> know if the client machines will have such application installed.
> Hi
>
> Then I'm afraid you will need to use a programming language that
> supports calling API's, e.g. VB or C/C++, and create your own exe
> file instead of using a script.
>
> For a VB sample see e.g. the FindPart example here:
> http://vb.mvps.org/samples/
>
>
> Alternatively, use AutoIt (not AutoItX) that can convert a AutoIt
> script to a standalone exe file you can distribute. You can either
> do all your scripting in the AutoIt script language, or combine
> the exe file with a VBScript.
>
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx



Re: How determine if a process + window name is up & running by Torgeir

Torgeir
Tue Mar 15 03:23:41 CST 2005

Philippe wrote:

> Torgeir,
>
> Thanks for your reply.
>
> I have been tryimg for yonks to understand WMI and I saw this script,
> minutes ago:
> The question is, is there a caption property somewhere to be retrieved? Like
> 'notepad.exe - new file'


The script still uses Win32_Process, that have no idea about any
windows titles that the processes have. As far as I know, nothing
else in WMI have it either.


> Incidentally, what is the purpose of "WITHIN 1 " below?

From http://msdn.microsoft.com/library/en-us/wmisdk/wmi/gloss_w.asp

WITHIN
A clause in the WQL SELECT statement that constrains the
granularity of event delivery time, and supports polling
for events when no event provider is available.


More here:

WITHIN Clause
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/within_clause.asp


> Thanks for your help.
> strComputer = "."
> Set objSWbemServices = GetObject("winmgmts:" &_
> "{impersonationLevel=impersonate}!" &_
> "\\" & strComputer & "\root\cimv2")
>
> Set objEventSource = objSWbemServices.ExecNotificationQuery( _
> "SELECT * FROM __InstanceOperationEvent " &_
> "WITHIN 1 " &_
> "WHERE TargetInstance " &_
> "ISA 'Win32_Process' " &_
> "AND TargetInstance.Name = 'notepad.exe'")
>
> Set objEventObject = objEventSource.NextEvent()
> Select Case objEventObject.Path_.Class
> Case "__InstanceCreationEvent"
> Wscript.Echo "An instance of notepad.exe was just started."
> Case "__InstanceDeletionEvent"
> Wscript.Echo "An instance of notepad.exe was just stopped."
> Case "__InstanceModificationEvent"
> Wscript.Echo "An instance of notepad.exe was just modified."
> End Select
>
>
> Joseph



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: How determine if a process + window name is up & running by Joseph

Joseph
Tue Mar 15 22:12:37 CST 2005

Thank you for your reply,

I tried: wmic process list full > wmicProcessListInstance.txt

but even that isn't too good, I have 6 IE windows open and only one was
listed, with its description though, which is what I am after.

Oh well, never mind.

Thanks again Torgeir.


Joseph

philippeoget at hotmail dot com
http://www.geocities.com/philippeoget/a2z/
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:eMncPDUKFHA.1308@TK2MSFTNGP15.phx.gbl...
> Philippe wrote:
>
>> Torgeir,
>>
>> Thanks for your reply.
>>
>> I have been tryimg for yonks to understand WMI and I saw this script,
>> minutes ago:
>> The question is, is there a caption property somewhere to be retrieved?
>> Like 'notepad.exe - new file'
>
>
> The script still uses Win32_Process, that have no idea about any
> windows titles that the processes have. As far as I know, nothing
> else in WMI have it either.
>
>
>> Incidentally, what is the purpose of "WITHIN 1 " below?
>
> From http://msdn.microsoft.com/library/en-us/wmisdk/wmi/gloss_w.asp
>
> WITHIN
> A clause in the WQL SELECT statement that constrains the
> granularity of event delivery time, and supports polling
> for events when no event provider is available.
>
>
> More here:
>
> WITHIN Clause
> http://msdn.microsoft.com/library/en-us/wmisdk/wmi/within_clause.asp
>
>
>> Thanks for your help.
>> strComputer = "."
>> Set objSWbemServices = GetObject("winmgmts:" &_
>> "{impersonationLevel=impersonate}!" &_
>> "\\" & strComputer & "\root\cimv2")
>>
>> Set objEventSource = objSWbemServices.ExecNotificationQuery( _
>> "SELECT * FROM __InstanceOperationEvent " &_
>> "WITHIN 1 " &_
>> "WHERE TargetInstance " &_
>> "ISA 'Win32_Process' " &_
>> "AND TargetInstance.Name = 'notepad.exe'")
>>
>> Set objEventObject = objEventSource.NextEvent()
>> Select Case objEventObject.Path_.Class
>> Case "__InstanceCreationEvent"
>> Wscript.Echo "An instance of notepad.exe was just started."
>> Case "__InstanceDeletionEvent"
>> Wscript.Echo "An instance of notepad.exe was just stopped."
>> Case "__InstanceModificationEvent"
>> Wscript.Echo "An instance of notepad.exe was just modified."
>> End Select
>>
>>
>> Joseph
>
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx