SendRexxCommand(): Issues with quotes in the command

Report any Hollywood bugs here
Post Reply
bitRocky
Posts: 105
Joined: Fri Nov 14, 2014 6:01 pm

SendRexxCommand(): Issues with quotes in the command

Post by bitRocky » Sun Mar 10, 2019 7:44 pm

Hi,

I can't use quotes in SendRexxCommand(), it seems so that they get removed before the command is send to the rexx port!?

Code: Select all

Function p_MOSToast(text$, t)
Local str$
	str$ = "BUBBLE \""..text$.."\""
	If HaveItem(t, "x") Then str$ = str$.." X "..t.x
	If HaveItem(t, "Y") Then str$ = str$.." Y "..t.y
	If HaveItem(t, "Font") Then str$ = str$.." Font \""..t.font.."\""
	If HaveItem(t, "Skin") Then str$ = str$.." Skin \""..t.skin.."\""
	If HaveItem(t, "Image") Then str$ = str$.." Image "..t.image
	If HaveItem(t, "Color") Then str$ = str$.." Color "..t.color
	If HaveItem(t, "Mouse") Then str$ = str$.." MOUSE"
	If HaveItem(t, "Center") Then str$ = str$.." CENTER"
	If HaveItem(t, "Duration") Then str$ = str$.." Duration "..t.duration
	DebugPrint(str$)
	res$ = SendRexxCommand("MAGICBEACON", str$)
	If res$ Then DebugPrint("res = "..res$)
	Return res$
EndFunction

p_MOSToast("Hello Center", {x=200, y=500, font = "Lux/26", Skin="Woo0t", image="Connected", color="00ff00"})
A bubble with "Hello Center" should appear, but only a "Hello" bubble appeared and the bubble is centered, which tells me that only "Hello" is treated as the bubble message and "Center" is treated as a new argument.

This is the complete command printed right before SendRexxCommand():
BUBBLE "Hallo Center" X 200 Y 500 Font "Lux/26" Skin "Woo0t" Image Connected Color 00ff00

User avatar
jPV
Posts: 283
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: SendRexxCommand(): Issues with quotes in the command

Post by jPV » Mon Mar 11, 2019 7:21 am

I think it's ARexx itself that gets confused. Try putting the whole string inside other kinds of quotes (if you use " in the string, put it in ', or vice versa).

Try adding this before your debugprint line:

Code: Select all

str$="'" .. str$ .. "'"

User avatar
jPV
Posts: 283
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: SendRexxCommand(): Issues with quotes in the command

Post by jPV » Mon Mar 11, 2019 8:56 am

And to get ' included in the texts (for example with "don't" words etc), convert ' characters to double ':

Code: Select all

str$=ReplaceStr(str$, "'", "''")
(before the previous line of course)

bitRocky
Posts: 105
Joined: Fri Nov 14, 2014 6:01 pm

Re: SendRexxCommand(): Issues with quotes in the command

Post by bitRocky » Mon Mar 11, 2019 2:19 pm

jPV wrote:
Mon Mar 11, 2019 7:21 am
I think it's ARexx itself that gets confused. Try putting the whole string inside other kinds of quotes (if you use " in the string, put it in ', or vice versa).

Try adding this before your debugprint line:

Code: Select all

str$="'" .. str$ .. "'"
That did it!

Strange, its not neccessary if I use RxCmd to show a bubble, I just have to escape the double quotes with an asterix

Code: Select all

RxCmd MAGICBEACON "Bubble *"Hello World*""

User avatar
jPV
Posts: 283
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: SendRexxCommand(): Issues with quotes in the command

Post by jPV » Mon Mar 11, 2019 3:07 pm

RXCmd might do some own magic there, maybe it encapsulates the line automatically.. and * is the escape character in the shell, so it's used when launched directly from the shell prompt... but if you write an ARexx script and try to use this from there, you'll have to do the same way like in Hollywood to get it work:

Code: Select all

/* test */
ADDRESS MAGICBEACON
'BUBBLE "hello world"'

Post Reply