Online Download
I'd like to disable the "Automatically Download" on startup and call it from my extension. Is this possible? I can't find anything in the API.
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 Stuart Beesley ... on 29 May, 2021 05:21 AM
There is no documented API call.. But you can do it (thus, it's non-API and may not survive upgrades):
In Python you would call:
In Java, exactly the same but using your reference (or context()) for main..
NOTE: MD checks that it's the primary Sync dataset when opening a datafile, before triggering the downloads... I.E. you don't want all Sync copies doing this... You can check this using:
To turn off Autodownload... Menu, Preferences, Network, untick Automatically Download in Background. This sets the config.dict key "net.auto_download" to false.
2 Posted by Dan P on 29 May, 2021 12:54 PM
Wow! The Amazing Stuart has the answer! Sean should really be paying you.
I'll see if I can incorporate your suggestions in Java.
Thanks!
3 Posted by Dan P on 29 May, 2021 03:50 PM
Well, as I'm not a good programmer in python or java, this is going well.
I got the check on master node to work. However, I can't get to the
background thread.
*In Python you would call:*
*moneydance.getBackgroundThread().scheduleNetSync()
*
*In Java, exactly the same but using your reference (or context()) for
main.*
I can't find any context that will do this. I may not have a required
library imported.
I'll keep looking. Any 'nudge' would be appreciated.
4 Posted by Stuart Beesley ... on 29 May, 2021 04:12 PM
Ok. Well in your Java code you must already have a reference to main / context otherwise you couldn’t call the MD api functions. Do you have anything like xxxx.getUI(). The xxx is it.
Else post your Java code?
5 Posted by Stuart Beesley ... on 29 May, 2021 04:16 PM
so... in your Main.java you will see something like this:
context (above) or whatever you called it should be it....
6 Posted by Stuart Beesley ... on 29 May, 2021 05:24 PM
I just reread you message. If you already got x.getCurrentAccount() to work, then x should be what you want....
7 Posted by Dan P on 29 May, 2021 05:40 PM
Well, that's what I thought too. But it isn't working. I've made several attempts but here is the latest code:
The BackGroundOpsThread cast was suggested by Eclipse so I'm guessing the ScheduleNetSync is in there. It compiles but throws an exception.
class com.moneydance.apps.md.controller.Main cannot be cast to class com.moneydance.apps.md.controller.BackgroundOpsThread (com.moneydance.apps.md.controller.Main and com.moneydance.apps.md.controller.BackgroundOpsThread are in unnamed module of loader 'app')
I changed the contxt from getContext() to getUnprotectedContext - same result.
(I am NOT a java guy - as you can probably tell)
8 Posted by Dan P on 29 May, 2021 05:58 PM
FYI
9 Posted by Stuart Beesley ... on 29 May, 2021 08:43 PM
.
10 Posted by Stuart Beesley ... on 29 May, 2021 10:13 PM
I don't write Java myself (just read it), but I just tried adding this line, ran ant to build it, and it works for me.... Remember you're off-piste (off API here).. try:
11 Posted by Dan P on 29 May, 2021 11:13 PM
Success!
I've incorporated that into my extension and it works fine.
Cautions noted.
Thanks for your help, Stuart. I would likely not have ever figured that cast out.
Dan
Dan P closed this discussion on 16 Jun, 2021 06:22 PM.