SendRexxCommand does not return result

Report any Hollywood bugs here
Post Reply
amiga23
Posts: 17
Joined: Thu Jan 30, 2014 6:01 pm

SendRexxCommand does not return result

Post by amiga23 »

When using SendRexxCommand no result is returned.

Using a simple ARexx Script works fine.

Tested on AmigaOS 3.1.4.1 and MorphOS 3.13

Server:

Code: Select all

@VERSION 8,0

Function p_EventFunc(msg)
  Switch msg.action
  Case "OnARexx"
    Switch msg.command
    Case "EXIT"
      DebugPrint("Exit received! Quitting now.")
      End
    Case "GETSTRING"
      DebugPrint("GetString called")
      Return("GETSTRING called")
    Case "GETNUMBER"
      DebugPrint("GeNumber called")
      Return(10)
    Default
      Local t = SplitStr(msg.args, "\0")
      DebugPrint(msg.command, "called with", msg.argc, "argument(s)")
      For Local k = 1 To msg.argc
        Return("Argument " .. k .. ":" .. t[k - 1])
      Next
    EndSwitch
  EndSwitch
EndFunction
CreateRexxPort("MYCOOLPORT")
InstallEventHandler({OnARexx = p_EventFunc})
Repeat
  WaitEvent
Forever

End
Client:

Code: Select all

@VERSION 8,0

res$ = SendRexxCommand("MYCOOLPORT","GETSTRING")

DebugPrint("Result: " .. res$)


res$ = SendRexxCommand("MYCOOLPORT","GETNUMBER")

DebugPrint("Result: " .. res$)

res$ = SendRexxCommand("MYCOOLPORT","SOMETHING 'SOMEARGUMENT'")

DebugPrint("Result: " .. res$)    
ARexx test script:

Code: Select all

/* remember the first line of every Rexx script must be a comment */
OPTIONS RESULTS

/* the port of our Hollywood script is now the host */
ADDRESS MYCOOLPORT

GETSTRING

SAY RESULT

GETNUMBER

SAY RESULT

SOMETHING "SomeArgument"

SAY RESULT 

PEB
Posts: 522
Joined: Sun Feb 21, 2010 1:28 am

Re: SendRexxCommand does not return result

Post by PEB »

Try this for your client:

Code: Select all

@VERSION 8,0

res$ = SendRexxCommand("MYCOOLPORT","options results\nGETSTRING\nreturn result")

DebugPrint("Result: " .. res$)


res$ = SendRexxCommand("MYCOOLPORT","options results\nGETNUMBER\nreturn result")

DebugPrint("Result: " .. res$)

res$ = SendRexxCommand("MYCOOLPORT","options results\nSOMETHING 'SOMEARGUMENT'\nreturn result")

DebugPrint("Result: " .. res$)

amiga23
Posts: 17
Joined: Thu Jan 30, 2014 6:01 pm

Re: SendRexxCommand does not return result

Post by amiga23 »

Thank you for this work arround, works great

Code: Select all

@VERSION 8,0

Function _SendRexxCommand(port, command)
  DebugPrint("SendRexxCommand >>> "..SendRexxCommand(port,command))
  DebugPrint("  With options >>>> "..SendRexxCommand(port,"OPTIONS RESULTS;"..command..";RETURN result"))
  DebugPrint("RunRexxScript >>>>> "..RunRexxScript("ADDRESS "..port..";"..command, True))
  DebugPrint("  With options >>>> "..RunRexxScript("ADDRESS "..port..";OPTIONS RESULTS;"..command..";RETURN result", True))
  DebugPrint("")
EndFunction

_SendRexxCommand("MYCOOLPORT","GETSTRING")

_SendRexxCommand("MYCOOLPORT","GETNUMBER")

_SendRexxCommand("MYCOOLPORT","SOMETHING 'SOMEARGUMENT'") 

Post Reply