Running the macro editor disables startup macro keyboard shortcuts

imagej
macro

#1

I’ve noticed that my startup macro’s keyboard shortcuts get disabled after I’ve run a macro under development in the macro editor. Is this normal and expected behavior? For instance, I have a short macro in the startup macro that assigns the f12 key to a short macro that closes all the open windows. f12 no longer performs that function when I am coding and running a macro I’m writing in the macro editor. Here’s the macro that stops working.

//*************close all****************
macro 'Close All [f12]' 
{

    run("Close All");

    if (isOpen(filename+"HEADER.raw"))
        {
           selectWindow(filename+"HEADER.raw");
           run("Close");
        }


    requires("1.30e");
    if (isOpen("Results")) 	
    {
         selectWindow("Results"); 
         run("Close" );
    }
    if (isOpen("Surface Plot")) 	
        {
             selectWindow("Surface Plot"); 
             run("Close" );
    }
    if (isOpen("B&C")) 	
        {
             selectWindow("B&C"); 
             run("Close" );
    }



//  if (isOpen("Log")) 
//  {
//        selectWindow("Log");
//        run("Close" );
//   }
//    while (nImages()>0) 
//    {
//          selectImage(nImages());  
//          run("Close");
//    }
}

Thanks for your help
Ron DeSpain


#2

This behavior is not expected and not normal. What does the macro you are developing look like? Are you using the macro editor’s Macros>Install Macros command? It will disable startup macro keyboard shortcuts.


#3

Hi Wayne…long time

My startup macro shortcut key f12 stops working after I load in this macro via Plugins>Macros>Edit

// This macro adds file names to stacks imported using
// File>Import>Image Sequence

  requires("1.48i");
  setFont("SansSerif", 16, "antialiased");
  setColor("white");
  Overlay.remove;
  for (i=1; i<=nSlices; i++) {
     setSlice(i);
     name = getMetadata("Label");
     index = indexOf(name, "\n");
     if (index>0)
        name = substring(name, 0, index);
     Overlay.drawString(name, 5, 20);
     Overlay.setFillColor("black");
     Overlay.setPosition(i);
  }
  Overlay.show;
  run("Select None");

The f12 macro still runs from the Plugins>Macros menu, but the f12 key doesn’t work any more. I don’t have to run the macro from within the editor to get the problem…just open an ijm. The problem persists after closing the macro editor, but is gone after restarting IJ.

again…here is the macro that gets disabled.

macro 'Close All [f12]' 
{

    run("Close All");

    if (isOpen(filename+"HEADER.raw"))
        {
           selectWindow(filename+"HEADER.raw");
           run("Close");
        }


    requires("1.30e");
    if (isOpen("Results")) 	
    {
         selectWindow("Results"); 
         run("Close" );
    }
    if (isOpen("Surface Plot")) 	
        {
             selectWindow("Surface Plot"); 
             run("Close" );
    }
    if (isOpen("B&C")) 	
        {
             selectWindow("B&C"); 
             run("Close" );
    }



//  if (isOpen("Log")) 
//  {
//        selectWindow("Log");
//        run("Close" );
//   }
//    while (nImages()>0) 
//    {
//          selectImage(nImages());  
//          run("Close");
//    }
}

My setup is …64bit Win10, IJ159p

I tried renaming the macro to .txt, but got the same result.

Ron DeSpain


#4

Good day Ron;
re: My setup is …64bit Win10, IJ159p

Surely not :wink:

Herbie


#5

This bug is fixed in the latest ImageJ daily build (1.51r17). The bug was triggered by the word ‘macro’ in the comment on the first line of the macro you are opening. By the way, it is easier to open a macro by pressing the “o” key (File>Open) or by using drag and drop.


#6

Thanks Wayne R17 has the fix.

You might be interested in another anomalous feature of IJ. When I double click on an ijm (say on my desktop or in a folder other than IJ) IJ opens and the macro runs (without opening the macro editor)…I see this as a benefit, as it makes ijm’s into stand alone apps, Is that how you designed IJ?..it’s very cool!

Ron


#8

Hi again Wayne

I can’t get Auto_Corr to run to completion…it sticks after generating the probability map. I’m using a small target image and a larger scene image. It gets the targets, but doesn’t exit so I have to escape to continue working. I also am expecting some options to come up, but don’t see them at any time during the execution.

Thanks
Ron DeSpain


#9

Hi @rondespain,

Rather than reviving an old, unrelated topic you can tag Wayne in your new topic using the at symbol notation @Wayne.


#10

The mentionned post was deleted as it is off topic.
Thread is in Analyze Particles Angle Problem