GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Event: AutoVars (event-handling for variables)


An event based script add-in that can act on specific variables on certain events (refreshing or changing a folder e.g.).
This is currently implemented for tab related events only. The add-in will be pushed on demand.

If you have a button that changes a tabs content by filtering or hiding items and you like to have that button reflect the condition the current tab is in with the well-known toggle-feature, then you might have hard times removing that toggle-status again if it depends on a custom variable, as these won’t be deleted automatically. Case: Toggle button for “Show only modified files within 1 hour”

This add-in looks for sidecar variables which are named like “..”. These sidecar variables define what is going to happen with its regular sibling named “”. Currently only dropping/deleting variables is implemented.

If you want a button toggle status to be reset which depends on a tab variable named “HiddenItems” whenever you refresh the folder, create another variable named “HiddenItems.bfc.drop” and set it to “refresh”. If you always want “HiddenItems” to be deleted and the toggle status to be reset, regardless of what tab-action took place, set “HiddenItems.bfc.drop” to “always”.

Currently known event suffixes: sdc, bfc, afc (SourceDestChange, BeforeFolderChange, AfterFolderChange).
Sidecar variables values can be any combination of: normal, refresh, parent, root, back, forward, dblclk.

There’s also a command “AutoVars” provided, which simulates native DO events, as these are not executed if other scripts make use of “Go NOSCRIPT” (unfortunately! o). Usage: AutoVars EVENT=bfc ACTION=refresh

To install the add-in, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
For debugging or monitoring purposes, there is XLog available in the scripts config section (Helper: XLog (versatile logging approach for DO scripting)).


Demo Button:
This button toggles between showing and hiding all items. It appears pressed as long as items are hidden (you know that) or you change folder/refresh the tab (which was not possible before).

[code]@toggle:if $src:HiddenItems

@set src:HiddenItems
@set src:HiddenItems.bfc.drop

@set src:HiddenItems=1
@set src:HiddenItems.bfc.drop=always
Select NONE
Select NOPATTERN HIDEUNSEL[/code]ResetToggle.dcf (783 Bytes)


Toggle button for "Show only modified files within 1 hour"
Using 'Select' to get a lister to display all files but only sub folders with contents larger than 500k
Date modified toggle button
Command: SelectEx (extended Select command)