Layout_AutoOpen_Handler: Open a saved lister layout when opening trigger folder

Share script buttons and script add-ins to extend and modify Opus.
User avatar
Registered Opus Pro User
Posts: 3835
Joined: 15 Nov 2004, 20:51
OS: Windows 10 64-bit
Opus: Latest Beta
Location: NY, USA
Note: This script requires a minimum Opus version 12.2...

This script was written in response to a request described in the following discussion:

Start with DOpus scripting

What does it do?:
This script handles the OnAfterFolderChange event so that when a user specified folder is opened the script will launch a saved lister layout associated with the folder. The association of the 'trigger' folder and the layout to load is specified in the scripts configuration options in Prefs in FolderLayoutList option.

How to install and use it?:
The script is provided here as an Opus Script Package... which in turn is actually a zip file with a VBScript packaged inside. It can be installed by either manually copying the OSP file to the /scripts folder, or via drag-and-drop into the Preferences / Toolbars / Scripts page.

(3.21 KiB) Downloaded 20 times

2016-11-22: v1.0.2 - Initial release...

Clipboard Image.png
Clipboard Image.png (36.2 KiB) Viewed 2556 times

After installing the script package, you should set the desired 'trigger' folder path and layout associations using the FolderLayoutList option. This can be done via the scripts Configuration dialog.

Clipboard Image (1).png
Clipboard Image (1).png (10.94 KiB) Viewed 2556 times

The format for the trigger folder path and layout association is: <folder_path> && <layout_name>. An entry like lib://My/projects/opus/scripting && my_Scripting will cause a layout named my_Scripting to be opened whenever the lib://My/projects/opus/scripting folder is opened...

Clipboard Image (2).png
Clipboard Image (2).png (4.56 KiB) Viewed 2556 times

In addition to the qualifier keys that can be set to enable/disable the scripts execution (qualifier keys require the Always_On option to be set to True), script execution can also be enabled by the use of an Opus environment variable called layout_autoopen (requires the Always_On option to be set to False).

Here is a sample toolbar button that toggles the lister scoped variable (the script supports tab, lister or global scoped variables) which you can copy and paste directly to your toolbar:

Code: Select all

<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
   <function type="normal">
      <instruction>@toggle:if $lst:layout_autoopen</instruction>
      <instruction />
      <instruction>@set lst:layout_autoopen</instruction>
      <instruction />
      <instruction>@set lst:layout_autoopen=true</instruction>

...Feedback welcome.
The only sovereign you can allow to rule you is reason!
Settings->Backup & Restore is your best friend! | Get Priority Support!
Opus 12 x64 | Windows 7 Enterprise sp1 (x64) and Windows 10 Home Edition AU (x64)

Return to “Script Buttons & Add-Ins”