Auto Run an Extension

Dan P's Avatar

Dan P

14 Jun, 2019 08:24 PM

My apologies if this has been asked/answered. I could not find any discussions or documentation.
I have an extension I developed for my personal updating. It takes input from a file I generate overnight and updates an asset with transactions to maintain a current balance. I run it each morning when I open MD. Can someone guide me to a way to have MD run this when it starts? I know, I'm extremely lazy! More of an educational thing for me.

Thanks in advance.

Dan

  1. 1 Posted by hleofxquotes on 15 Jun, 2019 05:30 AM

    hleofxquotes's Avatar

    Assuming that your extension extends FeatureModule, you can override handleEvent(). Probably "md:file:opened" is a good place to try

        @Override
        public void handleEvent(String appEvent) {
            super.handleEvent(appEvent);
    
            LOGGER.info("> handleEvent, appEvent=" + appEvent);
    
            if (appEvent.compareToIgnoreCase("md:file:opening") == 0) {
                handleEventFileOpening();
            } else if (appEvent.compareToIgnoreCase("md:file:opened") == 0) {
                handleEventFileOpened();
            } else if (appEvent.compareToIgnoreCase("md:file:closed") == 0) {
                handleEventFileClosed();
            }
        }
    
        protected void handleEventFileOpened() {
        }
    

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac