> retrieving results.
Nope (well i dont know how).
> redirection and output piping.
Not sure what that is.
We dont get much to work with really. Sure there are plenty of things we can do but in the grand scheme of things we are locked down pretty good.
Things like this done in cmd.exe -
dir | sort
or
sort TextDoc.txt > SortedDoc.txt
or some of the more advanced like combining 2 commands on the same line with &&. There also ways, using cmd, to redirect the stdin stdout and stderr streams. It doesn't have all the power of a Bourne Shell, but some trick stuff can be done.
I've been reading "The Art of Unix Programming" for the past week or so and it's been very enlightening and a great read. So 2 days ago, based on my new found enlightenment, I began playing around with some Autolisp extensions (ADS) and then saw the blerp about WScipt in another thread this morning.
So, the extensions consists of 4 commands, openshell closeshell readshelldata and writeshelldata.
Useage is something like this to read from stdout
(setq handle (openshell "c:\\windows\\system32\\cmd.exe" "/c dir | sort"))
(while (/= nil (setq s (readshelldata handle))(princ s))(princ) ;; read the stream and print the results until there is nothing left in the stream
(closeshell handle)
the writeshelldata command isn't written yet, but the idea is your writing to stdin which in the inputs or stdin to other streams.
(setq handle (openshell "c:\\windows\\system32\\cmd.exe" "/c sort"))
;; for each item in a list, write to stdin which is directed to the sort routine
(foreach e '("Just" "a" "sample" "list") (writestreamdata handle e))
(while (/= nil (setq s (readshelldata handle))(princ s))(princ) ;; read the sorted items.
(closeshell handle)
Combine this with your own bat files, python code, whatever you can think of, how about these
http://gnuwin32.sourceforge.net/packages.html. I think it could be quite useful. Anyways, 2 days of coding and 2 versions already. Stuff is working but not polished and there are a couple implementation details to still figure out. I'll try and get something released in the next day or two.