I'd like to pull something off with AREXX but doesn't seem toi get it tow ork the way i want.
Here's the thing...i know about opening/reading/writing of files in AREXX, but can i catch output from an externally started program wihout the need of those file I/O?
This is what i'd like to achive:
test=ADDRESS COMMAND "version"
The above is just an example.
I don't think this is possible, but please prove me wrong.
I played around with quotation marks, but it doesn't seem to execute the command, unless i leave out the test= part, but then output obviously goes into console.
Is it possible in AEXX (maybe with a workaround or trick) or do i have to go the file I/O way either way? I want to produce as less overhead as possible as this script should go (if it ever works) into network startup, so it shouldn't do too much I/O to keep the error margin as small as possible.
Thanks
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg
Thank you, but that is exactly what i'm trying to avoid.
With your script a textfile is created, opened and then left.
I could delete it afterwards, but i explicitely don't want to create a file.
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg
Realistically, writing and reading a file in RAM: is not going to be noticable in terms of overhead, and it is the most normal solution for this, but I get your point.
An alternative which might seem a bit more clean (if you don't look behind the scenes) is to use C:RxSet and the ARexx GetClip() function.
Have to read up on RxSet then, never used that command
Thanks to both of you
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg
@Raziel Not exactly sure what you want but in an AmigaDOS script you can do this:
;AmigaDOS script Set vers `version` echo $vers
Note that the characters that look like single quotes are actually the character in the key to the left of the 1 key on most keyboards. The key has a ~ char with a ` char below it.
Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450
What i want to achieve is reading in a fraction of a website with cURL and process that further on in the AREXX script, but without the need of saving the string to a file first.
But i guess it's not possible.
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg
You probably won't benefit from RxSet then, nor probably using SetEnv or similar, because I assume you will be dealing with multiline data (such as HTTP headers). RxSet and SetEnv will only save the first line of the input.
If so, my best advice would be to simply redirect the output of curl into a file in RAM: and then read that file from ARexx and close and delete it afterwards. I think one or some of the third-party support libraries (rexxtricks? RMH? rexxarplib?) have a function to read a complete file into a stem variable, one line per stem, which might make this option a bit more neat for you. But I can't ATM see a way around a file.
BTW, you may already know this, but if you want to make sure you can run multiple copies of your script simultaneously, make the result of a PRAGMA('I') part of your temporary filename - this will make it unique.
I never used the PRAGMA var, but will try to next time.
I'm going to write it with file I/O then. Lets see how good it behaves while in network startup.
A DOS script isn't behaving really well, two out of three times blocking the boot with need to reboot. Pretty obviously my scripting though
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg
Obviously i'm ding something wrong with the IF THEN ELSE stuff as i'm getting an error:
Quote:
+++ Error 21 in line 64: Unexpected ELSE or OTHERWISE Command returned 10/21: Unexpected ELSE or OTHERWISE
I already learned that AREXX doesn't feature an ENDIF switch, but it does feature END (only for DO WHILE loops?).
How do i use that properly, so it doesn't always hit me when i use more than one command in an IF loop.
IF A > B THEN DO
ADDRESS COMMAND
ADDRESS COMMAND
ADDRESS COMMAND
ADDRESS COMMAND
ELSE
ADDRESS COMMAND
The above works fine when i leave out the last two lines, as soon as i add ELSE i'm getting the error.
Why? Unfortunately my manual is falling apart and it doesn't hold very much information regarding loops.
TIA
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg
Your DO needs to be paired with and END before the ELSE.
Since the ELSE branch only contains one statement, it's optional to wrap that in another DO/END pair, but I usually do it myself (just as I also use curly brackets in C/JS etc. even for a one-line branch). It's probably mostly a matter of taste.
But the main thing is: If you have a DO, then you need to end it with an END.
People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairytales of eternal economic growth. How dare you! – Greta Thunberg
The only solution would be not to use curl and get your file directly from Arexx. You can have an idea of how it works reading the sources of W3S, the Arexx web server.