Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Command/Pro call interact with external program using STDIO

From: bry:itnisk at: 29-Jan-2003 11:42

>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: Std.r 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 do %output.txt domainname.vbs dim wmi, textout Set wmi = GetObject("winmgmts:").InstancesOf ("Win32_ComputerSystem") textout= "Rebol[]" & vbcrlf & "Domains: " for each System in wmi textout= textout & "[DomainName " & System.Domain & "]" next WScript.StdOut.Write(textout) 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 feasible. 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 one. 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 etc.