Persistent Global Variables?

Persistent Global Variables?

1
NewbieNewbie
1

    Aug 13, 2015#1

    In a script, can I save a global variable and later retrieve that variable from another script?

    e.g.
    script A creates global variable X
    later, script B retrieves global variable X

    6,681583
    Grand MasterGrand Master
    6,681583

      Aug 13, 2015#2

      No, this is not possible in memory of JavaScript interpreter.

      Values can be passed from one script to another script only via a file or via a user clipboard.

      Three solutions:
      1. Script A opens script file B in UltraEdit, modifies the value(s) of the variable(s) in the script file, saves and closes script file B.
      2. Script A creates a new file, writes the value(s) of the variable(s) into this file line by line or comma separated, saves the new file with fixed file name and path and closes this file. Script B opens this file, reads the value(s) for the variable(s) from the file and closes it before processing the previously active file which must be made active again after closing file with the value(s).
      3. The value(s) of the variable(s) are written to one of the 9 user clipboards by script A from which script B read the value(s) back. This is the most efficient method for passing values from one script to another one executed later. But this works only if UltraEdit is not exited between the two script executions.
      For the third solution take a look on FindStringsToNewFileExtended.js or FindStringsWithLineNumbersExtended.js from Find strings with a regular expression and output them to new file where I used user clipboard 8 to pass values of variables from one run to next run of the script.
      Best regards from an UC/UE/UES for Windows user from Austria