Jump to content

find out how many times an action has been performed?


Go to solution Solved by Subz,

Recommended Posts

  • Solution

Depends, do you mean how many times the script has been run or how many times during a single session?  If you want to count the number of times a script has run you would have to write it to either registry or to a file for example an ini.  Examples:

;~ Example 1 - Script Run Count
Global $g_iRunCount = IniRead(@ScriptDir & "\Script.ini", "General", "Count", 1)
$g_iRunCount += 1

;~ Do stuff here

;~ Exiting script
IniWrite(@ScriptDir & "\Script.ini", "General", "Count", $g_iRunCount)

;~ Example 2 - Function Count
Global $g_iFuncCount = 0

MsgBox(0, "Start Function Count", "Run " & $g_iFuncCount & " times.")
For $i = 1 To 10
MsgBox(0, "End Function Count", "Run " & $g_iFuncCount & " times.")

Func _Example()
    $g_iFuncCount += 1
    ;~ Do stuff


Link to comment
Share on other sites

  • Moderators

You could also write out to the Event Viewer when your script completes. Good not only for keeping track of the number of times run, but also polling for failures.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

  • Recently Browsing   0 members

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