Jump to content

Functions to save/restore variables in a string


Recommended Posts

The attached file contains func VarsToString and func StringToVars

and supporting functions.

Execute(VarsToString('a,b,c','s')) saves the names, values and

scopes (local, global) of variables $a, $b and $c in string $s.

Execute(StringToVars('s')) restores all the variables in string $s,

preserving scope if possible.

Supported variable types are Array (any dimensions), Array in Array,

BinaryString, Bool, Float, HWnd, Int, Keyword (default only) and String.

Objects and Structs are NOT supported.

VarsToString.au3

Link to post
Share on other sites

Fantastic stuff! I like the way that you accept input variables -- it allows for any amount of data to be saved into one location.

You may wish to consider making the output slightly more 'friendly' for writing to files etc.; I would suggest escaping anything that isn't a letter, number or otherwise 'standard' character (including things like line feeds) because saving states across sessions is probably where your work would be extremely useful.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...