Jump to content

Save variable in registry?


Guest PaulF
 Share

Recommended Posts

I need to save a variable for use in AutoIt to determine how many times a script has run. Is the easiest way to store a variable in the registry? If so, what do you recommend as the best convention for picking a user registry address?

PaulF

Link to comment
Share on other sites

I would like to ask before offering a different solution what it is that you would need to count how many times a script has run for... and would the script be looping, or would it actually close open close open etc?

Let me know.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I would like to ask before offering a different solution what it is that you would need to count how many times a script has run for... and would the script be looping, or would it actually close open close open etc?

The script is one I run at the end of each day to do maintenance - clone partitions, cleanup files, run AdAware, SpyBot, etc. My backup procedure is to clone the data partition each run of the script. On the seventh run, I want to clone the entire disk. I use the run count to decide if this is my seventh run. I would rather do this than use day of the week, because I may be away from ny computer for some days, and I want to base the counting on days I actually used the computer.

PaulF

Link to comment
Share on other sites

Ini or registry is about the same.

$c = IniRead('@scriptdir & '\runs.ini','Main','NumOfTimes',1)
$c = $c +1
if $c/7=int($c/7) then clonedisk()
IniWrite('@scriptdir & '\runs.ini','Main','NumOfTimes',$c)

something like that.

$c=Regread("HKCU\Software\yourscriptname", "runs", "REG_SZ", 1)
$c = $c +1
if $c/7=int($c/7) then clonedisk()
RegWrite("HKCU\Software\yourscriptname", "runs", "REG_SZ", $c)

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...