?
Solved

How do I send text to stdout?

Posted on 2003-12-02
11
Medium Priority
?
8,849 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 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 400 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

Industry Leaders: 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!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

777 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