Is there a way to disable a toolbar button following a source path change (or at the very least, a tab change) using the @ifexists modifier if a folder does not exist?
I've used global variables before to prevent double clicks but these reply on the button script running and changing a variable, e.g. @disableif:$glob:RunningTheScriptDisableButton
I want to be able to disable a menu button if there are no snapshots for the source path. This can easily be tested using a script as the path would have a suffixed, accessible tilde snapshot folder , for example:
set fsu = DOpus.FSUtil
set sourcetab = clickData.func.sourcetab
If not fsu.Exists(sourcetab.path+"~snapshot") then dlg.message = "There are no accessible snapshots"
Of course this is a test after the button has been clicked where as I would like to pre-empt the need to click with a sort of DISABLEIFEXISTS:! modifier command.
I've read a number of posts on this matter including the one below. It would not need to be dynamically triggered by filesystem change events, simply a check following a source path change:
Sorry my bad, I hadn't spotted in my post that the backslash had been filtered out.
The code needed a very minor tweak as it required a backslash between the tab.path and the suffix but I appreciate you were using my example as a reference. After modifying this line your solution worked a treat
I've spotted a small issue with the script.
When in dual pane mode with navigation lock enabled, it triggers the script for both source and destination panes as each folder changes. This means the source pane could create the variable and the destination could then remove it.
What's the best way to tweak it so that the script only acts on the source pane?.
The variables' scope is on the tab level, so there shouldn't be a conflict. The tabs in source and destination are independent objects, each having its own snapshotVar, even when they point to the same folder in the file system.
I'd be surprised if locked tabs behaved differently, but I haven't looked into it, so let me know if they do.
I wasn't aware that " The tabs in source and destination are independent objects, each having its ownsnapshotVar".
I put a dopus.output message next to each tab.vars command for troubleshooting and both messages were outputted, giving the impression that a single variable was getting set then immediately deleted by the 2nd pane.
Only one of my dual pane paths has accessible snapshots so it now makes sense that it is correctly outputting the state of each independent snapshotVar".