Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Execute command line program and capture output
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 7th December 14:52
gert van der kooij
External User
 
Posts: 1
Default Execute command line program and capture output



In article <8gkkm114nr15jgjughg32521br2emg1uin@4ax.com>,
lpeedinREMOVE@UPPERCASEnc.rr.com says...

Thanks Lee, this is what I needed. It even works when started from a DB2
Command Window and running DB2 commands. I was afraid the
..oleObject~new("WScript.Shell") command creates a new environment but it
inherites the DB2 Command Window environment which is what I needed.

Another reason to force the customer to install at least Object REXX
2.1.3, they are still running with 1.0.3.

Kind regards, Gert
  Reply With Quote


 


2 7th December 14:54
markh
External User
 
Posts: 1
Default Execute command line program and capture output



Or the ANSI standard way of doing it with Regina :-)

/* */
Address System 'ping www.rexxla.org' With Output Stem out. Error Stem
err.
Do i = 1 To out.0
Say out.i
End
Say '---'
Do i = 1 To err.0
Say err.i
End
  Reply With Quote
3 15th December 18:57
gert van der kooij
External User
 
Posts: 1
Default Execute command line program and capture output


In article <1131100129.349849.53820@o13g2000cwo.googlegroups. com>,
rexx@users.sourceforge.net says...

Please add this to ooRexx
  Reply With Quote
4 23rd February 18:39
gert van der kooij
External User
 
Posts: 1
Default Execute command line program and capture output


In article <8gkkm114nr15jgjughg32521br2emg1uin@4ax.com>,
lpeedinREMOVE@UPPERCASEnc.rr.com says...


Lee,
Running the script below works on XP Home but hangs on Windows 2K.
It looks like oExec~Status remains 0. If I remove the first do-while
loop it runs without a problem. Any idea what's causing this 'problem'?

Kind regards, Gert


WshShell = .oleObject~new("WScript.Shell")
oExec = WshShell~Exec("db2 list database directory")

do while oExec~Status = 0
call SysSleep(1)
end

do while oExec~StdOut~AtEndOfStream = 0
say oExec~StdOut~ReadLine
end
exit
  Reply With Quote
5 23rd February 18:39
lee peedin
External User
 
Posts: 1
Default Execute command line program and capture output


Gert,
The oExec~Status should remain at 0 as long as the Exec is running.
You can see this by taking my original example and change the
following:
oExec = WshShell~Exec("ping www.rexxla.org")
to
oExec = WshShell~Exec("calc")

You'll see that the status remains 0 until you close the calculator.

I'm reasonably sure you can remove the "do while" loop and be OK.

Lee
  Reply With Quote
6 24th February 08:36
gert van der kooij
External User
 
Posts: 1
Default Execute command line program and capture output


In article <9ccvm1l9f28t064t5d96mrg9k4ieoqkoh7@4ax.com>, Lee Peedin
(lpeedinREMOVE@UPPERCASEnc.rr.com) says...


Thanks Lee,

I removed the 'do while oExec~Status = 0' loop and it worked wihout a
problem. Do you know if it's possible to display all methods and
properties of the 'oExec' object?

TIA, Gert
  Reply With Quote
7 24th February 08:36
gert van der kooij
External User
 
Posts: 1
Default Execute command line program and capture output


In article <MPG.1de0591031f6ef6e9898b0@news.xs4all.nl>, Gert van der
Kooij (gert@invalid.nl) says...


I found it allready, all properties are listed at
http://tinyurl.com/con8m
  Reply With Quote


 


Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666