IBM i Access Client Solutions

 View Only

HAScript question: Replace variable blank space with a character?

  • 1.  HAScript question: Replace variable blank space with a character?

    Posted Thu June 29, 2023 09:40 AM

    Here is my current script, which reads address information from the screen and then searches for that address in Google Maps.  Unfortunately, Google Maps doesn't allow for blank spaces.  So, instead of "123 Main St", I have to use "123+Main+St".  Has anybody figured out how to replace blank spaces in a variable with characters?

    (Yes, I stopped at $PropertyStreet1$ as soon as I figured out the blank spaces were the problem.  I'll work on combining all the address variables later.)


    <HAScript name="Google Maps" description="Google Maps" timeout="60000" pausetime="300" promptall="true" blockinput="true" author="Greg Cornett" creationdate="June 28 17, 2023" supressclearevents="false" usevars="true" ignorepauseforenhancedtn="true" delayifnotenhancedtn="0" ignorepausetimeforenhancedtn="true" continueontimeout="false">

        <vars>
          <create name="$AstecScreen$" type="string" value="" />
          <create name="$PropertyStreet1$" type="string" value="" />
          <create name="$PropertyStreet2$" type="string" value="" />
          <create name="$PropertyCity$" type="string" value="" />
          <create name="$PropertyState$" type="string" value="" />
          <create name="$PropertyZIP$" type="string" value="" />
        </vars>


        <screen name="Screen1" entryscreen="true" exitscreen="false" transient="false">
            <description >
                <oia status="NOTINHIBITED" optional="false" invertmatch="false" />
            </description>
            <actions>
                <extract name="&apos;AstecScreen&apos;" planetype="TEXT_PLANE" srow="1" scol="2" erow="1" ecol="38" unwrap="false" continuous="false" assigntovar="$AstecScreen$" />
                <if condition="$AstecScreen$ == &apos;CLM300                       CLAIM IN&apos;" >
                      <input value="&apos;[pf6]&apos;" row="0" col="0" movecursor="true" xlatehostkeys="true" encrypted="false" />
                </if>
            </actions>
            <nextscreens timeout="0" >
                <nextscreen name="Screen2" />
            </nextscreens>
        </screen>

        <screen name="Screen2" entryscreen="false" exitscreen="true" transient="false">
            <description >
                <oia status="NOTINHIBITED" optional="false" invertmatch="false" />
                <numfields number="141" optional="true" invertmatch="false" />
                <numinputfields number="0" optional="true" invertmatch="false" />
            </description>
            <actions>
                <if condition="$AstecScreen$ == &apos;CLM300                       CLAIM IN&apos;" >
                      <extract name="&apos;Extract&apos;" planetype="TEXT_PLANE" srow="22" scol="14" erow="22" ecol="43" unwrap="false" continuous="false" assigntovar="$PropertyStreet1$" />
                      <extract name="&apos;Extract&apos;" planetype="TEXT_PLANE" srow="22" scol="45" erow="22" ecol="74" unwrap="false" continuous="false" assigntovar="$PropertyStreet2$" />
                      <extract name="&apos;Extract&apos;" planetype="TEXT_PLANE" srow="23" scol="18" erow="23" ecol="37" unwrap="false" continuous="false" assigntovar="$PropertyCity$" />
                      <extract name="&apos;Extract&apos;" planetype="TEXT_PLANE" srow="23" scol="47" erow="23" ecol="48" unwrap="false" continuous="false" assigntovar="$PropertyState$" />
                      <extract name="&apos;Extract&apos;" planetype="TEXT_PLANE" srow="23" scol="56" erow="23" ecol="60" unwrap="false" continuous="false" assigntovar="$PropertyZIP$" />
                      <input value="&apos;[enter]&apos;" row="0" col="0" movecursor="true" xlatehostkeys="true" encrypted="false" />
                      <runprogram exe="&apos;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&apos;" param="&apos;https://www.google.com/maps/place/&apos;+$PropertyStreet1$" wait="false" assignexitvalue="" />
                </if>
            </actions>
            <nextscreens timeout="0" >
            </nextscreens>
        </screen>

    </HAScript>



    ------------------------------
    Greg Cornett
    ------------------------------