How best to maintain and increment an integer

This is a generic request for see what is possible and how to best achive.
I want to maintain an integer variable that can:

  • Assigned to a given starting value (Menu/Button)
  • Incremented or decremented (Menu/Button)
  • Copied to clipboard out with a hotkey
  • Printed out with a hotkey
  • Optionally incremented very time it is printed out (Menu/Button option setting)

Is this spossible within the DOpus environmnet?
Would I need to make us of an environment variable?
Actually after searching the forum I am not sure Opus has it's own environment variables.
All the hits seem to reference window env vars?

Anyway much appreciate any comments

Via scripting:

https://docs.dopus.com/doku.php?id=reference:scripting_reference:scripting_objects:vars

Via the Evaluator (simplified scripting, more or less):

https://docs.dopus.com/doku.php?id=evaluator:variable_types

1 Like

There is a useful discussion of internal scoped variables within the @set command modifier reference entry.
Also of interest within this reference page are the Evaluator code @eval and @evalalways modifiers.
https://docs.dopus.com/doku.php?id=reference:command_reference:command_modifier_reference

I am able to offer this evaluator code as a possible starting point for a Directory Opus Scoped variable using Evaluator code.

if ( $glob:root)
   {
   x=$glob:root;
   }
   else
   {
   $glob:root=1;
   x=1;
   }
// a code miracle occurs;
$glob:root=x;
return x;

2 Likes

Thank you both
I will retreat and absorb....