[REBOL] Re: Command/Pro call interact with external program using STDIO
From: micael:gullmes:telenor:se at: 29-Jan-2003 14:41
thanks for the repsonse, as you say, it is not exactly what I am looking for.
I've been playing with another way of doing it using Solaris and inetd server/daemon,
in that wat I start the external program with rebol by opening a port specified in inetd.
But it seems like overkill to port communication and a server/daemon for this...
I really would like a simple solution, "the rebol way", similar to opening a port.
;-------Fantasy example 1
stdio: open/call %"format a:"
if equal? copy stdio "Insert new diskette for drive A: and press ENTER when ready..."
insert stdio "Y"
print result: copy stdio
;-------End Fantasy example 1
Fr=E5n: bryan [mailto:[bry--itnisk--com]]
Skickat: den 29 januari 2003 11:43
=C4mne: [REBOL] Re: Command/Pro call interact with external program using
>has anyone done a nice solution for interacting with external programs
>multiple times using call and STDIO?
Okay, I was thinking about this, along with some other subjects in a
document I've been calling experiments for integrating Rebol with
Windows, anyway here is the section on STIO I was going to post:
Rebol[Title "reb-wscript experiments"]
test: "c:\winnt\system32\cscript.exe domainname.vbs"
call/output test %output.txt
test: read %output.txt
parse test[thru "reserved." copy text to end]
test: trim text
write %output.txt test
dim wmi, textout
Set wmi = GetObject("winmgmts:").InstancesOf ("Win32_ComputerSystem")
textout= "Rebol" & vbcrlf & "Domains: "
for each System in wmi
textout= textout & "[DomainName " & System.Domain & "]"
This is a bad example, was going to rework it so that domainname.vbs
wrote out an object.
Here's the pertinent text from the larger document:
Thirdly there is the possibility of accessing external libraries via
rebol if one has Rebol/view pro and other more feature rich versions,
this is as I understand also available in the sdk version. I must admit
that I don't like this too much, maybe it is because I haven't seen a
lot of examples yet, just the tutorial on RT but working with libraries
in this way seems bulky.
It seems to me that there should be an interim methodology, that of
returning objects etc. as Stdout of command line calls.
Of course I am probably thinking along these lines mainly because for me
Rebol is most likely to be used for short hacks, mainly due to structure
of licensing agreement.
However, as the example of std.r and domainname.vbs shows, it is
There are a number of large areas of Windows information that could be
accessed via a standard library of scripts that I suppose would do
nothing more than write very simple objects to Rebol.
Of course one could always just do one's own, but I think it might be a
better idea to build some common ones. For example a WMI one, an ADSI
These little Rebol/Wscript libraries should probably have a common
dialect, haven't given much thought to what it should do, preferring to
open discussion on the matter, although one thing I suppose would be to
allow a script to either do the rebol script, or generate the rebol
script by calling wscript and then do the script.
For obvious performance reasons.
This isn't exactly what you were looking for, rather it is a suggestion
for building what you were looking for, with hoped for input, comments