How to auto run Python extension
I have successfully created Python extensions.
They appear as menu items on the extension menu. This is ok.
How can I get a python extension to auto run at MD start, rather than when the user selects from menu? (Like a normal Java extension can do).
Thanks.
Comments are currently closed for this discussion. You can start a new one.
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
1 Posted by hleofxquotes on 24 Jan, 2021 06:33 AM
Don't define the actions structure in your script_info.dict. This will effectively disable the "add to menu insertion".
I have some old notes that the following works in the past. Not sure if it still is.
In your Python code
2 Posted by Stuart Beesley ... on 24 Jan, 2021 06:55 PM
Hi, Thank you!!!! I suspect this is not desired behaviour, but yet it works of a fashion… It creates a problem with the moneydance_xx variables not being set, but I think I can get around that… This will enable me to play..
Thanks again….
3 Posted by Stuart Beesley ... on 24 Jan, 2021 09:34 PM
.
4 Posted by Stuart Beesley ... on 25 Jan, 2021 12:33 PM
Closing as the method above answers the question - thanks
Stuart Beesley (Mr Toolbox) closed this discussion on 25 Jan, 2021 12:33 PM.
Sean Reilly re-opened this discussion on 25 Jan, 2021 02:14 PM
Support Staff 5 Posted by Sean Reilly on 25 Jan, 2021 02:14 PM
I'd like to make it easier to create and package python extensions and am planning to add actions for initialisation, file open/close, and others to the script_info keys. Would that solve the problem here?
--
Sean Reilly
Developer, The Infinite Kind
https://infinitekind.com
6 Posted by Stuart Beesley ... on 25 Jan, 2021 02:31 PM
Hi Sean. Thanks for reply. How would your extra actions work? E.g. I know ‘menu’ adds the script to extensions menu and then when selected the whole script runs. This is how Toolbox currently runs.
So how would a file/open action work for example? Would this be a trigger sent to a script pre-defined method when a MD file opens? A bit like the existing pre-defined notifications for Java extensions..?
The beauty of the ability just to run the script when MD launches is that it can self install as an extension and then it’s loaded as a class which can get on with stuff, rather than just waiting for the user to click something.
I’ve got an experimental python extension running (just for learning) that does just this and listens to MD notifications...
Perhaps we need a ‘auto-run’ action item too?
Would be happy to trial/test a file/open action when I understand how it would work?
Stuart Beesley (Mr Toolbox) closed this discussion on 28 Feb, 2021 12:10 PM.