I'd like to add some autobackup functionality to a script. How can I ask DOpus to call some script callback function every 5 minutes?
A better way would be to handle some events tied to whatever you want to backup, and check the time in those to see if it makes sense to do a backup. Then the script isnβt being fired all the time when nothing is happening.
I'm using this script, which tracks just 1 OnCloseLister event to save s the currently named layout
Seems simpler to add a timer rather than go through all the dozens of DOpus events and check which ones I should include, no? Unless you tell me it's just 2 more callbacks that cover all lister layout changes?
Scripts that run at random times all day on a timer will cause problems. Really not recommended.
You can create a new script using the wizard and turn on all the events you want to generate the code for you, and then just make each event call a single function (paste one line into each event) which does all the work. It would take less time to do than we've spent talking about it.
But I don't know which ones I want, and the wizard doesn't even have descriptions!
Ok, I can exclude some based off names, but then some I can't, like the OnViewerEvent
, does it change layout? Oh, no, it's the image viewer. So I'd have to read through most of those in the docs and still worry I've missed some.
It's doable, but I just don't see how that's simpler than a timer
I've picked the following, but don't understand whether OnSourceDestChange
is relevant
Have I missed anything?
Also, does OnCloseLister
get called when DOpus shuts down (with and without Windows shuitting down)? Or does the shutdown event also need to be handled separately?
Function | Comment |
---|---|
OnOpenTab | when a new tab is opened |
OnCloseTab | when a tab is closed |
OnSourceDestChange | when the source and destination are changed |
OnAfterFolderChange | after a new folder is read in a tab |
OnStyleSelected | when a new Lister style is chosen |
OnListerUIChange | when a change to the Lister UI occurs |
OnDisplayModeChange | when the display mode is changed in a tab |
OnFlatViewChange | when the Flat View mode is changed in a tab |
OnListerResize | whenever a Lister is resized |
These 3 events seem to be enough.