Editing Customized Commands > Customized Command Definition Examples
  
Customized Command Definition Examples
Example: Replacing a Part of the URL Using Property Substitutions
This customized command is labeled Button Label, has a tooltip, etc. In addition, when this command is activated, it checks the currently selected part for a specified property (Source_file_name). If it does not find it, the button is not enabled. If it finds it, it replaces the substring in the URL.
<menu
ui="rmb"
view="all"
    pane="all"   
select="any"
    visible="getSelectedCount()==1 &amp;&amp; getPropertyExists(&apos;Source_file_name&apos;)">   
<command_name >MyCommand 1</command_name>
    <label >Button Label</label>  
<tooltip>This is a new command.</tooltip>
<icon>\my\icons\location\icon16x16.png</icon>
<action 
 target="browser">   
http://somewhere.com/content.jsp?partName=&lt;!Source_file_name!&gt;
</action>
</menu>
Example: Replacing a Part of the URL when Multiple Parts are Selected
In this example, when the user selects two parts, Creo View fetches the values of the Featrue_Id property of both parts, returned from getSelectedPartProperty. It then replaces two substrings of the URL with these values.
<menu
 ui="rmb"
view="all"
pane="all"
select="any"
visible="getSelectedCount()==2 &amp;&amp; getSelectedPartProperty(1,&apos;Feature_Id&apos;,&apos;featureId1&apos;) &amp;&amp;
getSelectedPartProperty(2,&apos;Feature_Id&apos;,&apos;featureId2&apos;)">
 <command_name >MyCommand 2</command_name>
<label >Button Label</label>
<action
target="browser">
http://www.somewhere.com/index.jsp?Id1=&lt;!featureId1!&gt;&amp;Id2=&lt;!featureId2!&gt;
</action>
</menu>