> On Oct 30, 6:36 am, "Marta" <I301
...@hotmail.com> wrote:
>> Hi! i need your herp for following:
>> My vbs launch an application:
>> Wscript.Echo "Application is running."
>> allwaySinc = "syncappw.exe -s -m -lf ""c:\sinc_logs"" -e"
>> objShell.Run allwaySinc, 2, True
>> I would like write something while the app is running because it can take
>> several minutes. something like woulg be great!
>> ..........................................................................
>> ..........................................................................
>> .....................................................
>> Thanks in advance!
>> I301199
> Assuming the string of periods are to be displayed in a console window
> (at the command prompt), then something like this should do what you
> want when executed under the cscript.exe host ...
> Const HIDDEN_WINDOW = 0
> allwaySinc = "syncappw.exe -s -m -lf ""c:\sinc_logs"" -e"
> Set oWMISrvc = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\.\root\cimv2")
> Set oConfig = oWMISrvc.Get("Win32_ProcessStartup").SpawnInstance_
> oConfig.ShowWindow = HIDDEN_WINDOW
> Set oProcess = GetObject("winmgmts:{impersonationLevel=impersonate}!"
> _
> & "\\.\root\cimv2:Win32_Process")
> errReturn = oProcess.Create(allwaySinc, null, oConfig, iProcessID)
> n = 0
> if errReturn = 0 then
> do While IsRunning(iProcessID, oWMISrvc)
> wsh.sleep 100
> n = n + 1
> if (n Mod 10) = 0 then wsh.StdOut.write "."
> if n = 72 then n = 0 : wsh.echo
> loop
> end if
> Function IsRunning(ProcessID, oWMISrvc) ' boolean
> Dim sQry
> sQry = "SELECT * FROM Win32_Process WHERE ProcessID = '" _
> & ProcessID & "'"
> IsRunning = (oWMISrvc.ExecQuery(sqry).count > 0)
> end function
> (Watch for line wrapping in posting.)
> _____________________
> Tom Lavedas