ARexx port: How to return a list of values

Discuss any general programming issues here
Post Reply
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

ARexx port: How to return a list of values

Post by mrupp »

Hi there

I'm implementing an Arexx port for my RapaGUI based "SonosController" and am trying to follow these guidelines here:
https://wiki.amigaos.net/wiki/UI_Style_ ... rning_Data

It says when returning a list of values they should be returned as an array.
In the HW docs I only found an example returning a single value (which works fine). I tried to return an array like this:

Code: Select all

Return({'value 1', 'value 2'})
but this didn't work out on the ARexx script's side.

Is this possible or not?

Thanks for your help,
Michael
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ARexx port: How to return a list of values

Post by airsoftsoftwair »

What is the context here? Are you trying to return values to ARexx when getting the "OnArexx" message or what are you trying to do?
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: ARexx port: How to return a list of values

Post by mrupp »

Yes, exacly.
I'm trying to return not only one but a list of values back to the ARexx script that has called a function which I handle in the "OnArexx" event.
Here's an excerpt from https://wiki.amigaos.net/wiki/UI_Style_ ... rning_Data (chapter "Returning Data")
When the command returns multiple records, it should allow the user to specify a stem variable to place the contents in. For example, a command that would return the names of the loaded documents in a text editor would normally return information in the RESULT field, but if the user chooses to place the information in a stem variable, he could specify:

Code: Select all

GETATTRS DOCUMENTS STEM DocList.
which would return:

Code: Select all

  DocList.count = 3
  DocList.0 = Letter to John Doe
  DocList.1 = Notes on Standards
  DocList.2 = Addresses of the Stars
In the above example, DocList.count contains the number of records in the array. Also note that the elements do not contain quotes around the information.
In my case (app SonosController), I would like to return a list (array?) of track names to the ARexx script with a command to query the current playlist.
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ARexx port: How to return a list of values

Post by airsoftsoftwair »

mrupp wrote: Sun Jan 21, 2024 1:03 pm Yes, exacly.
I'm trying to return not only one but a list of values back to the ARexx script that has called a function which I handle in the "OnArexx" event.
I don't think that this is technically possible. The interface in rexxsyslib.library expects all return values to be strings so Hollywood can't really pass anything else back to ARexx. So if you want to return a list or something, I think you'd manually have to "stringify" that list somehow, maybe by embedding the individual list entries in quotes or something in one large string.
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: ARexx port: How to return a list of values

Post by mrupp »

OK, thanks for clarifying this.
Post Reply