Login  Register

Re: passing an array ,as a string, into a "run" command in macro language

Posted by Wayne Rasband on Sep 27, 2006; 9:52pm
URL: http://imagej.273.s1.nabble.com/passing-an-array-as-a-string-into-a-run-command-in-macro-language-tp3701491p3701492.html

You have to convert the array of numbers into a string. Here is an
example:

      for (i=0; i<arr.length-1; i++)
         str = str + arr[i] + ",";
     str = str + arr[arr.length-1];
     run("Substack Maker", "slices="+str);

-wayne

On Sep 27, 2006, at 3:57 PM, Gabriel Acevedo wrote:

> Hello,
>   This may be silly question, but I need help with
> creating a macro. I am trying to use the "Substack
> Maker"plugin in my macro.
>
> In the macro recorder it shows up as the following:
>
> run("Substack Maker", "slices=1,4,5,6,7,9")
>
> my goal is to run a loop to create the desired list of
> numbers in an array, and then use that list for the
> slice list.
>
> What I have not been able to do is figure out how to
> pass that array into the "run" command above. I tried
> various iterations of
>
> run(.....,"slices="+(array name))
>
> but it doesn't seem to work.
> Does anyone have any suggestions?
>
> Thanks,
>
> Gabriel
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>