Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #474

Re: Redirecting VB script sub shell standard output

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!feeder.news-service.com!proxad.net!feeder1-2.proxad.net!193.252.117.184.MISMATCH!feeder.news.orange.fr!not-for-mail
From vincent.belaiche@gmail.com (Vincent Belaïche)
Newsgroups comp.lang.basic.visual.misc
Cc Vincent Belaïche <vincent.belaiche@gmail.com>
Subject Re: Redirecting VB script sub shell standard output
References <80zkh9rkje.fsf@gmail.com> <j6t5jl$r41$1@dont-email.me> <804nzhtme6.fsf@gmail.com> <o15597lntsvapuar8erjlcmaetotktlggu@4ax.com> <8062jwxfm2.fsf@gmail.com>
Date Tue, 11 Oct 2011 22:32:03 +0200
Message-ID <80aa97jmm4.fsf@gmail.com> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt)
Cancel-Lock sha1:Bn/1eAV/77NTGO11cAs6k5fAs7o=
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding 8bit
X-Antivirus avast! (VPS 111011-2, 11/10/2011), Outbound message
X-Antivirus-Status Clean
Lines 114
Organization les newsgroups par Orange
NNTP-Posting-Date 11 Oct 2011 22:32:12 CEST
NNTP-Posting-Host 92.135.113.85
X-Trace 1318365132 reader.news.orange.fr 30755 92.135.113.85:6954
X-Complaints-To abuse@orange.fr
Xref x330-a1.tempe.blueboxinc.net comp.lang.basic.visual.misc:474

Show key headers only | View raw


vincent.belaiche@gmail.com (Vincent Belaïche) writes:

> ralph <nt_consulting64@yahoo.net> writes:
>
>> On Mon, 10 Oct 2011 08:02:09 +0200, vincent.belaiche@gmail.com
>> (Vincent Belaïche) wrote:
>>
>>>Ron Weiner <NoOne@NoWare.NutThing> writes:
>
> [...]
>
>>>> Rdub
>>>
>>>Redirecting to a file won't do it. My VB script is run itself from a
>>>console with csscript, and I would like the output of the sub-shell
>>>run console application to be run in the same console.
>>>
>>>
>>>Console (A)
>>>   +-------- VB script (B)
>>>             +---- sub-shell with console application (C)
>>>
>>>
>>>I would like the standard output of `B' and `C' to be displayed in the
>>>same scrollable screen that is part of `A'.
>>>
>>
>> Still not clear to me, but browse for "Shell and Wait". You'll find
>> examples for VB as well as VBS.
>>
>> If necessary have each subsquent app write to a file, then 'echo' that
>> output from A to the screen.
>>
>> -ralph
>
> Hello Ralph,
>
> Actually I do not need some specific code to achieve "Shell And Wait",
> this is already supported by WshShell with the 3rd argument of the Run
> method.
>
> Set http://msdn.microsoft.com/en-us/library/aew9yb99(v=VS.85).aspx
>
> see also: http://msdn.microsoft.com/en-us/library/d5fk67ky(v=VS.85).aspx#CommunityContent
>
> Here is an example:
> '---------------------------- myscript.vbs ----------------------------
> Dim oShell, iReturn
> Set oShell = WScript.CreateObject("WScript.Shell")
>
> Const iACTIVATE_AND_DISPLAY = 1
>
> iReturn = oShell.Run("calc.exe",iACTIVATE_AND_DISPLAY, True)
>
> WScript.Echo "The end!"
> '----------------------------------------------------------------------
>
> In this example you will have the echo "The end!" only after exiting
> calc.exe, so I do have a wait.
>
> What I would like is that if I launch this script (let's call it
> myscript.vbs) with the DOS command:
>
> Rem -------------------------------------------------------------------
> cscript myscript.vbs
> Rem -------------------------------------------------------------------
>
> Then any output made to the standard output by the application (C) goes
> to the same DOS window (A) under which I launched cscript (B), just
> like "The end!" is output by the script (B) to this DOS window (A).
>
> Note that in the example above the application (C) is is just calc.exe
> but in reality that would be some console application.
>
> Hopefully my question is clear now...
>
>    Vincent.


Hello,

I have found a way to allmost achieve what I am seeking for (in the
example below the console application is TREE.COM):

'-----------------temp.vbs --------------------------------------------
Dim oShell
Set oShell = WScript.CreateObject("WScript.Shell")

Dim oExec
Set oExec = oShell.Exec("TREE.COM")
Dim sLine
Do While True

     Do While Not oExec.StdOut.AtEndOfStream 
	      sLine = oExec.StdOut.ReadLine
          WScript.Echo sLine
     Loop
	 If oExec.Status = 1 Then 
	    Exit Do
	 Else
	    WScript.Sleep 100
	 End if
Loop

WScript.Echo "That's all!"
'----------------------------------------------------------------------

But that does not work properly with non ASCII characters. You can try
in a DOS console to type TREE, and then CSCRIPT temp.vbs and see the
difference.

Any idea how to  solve this ?

   Vincent.

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Redirecting VB script sub shell standard output vincent.belaiche@gmail.com (Vincent Belaïche) - 2011-10-09 22:12 +0200
  Re: Redirecting VB script sub shell standard output Ron Weiner <NoOne@NoWare.NutThing> - 2011-10-09 18:01 -0400
    Re: Redirecting VB script sub shell standard output vincent.belaiche@gmail.com (Vincent Belaïche) - 2011-10-10 08:02 +0200
      Re: Redirecting VB script sub shell standard output ralph <nt_consulting64@yahoo.net> - 2011-10-10 01:50 -0500
        Re: Redirecting VB script sub shell standard output vincent.belaiche@gmail.com (Vincent Belaïche) - 2011-10-11 07:27 +0200
          Re: Redirecting VB script sub shell standard output vincent.belaiche@gmail.com (Vincent Belaïche) - 2011-10-11 22:32 +0200
            Re: Redirecting VB script sub shell standard output Ron Weiner <NoOne@NoWare.NutThing> - 2011-10-11 21:04 -0400
              Re: Redirecting VB script sub shell standard output vincent.belaiche@gmail.com (Vincent Belaïche) - 2011-10-14 20:37 +0200
                Re: Redirecting VB script sub shell standard output "Thorsten Albers" <gudea@gmx.de> - 2011-10-14 20:55 +0000
                Re: Redirecting VB script sub shell standard output vincent.belaiche@gmail.com (Vincent Belaïche) - 2011-10-19 19:31 +0200
  Re: Redirecting VB script sub shell standard output ralph <nt_consulting64@yahoo.net> - 2011-10-09 21:45 -0500
  Re: Redirecting VB script sub shell standard output Eric Coleman <eric@strategon.com> - 2011-10-13 19:45 -0500
    Re: Redirecting VB script sub shell standard output vincent.belaiche@gmail.com (Vincent Belaïche) - 2011-10-14 20:14 +0200

csiph-web