Hello Greg,
I've never written an HAScript before...but I've programmed in a lot of languages and environments. I dug into the doc a bit and found that in order to do what you want, you need to import the java classes to do that conversion. I did it with a simple String.replace() method call. Here's my simple script:
<HAScript name="ReplaceChars" description="" timeout="60000" pausetime="300" promptall="true" blockinput="true" author="MichaelSwenson" creationdate="Apr 24, 2024, 6:03:25 PM" supressclearevents="false" usevars="true" ignorepauseforenhancedtn="true" delayifnotenhancedtn="0" ignorepausetimeforenhancedtn="true" continueontimeout="false">
<import>
<type class="java.lang.String" name="javaString"/>
</import>
<vars>
<create name="$myString$" type="javaString" value="$new javaString('This Is A Test')$" />
<create name="$newString$" type="string" value="" />
</vars>
<screen name="Screen1" entryscreen="true" exitscreen="true" transient="false">
<description >
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
</description>
<actions>
<varupdate name="$newString$" value="$myString.replace(' ','+')$" />
<input value="$newString$" row="0" col="0" movecursor="true" xlatehostkeys="true" encrypted="false" />
</actions>
<nextscreens timeout="0" >
</nextscreens>
</screen>
</HAScript>
------------------------------
Michael Swenson
Software Engineer
IBM
------------------------------