|
|
|||||||
I dont know whether this has been discussed before... Often I want to postprocess some output from a Shell command - Ok, pipe it to a temp file and read it in - thats fine, works. But what about an external command (KiXpipe say) that could make that output stream available inside a script, this is what I am getting at... code: I just think this would make some of the thorny command output trapping exercises more reliable and elegant. If I have missed this in the 2001 manual - just shoot me now. Mark If this is regarded as a good idea, I cant take credit - REXX does this on NT - its called RXQUEUE or something. [ 16 August 2001: Message edited by: Mark Antrobus ] |
||||||||
|
|
|||||||
Mark, I'll second your idea - in fact - I think this is one of the best and most usefull KiXtart suggestions I've ever heard ... Just imagine - not more kludgy file piping and re-reading ... -Shawn |
||||||||
|
|
|||||||
Dear, We agree with Shawn. It is a great idea, but we think that it can cost
Greetings. |
||||||||
|
|
|||||||
Very interesting... Instead of an external program however, it should be handled internally. Something like: Returns: It would be nice to not be encumbered with file I/O and all the overhead (create, open, read, error check, close, delete) associated with it. Also, some external commands could be run without %comspec% as it would not be needed for the usual > or | operations. |
||||||||
|
|
|||||||
Les, Yeah, that's an even better idea ... but while we're waiting for this to be embedded in KiXtart, why can't "someone" write a PIPE() UDF to do exactly this (just like you laid out ... totally doable ... you busy today ? Kinda crappy weather anyway ... -Shawn |
||||||||
|
|
|||||||
Shawn, Working for "HoneyDo Construction" this weekend and stealing CPU time right now. Anyhow, I'm no programmer, just an idea man (hair-brained). It could probably be done with current version but may cost a pound to save a penny, performance wise. Will watch this thread when I can to see what you may brew up. |
||||||||
|
|
|||||||
Les, Ahhh yes - you work for the same company that Doc, Jochen and I work for ... Know exactly what you mean my friend ... It's a sad sight when Shawn sneaks quietly back into the house, crawls down the basement stairs (on his belly), and silently tippy-taps on keyboard, checking-in on kixtart.org ... I'll see what I can home-brew later on ... of course ... it would still involve piping stuff out to a temporary file ... but it would be nice to have it packaged in a single UDF - no ? In fact, if memory serves, there's a tempfile() UDF over at scriptlogic that might fit in quite nicely here ... l8r -Shawn |
||||||||
|
|
|||||||
Hmmm.... nothing like having a nice dinner, then sitting down and doing a little kixtart koding, eh Les ? Don't know about you, but I never get tired of Turkey leftovers ... burrrppp ... excuse me ... Anyway .... here'a a rather hastily written, over-wraught, tortured start to this endeavor ... the UDF is called PIPE() and it goes like this ... $output = pipe("net user") for each $line in output code: -Shawn [ 15 October 2001: Message edited by: Shawn ] |
||||||||
|
|
|||||||
Shawn, Code runs off your fingers like words from the lips of a poet in love! I guess, if you want to use the $array, you need to use GLOBAL instead of DIM. And what's this REDIM stuff my friend... I thought you said you weren't a big user of it. Looks like you have a firm handle on it. Will you be adding it to your |
||||||||
|
|
|||||||
cool! No need to GLOBAL $array, because the PIPE() UDF returns the value of $array to the caller. $return = pipe("dir c:\*.exe") Bryce |
||||||||
|
|
|||||||
Sorry Bryce, perhaps my novice programming is showing... If I add the following to the script, it errors. code: But, if I change DIM $array[9] to GLOBAL $array[9], it works. |
||||||||
|
|
|||||||
There was a young man from Nantucket Who always redirected shell to Bit Bucket He said "PIPE() is quite funky" "But redimming can be chunky" "I'm going back to flatfiles, so fu*k it." -Shawn |
||||||||
|
|
|||||||
Yep, yep, yep... It's my amateur programming showing through... Did not recognize that $output was an array for lack of []. So this works: code: Shawn, |
||||||||
|
|
|||||||
ok Well - if anything - this UDF gives us a sampler of how tasty a builtin function like PIPE() could be ... very handy me thinx ... -Shawn |
||||||||
|
|
|||||||
I didnt realise this thread had woken up again... Shawn, Les, MCA, As Shawn commented - it does make housekeeping temp files etc much easier- and makes for elegant coding (as does Shawns UDF). Its also very fast. Mark [ 18 October 2001: Message edited by: Mark Antrobus ] |
||||||||
|
|
|||||||
Mark, Yeah, it's funny how threads can just re-awaken, then twist and turn in different directions ... But your talk about the REXX datastack got me to thinking (a dangerous thing) ... I'm wondering if it's possible to use the Windows CLIPBOARD as a data staging area. I think there are reskit-like programs for piping DOS command output to the clipboard. Then, if one could use COM to read this data back into the script ... hmmm .... kinda like this (concept only) : shell 'cmd /c dir c:\*.exe | clipbrd.exe' Something like that anyway. Thing is, I haven't done any research on this and I'm not too sure if there is a clipboard object ??? Just throwing this out as a concept ... using the clipboard in this fashion would sure be handy ... -Shawn |
||||||||
|
|
|||||||
whoops ... totally missed this thread ! Clipboard abuse as container for shell output ??? would be really a workaround ... But I apprehend that would be not that simple Jochen btw ... what is REXX ??? |
||||||||
|
|
|||||||
Jochen REXX is quite similar to Kix, its an interpreted language, good string handling, good OS interfaces etc. I think its been around 15+ years, started on VM and MVS (IBM Mainframes) and has been fairly poular amongst the IBM Mainframe Dinosaurs (like myself ) Nowadays it runs on most platforms (DOS,Windows anything etc) and free versions are available for most of them. We converted to kix because of its superior Windows OS interfaces, plus its is clearly being developed and REXX has pretty much stabilised. Mark. |
||||||||
|
|
|||||||
... and there's even a version shipped with NTreskit. OLE automation support ... Scary !!! btw. who is Regina ???
|
||||||||
|
|
|||||||
Does the OLE support look familiar at all ? w32CreateObject Like with KiXtart 2001, I think REXX is long over-due for a make-over eh ? -Shawn |
||||||||
|
|
|||||||
Maybe both camps should merge and we can call it RiX The NTReskit util is called CLIP and is used like this... Clip version 1.1. Copyright 1997 Microsoft Corporation. Command-line output redirector. Examples: clip < readme.txt
Shawn, great UDF. cj |
||||||||
|
|
|||||||
RiX - LOL LOL LOL Hey ceej, are you back or what ? Every now and then you pop back into the board and I think "hey cj's back" - then you fart-off for another 2 to 3 weeks - whazzup my brother ? Work been keeping you busy ? Family ? - How's little Frances ? -Shawn |
||||||||
|
|
|||||||
cj, Check your rear view mirror... I'm 100 behind you and with this totally useless post, make that 99. Learning from the master, Shawn, currently at 1745. Looks like maybe we're a step closer to no file I/O and the overhead... |
||||||||
|
|
|||||||
Rix - Isn't that what Australians call their Dog ? |
||||||||
|
|
|||||||
No Mark, that's what New Zealanders call their dog. |