Adding Your Own Options to the Scripting Pop Up Menu

RAMP-TS

Adding Your Own Options to the Scripting Pop-Up Menu

You can add your own options to the scripting pop up menu by creating an xml file called uf_um835.xml, and putting it in the partition execute directory. You can do this using notepad.

This is an example of uf_um835.xml that you could create:

 

<?xml version="1.0"?>

<EXTRACT>

<MENUITEM>

  <PROPERTY NAME="CAPTION" VALUE="My user defined options" />

  <SUBMENUS>

    <SUBMENUITEM>

      <PROPERTY NAME="CAPTION" VALUE="My caption for option 1" />

      <PROPERTY NAME="STRING" VALUE="My returned text for option 1" />

    </SUBMENUITEM>

    <SUBMENUITEM>

      <PROPERTY NAME="CAPTION" VALUE="My caption for option 2 (multiple lines returned)" />

      <PROPERTY NAME="STRING" VALUE="My returned line 1 for option 2" />

      <PROPERTY NAME="STRING" VALUE="My returned line 2 for option 2" />

      <PROPERTY NAME="STRING" VALUE="My returned line 3 for option 2" />

    </SUBMENUITEM>

    <SUBMENUITEM>

      <PROPERTY NAME="CAPTION" VALUE="My caption for option 3 (handling quotes in the text)" />

      <PROPERTY NAME="STRING" VALUE="Quotes and greater than and less than need special handling" />

      <PROPERTY NAME="STRING" VALUE="Quote - &quot;" />

      <PROPERTY NAME="STRING" VALUE="Less than - &lt;" />

      <PROPERTY NAME="STRING" VALUE="Greater than - &gt;" />

    </SUBMENUITEM>

  </SUBMENUS> 

</MENUITEM>

</EXTRACT>

 

If you create a file called uf_um835.xml and paste this text into it and then put uf_um835.xml into your partition execute directory, you will be able to see these new options when you are editing RAMP scripts:

 

If you choose option 1, this will be added to your script:

 

My returned text for option 1

 

If you choose option 2, this will be added to your script:

 

My returned line 1 for option 2

My returned line 2 for option 2

My returned line 3 for option 2

 

If you choose option 3, this will be added to your script:

 

Quotes and greater than and less than need special handling

Quote - "

Less than - <

Greater than - >

 

In the xml above, you can see that the caption displayed for the first submenu comes from the caption property, and the value returned to the script when the user clicks on this submenu comes from the String property:

 

<SUBMENUITEM>

   <PROPERTY NAME="CAPTION" VALUE="My caption for option 1" />

   <PROPERTY NAME="STRING" VALUE="My returned text for option 1" />

</SUBMENUITEM>

 

From option 2, you can see how to return multiple lines when the user clicks on a submenu:

 

<SUBMENUITEM>

   <PROPERTY NAME="CAPTION" VALUE="My caption for option 2 (multiple lines returned)" />

   <PROPERTY NAME="STRING" VALUE="My returned line 1 for option 2" />

   <PROPERTY NAME="STRING" VALUE="My returned line 2 for option 2" />

   <PROPERTY NAME="STRING" VALUE="My returned line 3 for option 2" />

</SUBMENUITEM>

 

And from option 3, you can see the special handling if you want quotes (or greater than or less than) in the value returned to the script:

<SUBMENUITEM>

  <PROPERTY NAME="CAPTION" VALUE="My caption for option 3 (handling quotes in the text)" />

  <PROPERTY NAME="STRING" VALUE="Quotes and greater than and less than need special handling" />

  <PROPERTY NAME="STRING" VALUE="Quote - &quot;" />

  <PROPERTY NAME="STRING" VALUE="Less than - &lt;" />

  <PROPERTY NAME="STRING" VALUE="Greater than - &gt;" />

</SUBMENUITEM>

  

As long as your xml is valid xml, and keeps to the structure of the example above (EXTRACT, MENUITEM, SUBMENUS and SUBMENUITEM) it should work.

Note: Ensure that your version of UF_UM835.xml is backed up.