Login  Register

Re: macro problem

Posted by Braekevelt Martin on Jan 08, 2019; 11:18am
URL: http://imagej.273.s1.nabble.com/macro-problem-tp5021600p5021610.html

Sorry to bother you again,

I have downloaded the latest version of ImageJ instead of the Fiji version and copied paste like you have done for me Michael.

I included the new StartupMacros.txt file.
The position of the icon is where I wanted it, but I don't see the icon I constructed (the very long code), the icon should look like this (see attachment).
All I get is a blank icon.
The name I change is correct however  (Volume fraction)
When I click on the icon I get an error (it says a { is expected at line 31),when I check the code however I think the correct of open close {} is there,...
Can you please check what is wrong with the icon and why the macro is not running ?
Thanks in advance,
Martin

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: Tuesday, January 8, 2019 10:23 AM
To: [hidden email]
Subject: Re: macro problem

Hi Martin,

sorry, I have plain ImageJ, not Fiji; I can't say whether Fiji uses other files for startup. With plain ImageJ, it works when I put it into my StartupMacros.txt. You might do some other changes in your StartupMacros.txt and see whether Fiji does these changes, otherwise it reads a different file.
You might have a look, e.g., whether "StartupMacros.ijm" or "StartupMacros.fiji.ijm" exist (and are in use), instead of "StartupMacros.txt".

Also make sure that you have no additional line breaks introduced by the mailer, e.g. the first line should include the long string with the code for the icon (a Strings constant must be given in one line).


Michael
________________________________________________________________
On 08.01.19 09:03, Braekevelt Martin wrote:

> Dear Michael,
>
> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>
> Last obstacle I think ?
>
> Kindest regards,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael
> Schmid
> Sent: Monday, January 7, 2019 5:11 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>
> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>
>
> macro "myTool Action Tool -
C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

>      w = 4096;
>      h = 2160;
>      dir = getDirectory("Choose Source Directory ");
>      list = getFileList(dir);
>      for (i=0; i<list.length; i++) {
>         showProgress(i+1, list.length);
>         open(dir+list[i]);
>         run("Canvas Size...", "width=&w height=&h position=Center zero");
>         run("Maximize");
>         setLocation(0,0);
>         run("Unsharp Mask...", "radius=1 mask=0.60");
>                   run("Grid...", "grid=Crosses area=85700 color=green bold center");
>         run("Set... ", "zoom=50");
>         setTool("multipoint");
>         run("Point Tool...", "type=Dot color=Red size=[Extra Large] label show counter=0");
>         waitForUser("Your Action Required", "Double click when center point of cross is inside,\n one click when on border or when have doubt.\n Then press OK");
>         if (selectionType() == -1) { // no selection
>            count = 0;
>         } else {
>            getSelectionCoordinates(xpoints, ypoints);
>            count = xpoints.length;
>         }
>         row = nResults;
>         setResult("Label", row, getTitle());
>         setResult("Count", row, count);
>        close();
>      }
>      path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>      saveAs("Results", path);
> }
>
>
> Now it is time for you to learn a bit more on macro programming!
>     https://imagej.nih.gov/ij/docs/guide/146-14.html
>     https://imagej.nih.gov/ij/developer/macro/macros.html
>     https://imagej.nih.gov/ij/developer/macro/functions.html
>
>
> Michael
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

icon.tif (2K) Download Attachment