Solved

How do I send text to stdout?

Posted on 2003-12-02
11
8,846 Views
Last Modified: 2012-05-04
How do I send text to stdout?

Thanks.
0
Comment
Question by:turn123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9858848
0
 
LVL 11

Author Comment

by:turn123
ID: 9859086
Line three character twelve gives and error "Syntax error".  I'm trying to write a VBScript.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9859635
To stdout

Just use

Wscript.Echo

example, read and write from stdout (cmd.exe)

http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_wsh_pkoy.asp

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Author Comment

by:turn123
ID: 9861277
It looks like that article captures the stdout of another program.  I want to be able to write to stdout so I can caputure the output with another program.

Something like

out = "text"
stdout.write(out).

I can't figure out how to do it though.

Thanks for your help.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9861312
Is it just

Wscript.Echo
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9861315
ie

out = "text"
Wscript.Echo out
0
 
LVL 11

Author Comment

by:turn123
ID: 9861857
That brings up a message box that says text regardless of how the program is called.  If you call it through the command prompt you get a message box rather then text.

I need it to send the text to the standerd out that can be read other programs.
0
 
LVL 9

Expert Comment

by:TooKoolKris
ID: 9863015
Here is some code you can actually use that does what you requested. It's for .vbs a script that runs IPConfig.exe, and then echoes only the line of output that includes the IP address of the local computer. This script must be run from the command prompt(cscript) as all scripts that have STD objects must be.

Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("%comspec% /c ipconfig.exe")

Do Until objExecObject.StdOut.AtEndOfStream
    strLine = objExecObject.StdOut.ReadLine()
    strIP = Instr(strLine,"Address")
    If strIP <> 0 Then
        Wscript.Echo strLine
    End If
Loop
0
 
LVL 11

Author Comment

by:turn123
ID: 9863225
Thank you.

I still don't see how to get it to print my text "test".

Could you show me how please?

Thanks.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 100 total points
ID: 9866096
Try this


in tt.vbs

Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("%comspec% /c c:\temp\aa.vbs")

Do Until objExecObject.StdOut.AtEndOfStream
    strLine = objExecObject.StdOut.ReadLine()
    Wscript.Echo strLine
Loop


in aa.vbs

Wscript.Echo "test"
Wscript.Echo "test1"


When you run tt.vbs, you should see the line show on the cmd
0
 
LVL 11

Author Comment

by:turn123
ID: 9866798
That did it.
Thank you very much.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question