| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 | 1. CScript #562 Posted by: guidance 2002-10-15 19:18:03 Last edited by: guidance 2010-12-13 13:29:49 (Total edited 1 time) | Since the COM interface support is not so satisfied in RQ and other languages, a good bridge/glue is Windows Script Host, i.e. VBScript. For example, I have a mail server ActiveX component, but neither RQ nor PHP COM function can interface with it properly, only use VBS, works very well. You can run "CScript MyScript.VBS", just as a normal DOS command, with command line parameters, and without user interface, it will greatly complement the shortage of RQ for COM manipulation, including all MS-Office components. I also ever used VBS CreateObject to operate IE and built a small intranet search engine/spider.
The only problem is, I still don't know how to capture the output of a console. There's an example, but didn't verified, could anybody help? ConsoleCapture.bas: | 2. Re: CScript #599 Posted by: 2002-10-24 13:24:37 | Right! And even in an RQ program you can SHELL "cscript xyz.vbs" In QuickBasic I had apps that read the screen, but the instructions to do so are different in RQ but they are there! Maybe the trick is to (1) make the console app write the results in a known location by using the locate instruction (My programs would LOCATE 2,1: SHELL "xyz.exe arg1 arg1" etc and since the output of xyz always has a known format I could read screen lines and get the output info into my QuickBasic or RQ program). Basically you need a FUNCTION getscreenline(row%) which will use the RQ ability to read the characters and make a string which you might then trim$ or whatever. Once that little function is written, then just forget the details and get any console line as a string in your RQ program. I would share the code for such a function but I don't have one using the RQ instruction to retrieve a character. Best wishes, | 3. Re: CScript #608 | I mean capture the stdout, even no console screen showed. If use cscript to operate Excel with "CreateObject", we'd better don't let console window be displayed, just like DOS redirect, is it possible to "redirect" to memory (pipe?) rather than to a file? | 4. Re: CScript #800 Posted by: 2003-02-20 22:47:11 | Maybe an array? | 5. Re: CScript #801 Posted by: yoingco 2003-02-21 01:11:19 | Hi Guidance.
Use either or both ConsoleCapture.BAS, ReadPipe.BAS and Console2000 to get output. You could:
get mouse/key output
get (use) readpipe, readconsoleoutput, etc functions to read characters and the like.
It depends exactly what you want. As for not using the console window. I would of thought your eventual application would have to use a console. The pipe method means creating a seperate process/thread to specifically monitor the pipe. But readFile works well (i.e redirect/duplicate the console output handle so it goes into your memory area/file area (buffer). As said. Look in the above codes.
regards
john | 6. Re: CScript #802 Posted by: guidance 2003-03-01 15:21:02 Last edited by: guidance 2010-12-13 13:32:06 (Total edited 1 time) | Hi, John, thanks for your hints! Seems ReadPipe.BAS is not here, could you help to upload it? Thanks!
| 7. Re: CScript #804 Posted by: yoingco 2003-03-01 21:53:11 | Hi Guidance.
Sorry! Deleted it long time ago! In fact sometimes I upload to your site to act as a backup for me! So I can just download my stuff from your site!
I did investigate your output thing further. In both C and the RapidQ ConsoleCapture.BAS codes (C from the net - search google for "Console Capture") I saw that both methods do as follows:
execute your RapidQ programme. This gives the programme a StartupInfo structure, which you can obtain from api GetStartupInfo(). From there you create your file or pipe or whartever. You pass the file handle or pipe handle (or Memory Handle) to the startupinfo structure`s input and/or output handle. You then monitor the pipe as "normal" with a CreateProcess call (well defined in ConsoleCapture.BAS). Basically. You are changing the startupinfo so that the next process (newly created process - CreateProcess) is now using the new input/output handles. The old process (the one with the original startupinfo) is your original RapidQ programme (the one that you are executing first).
Hope that helps.
regards
john | Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |
|
|