Sign in to follow this  
Followers 0
Vindicator209

Use Count

7 posts in this topic

Sorry if this was answered else where...

What could i use to count how many times a script was executed? Is this possible?

Example: Stop running a script after 30 uses, such as a "Trial Version"

I was thinking something rather more in-script, because i heard you can have a script read a .txt file but i think someone could change the .txt file...

if this isint possible, state it, and thanks in advance, although i might end up saying thanks again anyway :)

and if any of you are wondering why i ask such newbish questions, its obviously cause im new at this and i have no idea where things are in the help file..(The heck is Macro Reference! :whistle: )


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



You probably need to save something in the registry, but it has to be in a very deep and secretive key.

This is to ensure that users cannot tamper with the count information.

Everytime the script is executed you can write something into a file or the registry which contains the count.

#include <Guiconstants.au3>

$count = 0 ; number of times

$read = Regread("HKLM\Software\Trial Version","Days Left")

$count = $read + 1 ; Reads how many times run
regwrite("Hklm\Software\Trail Version","Days Left", "Reg_SZ",$count)

This is very rough, but it should get somewhere...


F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

Share this post


Link to post
Share on other sites

You can use '_StringEncrypt ()' (from BETA) to encrypt the number of starts. Then write the encrypted string into the registry or a file. Only you can read the string.

Share this post


Link to post
Share on other sites

Newbies should not mess with the registry until they fully understand what they are doing (and what is the registry in the first place).

Mess around with the IniWrite instead.

#)

Share this post


Link to post
Share on other sites

$count = regread("HKLM\Software\Trial Version","Days")

$count = $count + 1
regwrite("HKLM\Software\Trial Version","Days","REG_SZ",$count)

if $count >= 30 Then
    msgbox(0,"","Trial Version Expired")
    Exit
EndIf

:whistle:


F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Not to be a smart ass or anything :whistle:, but if the count increases every use and the title of the message box is "days" its a little misleading eh? LOL just a thought.

Edited by dandymcgee

- Dan [Website]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

hehe wrong forum woops (hit the dang back button few too many lol)

Edited by dandymcgee

- Dan [Website]

Share this post


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
Sign in to follow this  
Followers 0