GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Event: AutoVars (event-handling for variables)


#1

AutoVars
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.

Why:
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"

How:
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.

Example:
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.

Command:
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

Installation:
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)).

cya,
tbone

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

@ifset:$src:HiddenItems
@set src:HiddenItems
@set src:HiddenItems.bfc.drop
Select NOPATTERN SHOWHIDDEN

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

Download:


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
Command: SelectEx (extended Select command)
Date modified toggle button