GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Global Variable Management Dialog

user-interface
jscript
scripting

#1

This script allows the user to manage Dopus Global Vars via a dialog.

Features include

  • View the variable, its value, type and persistence statue
  • Add (Copy) variable
  • Remove variable
  • Edit variable

Note, Some variables are saved complex types. You can't edit one of these without changing the type to one of string, number, or boolean.

Button config

<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none">
	<label>vars</label>
	<tip>Manage Dopus Variables</tip>
	<icon1>#ManageGlobalVariables:VarGreen</icon1>
	<function type="normal">
		<instruction>ManageDopusVariables</instruction>
	</function>
</button>

ManageGlobalVariables.osp (15.6 KB)


Dividing File Names into Sortable Columns
Dialog textbox cursor position
Column - Custom Text and Regexp
Metadata and columns
Need help with JSON serialization in the VBScript
Support for dynamic column settings
#2

Variable mgt is not saving variables, v12.7:

stcp10112

Please advise how to remedy, thx


#3

You couldn't add variables if there weren't any existing ones.

Here's a quick edit of the script which fixes that, changing as little as possible:

ManageVariables.osp (15.6 KB)

(I noticed another bug where if you don't select anything in the Saving Type drop-down, you get an error when saving a change. I left that as it's easy to work around and I didn't want to change too much of the original script. It can probably only happen when there are no existing variables, the same as the other problem.)


#4

Thx Leo, wonderfully prompt, much appreciated.

Now that the global variable is being saved,
I'm trying to use it to store the folder that base versions of code sit in,
but I'm trying to reference it in a dos command,
can u advise how to do that ?
cf
@nodeselect
"U:_cfgPortable\Program Files (x86)\Beyond Compare 4\BComp.exe" {filepath} %Original_fileFolderLocation_toCompareWith%

                   %Original_fileFolderLocation_toCompareWith%
                    Dopus.vars.Get("Original_fileFolderLocation_toCompareWith") 
                    Dopus.vars("Original_fileFolderLocation_toCompareWith") 

// "U:_cfgPortable\Program Files (x86)\Beyond Compare 4\BComp.exe" {filepath} "F:\ccsrp\quality & testing\TC11\PAL\PALProject\Script"


#5


#6

try

@nodeselect
"U:_cfgPortable\Program Files (x86)\Beyond Compare 4\BComp.exe" {filepath} {$glob:Original_fileFolderLocation_toCompareWith}

#7

See wowbagger's post just above for the correct syntax for using variables outside of scripts.

You may also want to look at Folder Aliases as an alternative to variables for what you are doing. These two pages describe most of their details:

If you just want to be able to define some paths and then refer to them in commands, aliases may be a better fit, as that is what they are made for.

There is a UI built into Preferences for editing them:

They can also be changed via commands and scripts, if you need them to be updated programatically:

Favorites ALIAS=set NAME=MyAlias PATH="C:\Program Files"

Using them is just a matter of using things like /MyAlias in paths, or {alias|MyAlias} in DOS buttons. (Both work in non-DOS buttons.)

There are also a huge number of built-in aliases for quick navigation to system folders (e.g. /programfiles) and things like Opus config folders (e.g. /buttons).


These scripts for running Beyond Compare (and other tools) from Opus may also be of interest:

Less advanced, non-script version (not what I'd use now, but how we did things before full scripting was added):