Enable/Disable Macro with Macro-Object

Hi,

Is it possible to enable or disable a macro's startup behavior with a macro object (or any other object)? I'm trying to write a menu that allows to control which macros are run on start up without having to go through the 'Macro Development'. I saw that the Macro Class can do almost anything except modifying the startup parameter. Is this intentional or is it just missing?

Best,
Sebastian

P.S. I know that I could modify the xml of the .lym file, but it is a bit ugly since the API provides everything except modifying the startup parameter

Comments

  • Hi Sebastian,

    I don't understand exactly, what you're planning to do, but instead of disabling startup, you could chose the macros you want to run and explicitly do so (and disable autorun).

    Matthias

  • Hi Matthias,

    I wanted to know whether the "Macro" Class can modify the <autorun>true</autorun> part of the .lym file like it can modify the "show_in_menu" for example. But from your answer I think the answer is no.

    Thanks for the idea of running all macros that require this with another macro, I think that could work for my case.

    Best,
    Sebastian

  • Hi Sebastian,

    modifying autorun won't help, because this attribute is evaluated by the application before the first macro is executed.

    I'd also suggest to put the interesting code into .rb (or .py) files into the "ruby branch" or "python branch" folders. These folders are part of the search path and "require" (Ruby) or "import" (Python) will include these files. ".lym" is good for KLayout, but not good as Ruby or Python modules.

    A good architecture basically is to put your functionality into such modules (e.g. through certain classes). Then in a central "autorun" macro you build the menu items explicitly according to the list you want to see and in the menu callbacks you run the functionality from your modules/classes.

    Regards,

    Matthias

Sign In or Register to comment.