2

I have an AHK script that I typically use to use as shorthand replies. For example:

::test::
 Send, Hi, this is a test.
 Return

 ::test2::
 Send, hi this is test2.
 Return

 ::test3::
 Send, hi this is test3.
 Return

What I need to find is a way to count and store the amount of times each hotkey is run daily. Can anyone help with this? I have excel available and have trawled the user forums, but can't find an answer.

1 Answer 1

1

You can write the count to a file and then increase it every time you run the hotstring:

::test::
 FileRead, count, count.txt
 ++count
 FileDelete, count.txt
 FileAppend, % count, count.txt
 Send, Hi, this is a test.
Return

You could create one file per hotkey this way.

Alternatively you could use IniRead and IniWrite to keep everything in one file and maybe also store optional data such as dates.

Sign up to request clarification or add additional context in comments.

6 Comments

Hi, thanks so much for helping. I've tried the code above, but just get a txt file with the words 'newCount'. Have I missed something?
Should be fixed now. Try again.
Hi, it's still returning a blank unfortunately :(
I say still, I mean it's now returning a blank count.txt file. Would the Ini solution be better do you think?
I've figured it out. Thanks so much for all your help. FYI it needed a starting figure of 0 to be set in the count.txt file and now it's working.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.