User Tools

Site Tools


howto:plugins:retrieving_the_optional_args_when_a_plugin_is_called_from_a_macro

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howto:plugins:retrieving_the_optional_args_when_a_plugin_is_called_from_a_macro [2019/04/12 13:13] (current)
Line 1: Line 1:
 +====== Retrieving the optional args when a plugin is called from a macro ======
  
 +**Macros can call plugins with optional arguments using the run("​pluginName",​ "​optional Args") macro command. ​ In this how-to, Wayne Rasband explains how to capture the optional arguments in the plugin run method.**
 +
 +Here is an exchange between a newsgroup subscriber and Wayne Rasband about capturing the optional arguments passed from a macro to a plugin via the run() macro command. The original post has been edited slightly to keep it short.
 +
 +  On Jan 14, 2005, at 9:10 AM, <name removed> wrote:
 +
 +<​code>​
 +  How do I pass an argument from a macro to a plugin that implements '​PlugIn'? ​
 +  ​
 +  I would expect that the macro statement
 +  ​
 +  run("​myPlugin ", "​myArgument"​);​
 +
 +  would pass "​myArgument"​ as an argument of the '​run'​ method inside the plugin
 +  myPlugin '. But that does not happen (the '​run'​ method receives an
 +  empty java.lang.String).
 +
 +  A plugin can retrieve the options string passed to the run() function
 +  by calling Macro.getOptions().
 +
 +  -wayne
 +</​code>​
howto/plugins/retrieving_the_optional_args_when_a_plugin_is_called_from_a_macro.txt ยท Last modified: 2019/04/12 13:13 (external edit)