| 1 | <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 | <title>Add to dynamic menu...</title> |
| 3 | <style> |
| 4 | td { padding-left: 5pt; padding-right: 5pt; } |
| 5 | th { padding-left: 5pt; padding-right: 5pt; } |
| 6 | code { white-space: pre-wrap; } |
| 7 | dd { white-space: pre-wrap; } |
| 8 | </style> |
| 9 | </head><body bgcolor="#FFFFFF"> |
| 10 | |
| 11 | <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b> |
| 12 | Add to dynamic menu... |
| 13 | </b></font></table></table> |
| 14 | <p>A command in the File menu of the <a href="ScriptEditor.html">ScriptEditor</a>.</p> |
| 15 | <p>With this command, you add a button to the dynamic menu in the <a href="Objects_window.html">Objects window</a>. This button will only be visible if the specified combination of objects is selected. Clicking the button will invoke the specified <a href="Praat_script.html">Praat script</a>.</p> |
| 16 | <h2>Settings</h2> |
| 17 | <dl> |
| 18 | <dt><b>Class 1</b> |
| 19 | <dd>the name of the class of the object to be selected. For instance, if a button should only appear if the user selects a Sound, this would be “Sound”.</dd> |
| 20 | <dt><b>Number 1</b> |
| 21 | <dd>the number of objects of <i>class1</i> that have to be selected. For most built-in commands, this number is unspecified (0); e.g., the user can choose <b>Draw</b>... or <b>To Spectrum</b> regardless of whether she selected 1, 2, 3, or more Sound objects. If the number of selected objects is different from <i>number1</i>, the button will be visible but insensitive.</dd> |
| 22 | <dt><b>Class 2</b> |
| 23 | <dd>the name of the class of the second object to be selected, different from <i>class1</i>. Normally the empty string (“”).</dd> |
| 24 | <dt><b>Number 2</b> |
| 25 | <dd>the number of selected objects of <i>class2</i>.</dd> |
| 26 | <dt><b>Class 3</b> |
| 27 | <dd>the name of the class of the third object to be selected, different from <i>class1</i> and <i>class2</i>. Normally the empty string (“”).</dd> |
| 28 | <dt><b>Number 3</b> |
| 29 | <dd>the number of selected objects of <i>class3</i>.</dd> |
| 30 | <dt><b>Command</b> |
| 31 | <dd>the title of the new command button (or label, or submenu title). To get a separator line instead of a command text (only in a submenu), you specify a unique string that starts with a hyphen (“-”); the <a href="ButtonEditor.html">ButtonEditor</a> may contain some examples of this. If the command starts with <b>Save as</b> or <b>Append to</b>, it will be placed in the <a href="Save_menu.html">Save menu</a>.</dd> |
| 32 | <dt><b>After command</b> |
| 33 | <dd>a button title in the dynamic menu or submenu where you want your new button. If you specify the empty string (“”), your button will be put at the bottom. You can specify a push button, a label (subheader), or a cascade button (submenu title) here.</dd> |
| 34 | <dt><b>Depth</b> |
| 35 | <dd>0 if you want your button in the main menu, 1 if you want it in a submenu.</dd> |
| 36 | <dt><b>Script</b> |
| 37 | <dd>the full path name of the script to invoke. If you saved the script you are editing, its name will already have been filled in here. If you do not specify a script, you will get a separating label or cascading menu title instead, depending on the <i>depth</i> of the following command.</dd> |
| 38 | </dl> |
| 39 | <h2>Example</h2> |
| 40 | <p>If one object of class Sound is selected, you want a new submenu called “Filters” after the <b>Convolve</b> button, containing your new commands “Autocorrelation” and “Band filter...”, separated by a horizontal separator line:</p> |
| 41 | <code> Add to dynamic menu: "Sound", 0, "", 0, "", 0, "Filters -",<br></code> |
| 42 | <code> ... "Convolve", 0, ""<br></code> |
| 43 | <code> Add to dynamic menu: "Sound", 1, "", 0, "", 0, "Autocorrelation",<br></code> |
| 44 | <code> ... "Filters -", 1, "/u/praats/demo/autocorrelation.praat"<br></code> |
| 45 | <code> Add to dynamic menu: "Sound", 0, "", 0, "", 0, "-- band filter --",<br></code> |
| 46 | <code> ... "Autocorrelation", 1, ""<br></code> |
| 47 | <code> Add to dynamic menu: "Sound", 1, "", 0, "", 0, "Band filter...",<br></code> |
| 48 | <code> ... "-- band filter --", 1, "/u/praats/demo/bandFilter.praat"<br></code> |
| 49 | <p>Note that “Filters -” will be a submenu title, <i>because</i> it is followed by subcommands (<i>depth</i> 1). Note that <i>number1</i> is 1 only for the executable buttons; for the cascade button and the separator line, this number is ignored.</p> |
| 50 | <h2>Usage convention</h2> |
| 51 | <p>Please adhere to the convention that command that take arguments, such as “Band filter...” above, end in three dots.</p> |
| 52 | <h2>Using this command in a script</h2> |
| 53 | <p>To add a dynamic button from a script (perhaps your <a href="initialization_script.html">initialization script</a> or a <a href="plug-ins.html">plug-in</a>), use the hidden shell command <a href="Add_action_command___.html">Add action command...</a> instead.</p> |
| 54 | <h3>Links to this page</h3> |
| 55 | <ul> |
| 56 | <li><a href="Add_to_fixed_menu___.html">Add to fixed menu...</a> |
| 57 | <li><a href="History_mechanism.html">History mechanism</a> |
| 58 | </ul> |
| 59 | <hr> |
| 60 | <address> |
| 61 | <p>© Paul Boersma 1998,2006,2011,2014,2023</p> |
| 62 | </address> |
| 63 | </body> |
| 64 | </html> |