Persistent variable?

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
Dimmak
Junior Coder
Posts: 25
Joined: Tue Jan 24, 2012 4:57 pm

Persistent variable?

Post by Dimmak » Wed Jan 25, 2012 9:40 am

It is possible to create persistent variable??
For example:
Let>a=0
Let>a=a+1
First script run: a=1
Second script run: a=2
:roll:

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jan 25, 2012 10:15 am

For this I would write the value to an INI file (or some other storage) and read it on each run.

So, e.g. make an INI file (just a text file) that looks like this:

Code: Select all

[vars]
a=0
Then your script looks something like:

Code: Select all

//start of script read a from ini file
ReadIniFile>filename,vars,{"a"},a

//increment a
Let>a=a+1

..
.. your code here
..

//end of script, write current value of a back to INI file
EditIniFile>filename,vars,{"a"},a
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Dimmak
Junior Coder
Posts: 25
Joined: Tue Jan 24, 2012 4:57 pm

Post by Dimmak » Wed Jan 25, 2012 10:54 am

Thanx!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts