17 July 2015, 14:21 | #61 |
Registered User
Join Date: Feb 2014
Location: Germany
Posts: 261
|
Exercise:
Above code translates characters 00 - 1f, but what happens when displaying values bigger 128 ($80). Add a set of characters to be replaced to avoid unwanted line breaks. |
01 August 2015, 22:17 | #62 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,324
|
I guess you haven`t posted an example of how to get output of external commands using RXSET. Recently I tried this (works):
Code:
ADDRESS COMMAND cmd = 'C:WHDLoad' 'RXSET' verstr '`Version' cmd'`' /* Set version string to clip "verstr" */ str = GETCLIP(verstr) /* Get the clip */ CALL SETCLIP(verstr) /* Delete the clip else it will stay until a reboot */ |
01 August 2015, 23:53 | #63 |
Registered User
Join Date: Feb 2014
Location: Germany
Posts: 261
|
That's a clever trick to store DOS results in global cliplist.
AmigaOS isn't case sensitive and you are allowed to use double quotes if readability is a problem. Code:
/**/ ADDRESS COMMAND cmd = 'C:lha' rxset verstr "`"version cmd"`" /* Set version string to clip "verstr" */ str = GETCLIP(verstr) /* Get the clip */ say str SETCLIP(verstr) /* Delete the clip else it will stay until a reboot */ This might work with Requestfile as well. |
02 August 2015, 01:05 | #64 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,324
|
I forgot to mention that it is "only" an alternative to redirect to x, OPEN() x and read it, if you don`t want to use it for some reason.
It seems so that you havn`t to use the external command RXSET. Following works too: Code:
CALL SETCLIP('verstr', '`version c:whdload`') |
02 August 2015, 15:35 | #65 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,324
|
From Shell this works (version string is in clip):
Code:
rx "cmd='`version c:lha`'; CALL SETCLIP('verstr', cmd); SAY GETCLIP('verstr')" Code:
cmd='`version c:lha`' CALL SETCLIP('verstr', cmd) SAY GETCLIP('verstr') |
02 August 2015, 16:34 | #66 |
Registered User
Join Date: Feb 2014
Location: Germany
Posts: 261
|
I doubt it will work any other way than calling or invoking with shell involved. The "`" is interpreted by cli not by Rexx. It forces command interpreter to use returned output.
In :>rx "cmd='`version c:lha`' .... the symbol is initialized with "lha 2.1" not with "version c:lha" as this is what cli reads and executes before rx is invoked with argument string. This will not work in a Rexx script because of those "slanted apostrophes". Rexx can't interprete this, you have to submit it using quotes or it is an unidentified token. If you do so, it is handled as a string, thus you don't get the result of version command but "version c:whdload" as cliplist entry. Last edited by BigFan; 02 August 2015 at 16:50. |
29 January 2018, 16:29 | #67 |
Posts: n/a
|
So hey, I know this is an old post, but I'm having a problem with the Open() and ReadLN() ARexx commands. I'm getting the message
**** Error 13 in line #: Host Environment Not Found on the line that has: Open('infile',tempfile,'r') Tempfile is set tempfile='t:binkdstatus' and the file 't:binkdstatus' exists and has about 40+ lines of text. I'm running the AmiKit X version of WinUAE and its supposed to have DirectoryOpus installed. Last edited by Fjolsvith; 29 January 2018 at 16:36. |
29 January 2018, 16:41 | #68 |
Registered User
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
|
total arexx noob here, but thinking about sys:system/rexxmast has to run?
if not, just ignore the above |
29 January 2018, 17:27 | #69 |
Posts: n/a
|
What I'm trying to do is write a script that checks to see if binkd is running (using Status) and then relaunch it if not. Binkd shuts itself down on my system after a session, for some reason.
I was sending the output of Status to t:binkdstatus. Then I was going to ReadLN that file and look for the binkd program. If it was running, the script would wait 5 minutes and then repeat. If not, launch binkd and then wait 5 minutes and repeat. |
29 January 2018, 18:07 | #70 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,324
|
Try "CALL Open('infile',tempfile,'r')" or "myRC = Open('infile',tempfile,'r')". Don't forget to close "infile" later.
Maybe it is better to use SETCLIP() and GETCLIP() instead, to avoid r/w to file. |
29 January 2018, 20:22 | #71 |
Posts: n/a
|
Can you read just a line of text with GetClip()?
|
29 January 2018, 20:26 | #72 |
Posts: n/a
|
This is the code I'm trying to get to work:
Code:
Options RESULTS address 'status >t:binkdstatus' tempfile='t:binkdstatus' CALL Open('infile',tempfile,'r') foundbinkd='false' do while ~EOF('infile') text=ReadLn('infile') text=SUBSTR(text, 30) if text='binkd' then found='true' end Close('infile') |
29 January 2018, 22:58 | #73 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,324
|
Change
Code:
address 'status >t:binkdstatus' Code:
address command 'status >t:binkdstatus' |
30 January 2018, 02:02 | #74 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,374
|
|
30 January 2018, 20:19 | #75 |
Posts: n/a
|
Alright, it still doesn't open the file. Here is the code:
Code:
Options RESULTS Address COMMAND 'status com=binkd >t:binkdstatus' foundbinkd='false' If OPEN('infile', 't:binkdstatus' 'READ') = 1 then if LINES('infile') = 1 then foundbinkd='true' say foundbinkd Close('infile') if foundbinkd = 'false' then Address COMMAND 'binkd -s mail:binkd/binkd.cfg' |
30 January 2018, 23:09 | #76 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,324
|
@idrougge:
Yes, I know and in this case it isn't needed but I didn't knew the script and if you do some more stuff it is necessary. @Fjolsvith: I think it can't work this way. First, make sure that the COM= string is correct. Type status in shell to see the correct one. E.g. it could be COM=C:binkd or something else. Depends on how it was started. Second you need to evaluate the contend of t:binkdstatus like you did before with READLN(). Maybe it is enough to check if it is empty (binkd not running) then launch it. |
30 January 2018, 23:22 | #77 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,374
|
Code:
ADDRESS COMMAND 'Status COM=binkd >NIL:' IF RC=5 THEN ADDRESS COMMAND 'binkd -s mail:binkd/binkd.cfg' |
31 January 2018, 00:40 | #78 |
Posts: n/a
|
|
15 February 2018, 22:09 | #79 |
Registered User
Join Date: Jan 2018
Location: Utrecht, NL
Posts: 15
|
Hi, I've had an amiga for over 30 years, so I thought it's about time to write my first Arexx script... :-)
But seriously, I've dug out my Amiga again, and now I'm trying to write a little script for DirOpus (4) to replace an icon with another icon while preserving defaulttool and tooltypes (using rexxtricks.library functions). It's all working pretty well thanks to some hints in this thread. The only thing missing is that when I've deleted the destination icon, replaced it with the new icon and put back the properties, the destination window does not show the icon file until I manually refresh, ie. DirOpus does notice that I deleted a file (I do that with a diropus command) but doesn't notice I put it back (I call the CLI for that, because using the diropus copy command asks me if I want to replace, even though the file is already gone). A couple of questions: - Is there a command to refresh the directory listing? - Is there a way to let the copy command automatically overwrite? Or maybe all of my questions could be answered by: - Is there a list of commands, syntax and params for DirOpus Arexx commands? |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AmigaDOS scripting resources | Photon | Coders. System | 26 | 19 March 2018 14:51 |
Very Basic Scripting. Confused. | marduk_kurios | Coders. System | 5 | 06 February 2014 11:13 |
UAE Scripting Layer | FrodeSolheim | support.FS-UAE | 15 | 26 January 2014 15:56 |
C= 64 BASIC as a Scripting Language | Charlie | Retrogaming General Discussion | 2 | 17 November 2008 14:23 |
|
|