Passing a multiline variable as argument to a Python Action script

Hi Guys,

I’m trying to pass a variable with multiple lines of text as an argument to a python action script.
(The python action sends the argument text to google chat).

I’m not sure if its possible to have the argument passed as a multiline argument
(please let me know if this is possible)

But, my python script does support multiple arguments and can send each argument in a new line to the chat like so:

SendToGoogleChatRoom.py “this is line 1” “this is line 2” “this is line 3”

Can I somehow break my %msg% variable that consists of multiple lines
to multiple arguments wrapped in quotes?

%msg% =

this is line 1
this is line 2
this is line 3

I tried passing the following expression as an argument to the Python action script:

$Utils.GetString(%msg%).SplitWithQuotes(“\r\n”,“double”,false,true)$

(tried \n , \r\n and other arbitrary separators I’ve added to the end of lines in %msg%

But it does not seem to work as I’ve expected.

Is there a way to break a multiline variable to double quotes wrapped arguments per line?

Ok I got it while I was writing the question I read the docs for Expression Objects
a bit more in depth, and figured it out:

$Utils.GetString(%msg%).Split(“\r\n”,true,true).Join(" ",“double”,true)$

I figured I’d still post it here along with the answer
just in case it helps anyone else in the future… :slight_smile:

1 Like