A Global variable management tool created mainly for the fun of it and to try out some different aspects of Directory Opus scripting. (@wowbagger has a perfectly good global variable management dialog here: Global Variable Management Dialog). Only string, number and boolean variables are available for creation and editing.
The script adds a new command to Directory Opus (GlobalVariables) which you can assign to a toolbar button, hotkey or menu item. There are no additional arguments for this command, it just opens the dialog.
- Download: (Requires DOpus 12.21) Global Variables.js.txt (23.6 KB)
- Drag the .js.txt file to Preferences / Toolbars / Scripts.
- 1.0 (3/5/20)
- Initial Release.
- 1.0.1 (3/5/20)
- Double-clicking a variable opens the edit dialog.
- Various tweaks to dialogs.
- 1.0.2 (1/6/20)
- Added config option to choose whether dialog remembers last size/position.
- Fixed crash caused when global variables contained a vector.
- 1.0.3 (3/6/20)
- Fixed: Crash caused when global variables contained a Map object.
- 1.0.4 (22/6/20)
- Added: Now shows Vector and Map variables as disabled items in the list.
- Download: Global Variables.dcf (236 Bytes)
- Select "Settings / Customize Toolbar..." from your Lister and then drag the button file to any toolbar you like.
Once the dialog opens you will see a list of all the currently defined global variables. Each variable will show its current value, type and whether it's persistent or not. At the top of the dialog is an edit box which allows you to filter the list of variables - simply start typing and the list will update. Clicking the Clear Filter button will reset this filter. There's a second button at the top, Refresh, which will re-read the list of variables.
At the bottom of the dialog is a New... button which will open a dialog allowing you to create a new variable:
From this dialog you can define the name, value, type and persistence of the new variable. Click Apply to create the variable. This dialog will sightly change when you select different variable types, hiding sections that are irrelevant to the selected type.
All variables in the main dialog have a checkbox, if any variables are checked the Edit... and Delete buttons become available. You can double-click a variable in the list to edit it (ignoring all checked items). The Edit... button will show the same dialog as the New... button and you will be able to edit all 'checked' variables. If only one variable was checked then you can edit the name and the current value, type and persistence will reflect that variable, if multiple variables were checked then the name is no longer editable , the value, type and persistence will not reflect any selected variable, and the editing you do will modify all of the checked variables. Note: There is no undo so be careful.
Vector and Map variables, although they are included in the list, are not editable.
Right clicking a variable in the main dialog will show a popup menu:
From this menu you can Edit... the item under the mouse pointer, again using the same edit variable dialog but this time ignoring checked items. Two options allow you to Copy Name or Copy Value to the clipboard. Other options in this menu are self explanatory.
If you right click in the list but not over a variable (ie, in an empty area of the list) a similar popup menu will appear but most options will be unavailable and the Edit... option will change to a New... option which will operate identically to the New... button described above.