Login  Register

Recent odd macro behaviour?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Recent odd macro behaviour?

Olivier Burri
149 posts
Hi all,

After an update, it seems some syntax is no longer valid in ImageJ's macro language.

For example:
function test (someArgument) {
        return someArgument+"Some Text";
}
macro "A Test" {
        hi = 30;
        ret = test("I like "+hi);
        print(ret);

Gives an error:
Number or numeric function expected in line 2.
return someargument + <"Some Text"> ;

If written like this it works:
function test (someArgument) {
        returnArg = someArgument+"Some Text";
        return returnArg;
}

And the log window displays "I like 30"

I know the first example I gave worked fine until very recently, as I hadn't touched that macro in months and have been using it at least weekly.

The second example involves arrays not taking in return arguments from functions:
        testArray = newArray(5);
        tmp = test ("Another"+45);
        testArray[0] = tmp;
       
        testArray[1] = test ("Another"+45);

here "test" is the functioning version of the test function above.

testArray[0] works fine, but testArray[1] gives the following error
Numeric return value expected in line...
testArray [ 1 ] = test ("Another" + 45 <)>;

This last error was pointed out to me by my colleague.
Any idea what might be causing this?

Best regards,

Oli

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html