4 Replies Latest reply on Jun 7, 2013 2:14 PM by Hal DeVore

    TM-ART scripting

      How can I get a number from a page and then use it to compare against another number that would be the threshold?  On a page that TM-ART is logging into there is a line of text:  Transmissions Total Found: ???.  I need to be able to pull that number in that text and abort if it is >= 200.  Is there a way to do this?

        • 1. Re: TM-ART scripting
          Hal DeVore

          Hi, Lost


          Yes, it is possible to do all of that in TM ART.


          Where are you starting from?  Do you have a basic Workbench recording of the page with the text you want to check?  If not, that is the first order of business.  Use the Workbench to record the steps you want to perform in the normal case.


          After you have that working you will need to make some changes to the generated script.


          Run a Try Script on your script, then examine the TrueLog and find the page with the number you want to parse out.  In the TrueLog Explorer Rendered pane, select the number you want to test, then right click on it and select "Parse Selected Text into a Variable".  Take the defaults in the resulting dialog.


          That will change your script so that the text you had selected is extracted out into a script variable. In the Workbench Help, look at the WebParseHtmlBound.  That is the statement that was added by the wizard above.


          From there it is a fairly straightforward matter of coding. Use the number() function to convert the parsed text into a numeric value which you can then test.


          You can "abort" in a couple of ways depending on what you want to do.


          If you want to just end the script without causing an error, then use an if statement to only execute any remaining code when your value is small enough.


          If you want to throw up an error that will propagate out to Central, have a look at the RaiseError() function in the Help



          • 2. Re: TM-ART scripting

            Hal, thanks for the reply.  Programming is not simple for me, but I have a coworker who is champing at the bit to start on this.  However, when I highlight the number I want to compare, parsing it to a variable is not available.  Is there a different way to accomplish this?

            • 3. Re: TM-ART scripting
              Hal DeVore

              Since you can't parse it in the Rendered pane, switch to the Source view in the same pane.  It will be harder to find the text but you should be able to parse it from there.



              • 4. Re: TM-ART scripting
                Hal DeVore

                I've taken the liberty of moving this discussion to the newly opened BMC TM ART space on Communities.


                Any links remain the same.