creating macros, calling plugins...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

creating macros, calling plugins...

Peter Gregson
How do I call plugins, especially external ones, from a macro?  The  
real question is how do I know the order of the arguments in the  
argument string, and the names of them?  For example, calling  
"Deriche" is easy

run("Deriche ", "alpha=1 display");

I used Macro->Record... to capture this.  It works, byt how would I  
know to inoke "display" in the string when there is a check-box in the  
GUI for it?

When I try to invoke Image->Scale... it passes the arguments that I  
select in the GUI.  However, when I invoke Plugins->Morphology, all I  
get in the macro Recorder window is

run("Morphology ");

without any of the arguments that I selected in the Morphology  
plugin's GUI.

What is the difference between these plugins?  How can I determine  
what arguments I need and how to invoke them when calling a plugin,  
either from a macro or another plugin?

Best regards,

Peter
Reply | Threaded
Open this post in threaded view
|

Re: creating macros, calling plugins...

Gabriel Landini
On Tuesday 26 August 2008, Peter Gregson wrote:

> How do I call plugins, especially external ones, from a macro?  The
> real question is how do I know the order of the arguments in the
> argument string, and the names of them?  For example, calling
> "Deriche" is easy
>
> run("Deriche ", "alpha=1 display");
>
> I used Macro->Record... to capture this.  It works, byt how would I
> know to inoke "display" in the string when there is a check-box in the
> GUI for it?

if you have "display" in the argument, it will be checked. If it is not there, it will be unchecked.

> When I try to invoke Image->Scale... it passes the arguments that I
> select in the GUI.  However, when I invoke Plugins->Morphology, all I
> get in the macro Recorder window is
>
> run("Morphology ");
>
> without any of the arguments that I selected in the Morphology
> plugin's GUI.
>
> What is the difference between these plugins?

Their dialogs. The macro recorder can record modal dialogs (i.e. dialogs that wait for the user to make choices before doing the processing).
http://en.wikipedia.org/wiki/Modal_window

The 2nd example (not sure what plugin that is) is almost surely running on its own thread. It does not wait for your input. If the author did not provide a mecanism to make it recordable, you will not be able to call it from a macro the way you want.

> How can I determine
> what arguments I need and how to invoke them when calling a plugin,
> either from a macro or another plugin?

Use the Macro Recorder as you have done so far. The order of the arguments does not matter.

G.