Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I send text to stdout?

Posted on 2003-12-02
11
Medium Priority
?
8,853 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

610 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