Rx Window
10 messages in this thread
Hello. I have been trying to get the list results sent to my ARexx window
without any luck. Could someone show me how to send DOS results to an ARexx
window like the one I have here 'FilePtr' please?
if~open('FilePtr','con:0/20/640/109/ARexx Task/CLOSE','W') then exit 20 address
command 'delete #?.o' address command 'list #?.c' call writeln 'FilePtr',
'…Press RETURN to exit' call readln 'FilePtr'
Thanks for the hand…..Henry Williams
Henry,
The simple answer is that since you've opened it as a file, just use the
write() function to send the data out. Just like you would in C or ASM.
–Ben
…via AutoPilot
Thanks Ben. I'll give it a try. Would you know the answer to my other question?
I have been trying to use the conversion functions with a variable. The trouble
is that using the PULL command always converts lowercase to uppercase and I
therefore won't get the lowercase value. Know how I get by this?
Thanks again….Henry
Yep…
PULL is "shorthand" for (I think…) PARSE UPPER PULL; use the long,
specific version PARSE PULL. (I think)
–Ben
…via AutoPilot
T.33902
Henry,
Two answers: first the pull command is short hand for PARSE UPPER PULL
and we know what the UPPER does don't we? Just use PARSE PULL instead of PULL.
For the second question try this:
/*…*/
if ~open('FilePtr','con:0/20/640/309/ARexx Task/CLOSE','W') then exit
'list mine:Project/grammar/*.c > ram:temprexx'
if ~open('holder', 'ram:temprexx', 'R') then exit
do until eof('holder')
liner = readln('holder')
call writeln 'FilePtr', liner
end
'delete ram:temprexx'
call writeln 'FilePtr', '…Press RETURN to exit'
call readln 'FilePtr'
exit
If you work at it — I think using the pipe will allow you to do this with
writting to a temp file. If you do found out how to use the pipes I'd
appreciate you writting me back with the code.
-Tom
Thanks a lot Tom. I just bought the entire new set of RK manuals and intend to
have a lot of fun soon. I will definately write you back if I come up with the
code you want.
Regards Henry
Tom,
Basically, to use PIPE:, just treat it as a file (eg; OPEN it, such as
PIPE:MyCommand), and then use the AmigaDOS redirection to 'pipe' the
output to PIPE:MyCommand. From there, you just use READLN on your OPENed
PIPE:.. device.
If ~open(pipe,"PIPE:MyCommand") then
Do; say '** Error opening PIPE: **'; Exit 32; End
address 'COMMAND' 'LIST >PIPE:MyCommand' …..
Do while ~eof(pipe)
parse value readln(pipe) with ….
…
…
End
foo = close(pipe)
Real World:southern Illinois,USA Internet:ca0008 at siucvmb.siu.edu
Henry,
When you issue a DOS command from ARexx, the current STDOUT file is passed to
the command as the output stream. If you want to open your own window and use
it for the output from DOS commands, you'll need to first close the existing
STDOUT, then open your window using STDOUT as the name. Then the issued
command's ouptut will go to the ARexx program's window, along with anything
written by the ARexx program itself.
-Bill Hawes
Henry
As Ben says, you have to writech() or writeln() to the window.
However, since you are trying to redirect AmigaDOS commands, this is not
normally possible.
It is probably possible if you muck about with _STDOUTs etc., but this means
getting your hands *really* dirty and is probably not worth it!
Your best bet is to redirect the output to a temporary file, and then read and
print the file out, something like this:
/* */
call open('Output','con:10/10/300/100','w')
/* remember to check that your cd is correct */
ADDRESS COMMAND 'delete >t:temp #?.o'
success = open('tempfile','t:temp','r')
/* check file is ok..*/
data = readch('tempfile',65534)
call writech('Output',data)
good luck
Alex
Henry
I am sorry if my previous message gave the impression that
using 'STDOUT' was difficult. It is in fact the easiest!
A moment's lapse…
Here is the code you are after…
/* */
window = 'con:10/10/300/100/etc '
CALL close STDOUT
succ = open(STDOUT,window,'w')
SAY 'Now let's see…'
ADDRESS COMMAND 'dir ram:'
SAY 'Bye!'
CALL delay(1OO)
This is *much* easier than using pipes, which I think
someone else mentioned.
Alex