Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Write something while app runing
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tom Lavedas  
View profile  
 More options Oct 30 2009, 12:32 pm
Newsgroups: microsoft.public.scripting.vbscript
From: Tom Lavedas <tglba...@cox.net>
Date: Fri, 30 Oct 2009 05:32:23 -0700 (PDT)
Local: Fri, Oct 30 2009 12:32 pm
Subject: Re: Write something while app runing
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


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google