Hi

(New and still trying learn vb scripting)

I have created a vb which runs a command that I need to automate, this works
fine.

But I now need to run the same command with different options after it has
completed (Its just the way the command runs, its like a db query), when I do
this the command starts to run in parallel and which causes errors, as the
command is trying to access the programs services at the same time.

I have tried to put the Wscript.sleep, thinking this would wait, but this
does not work,any sugesstions?

'***********************
dim Wshell
dim StrCmdNormal
dim StrCmdWarning

StrCmdNormal="c:\test.exe -o -t"
StrCmdWarning="c:\test.exe -o -z "

set Wshell = wscript.createobject("wscript.shell")

Wshell.run StrCmdNormal
Wscript.sleep 60

Wshell.run StrCmdWarning
Wscript.sleep 60

Wscript.echo StrCmdNormal
Wscript.echo StrCmdWarning

'**************************
---
Dee

Re: How running multiple commands in a script by ekkehard

ekkehard
Wed Nov 08 06:11:58 CST 2006

Dee wrote:
> Hi
>
> (New and still trying learn vb scripting)
>
> I have created a vb which runs a command that I need to automate, this works
> fine.
>
> But I now need to run the same command with different options after it has
> completed (Its just the way the command runs, its like a db query), when I do
> this the command starts to run in parallel and which causes errors, as the
> command is trying to access the programs services at the same time.
>
> I have tried to put the Wscript.sleep, thinking this would wait, but this
> does not work,any sugesstions?
>
> '***********************
> dim Wshell
> dim StrCmdNormal
> dim StrCmdWarning
>
> StrCmdNormal="c:\test.exe -o -t"
> StrCmdWarning="c:\test.exe -o -z "
>
> set Wshell = wscript.createobject("wscript.shell")
>
> Wshell.run StrCmdNormal
> Wscript.sleep 60
>
> Wshell.run StrCmdWarning
> Wscript.sleep 60
>
> Wscript.echo StrCmdNormal
> Wscript.echo StrCmdWarning
>
> '**************************
> ---
> Dee
lookup the

object.Run(strCommand, [intWindowStyle], [bWaitOnReturn])

in the VBScript Docs and start with something like:

nRet = Wshell.run( StrCmdNormal, YourChoiceOfStyle, True

Re: How running multiple commands in a script by Dee

Dee
Wed Nov 08 06:31:02 CST 2006

Hi ekkehard

Thanks for this, I will get stuck in and try it all out, slow learner...but
thanks

D
--
Dee


"ekkehard.horner" wrote:

> Dee wrote:
> > Hi
> >
> > (New and still trying learn vb scripting)
> >
> > I have created a vb which runs a command that I need to automate, this works
> > fine.
> >
> > But I now need to run the same command with different options after it has
> > completed (Its just the way the command runs, its like a db query), when I do
> > this the command starts to run in parallel and which causes errors, as the
> > command is trying to access the programs services at the same time.
> >
> > I have tried to put the Wscript.sleep, thinking this would wait, but this
> > does not work,any sugesstions?
> >
> > '***********************
> > dim Wshell
> > dim StrCmdNormal
> > dim StrCmdWarning
> >
> > StrCmdNormal="c:\test.exe -o -t"
> > StrCmdWarning="c:\test.exe -o -z "
> >
> > set Wshell = wscript.createobject("wscript.shell")
> >
> > Wshell.run StrCmdNormal
> > Wscript.sleep 60
> >
> > Wshell.run StrCmdWarning
> > Wscript.sleep 60
> >
> > Wscript.echo StrCmdNormal
> > Wscript.echo StrCmdWarning
> >
> > '**************************
> > ---
> > Dee
> lookup the
>
> object.Run(strCommand, [intWindowStyle], [bWaitOnReturn])
>
> in the VBScript Docs and start with something like:
>
> nRet = Wshell.run( StrCmdNormal, YourChoiceOfStyle, True
>

Re: How running multiple commands in a script by Jeffery

Jeffery
Thu Nov 09 00:34:25 CST 2006

On Wed, 8 Nov 2006 03:52:02 -0800, Dee wrote:

> Hi
>
> (New and still trying learn vb scripting)
>
> I have created a vb which runs a command that I need to automate, this works
> fine.
>
> But I now need to run the same command with different options after it has
> completed (Its just the way the command runs, its like a db query), when I do
> this the command starts to run in parallel and which causes errors, as the
> command is trying to access the programs services at the same time.
>
> I have tried to put the Wscript.sleep, thinking this would wait, but this
> does not work,any sugesstions?
>
> '***********************
> dim Wshell
> dim StrCmdNormal
> dim StrCmdWarning
>
> StrCmdNormal="c:\test.exe -o -t"
> StrCmdWarning="c:\test.exe -o -z "
>
> set Wshell = wscript.createobject("wscript.shell")
>
> Wshell.run StrCmdNormal
> Wscript.sleep 60
>
> Wshell.run StrCmdWarning
> Wscript.sleep 60
>
> Wscript.echo StrCmdNormal
> Wscript.echo StrCmdWarning
>
> '**************************
> ---
> Dee

If you are using the RUN method and want the script to wait until the
process completes, there is a parameter for RUN that you can use.

Wshell.run StrCmdNormal,5,TRUE

The second parameter specifies Window appearance. Check the VBSCript docs
for more detail. Be aware that not every application and command will
cooperate but this is where I would start.

--
Jeffery Hicks - www.ScriptingAnswers.com
SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com
Scripting books: www.SAPIENPress.com