Arrays 如何计算自动热键命令在AHK脚本中运行的次数

Arrays 如何计算自动热键命令在AHK脚本中运行的次数,arrays,count,autohotkey,Arrays,Count,Autohotkey,我有一个AHK脚本,我通常使用它作为速记回复。例如: ::test:: Send, Hi, this is a test. Return ::test2:: Send, hi this is test2. Return ::test3:: Send, hi this is test3. Return 我需要找到一种方法来计算和存储每天运行每个热键的次数。有人能帮忙吗?我有excel可用,并且已经搜索了用户论坛,但找不到答案 您可以将计数写入文件,然后在每次运行热字符串时增加

我有一个AHK脚本,我通常使用它作为速记回复。例如:

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

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

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

我需要找到一种方法来计算和存储每天运行每个热键的次数。有人能帮忙吗?我有excel可用,并且已经搜索了用户论坛,但找不到答案

您可以将计数写入文件,然后在每次运行热字符串时增加计数:

::test::
 FileRead, count, count.txt
 ++count
 FileDelete, count.txt
 FileAppend, % count, count.txt
 Send, Hi, this is a test.
Return
您可以通过这种方式为每个热键创建一个文件


或者,您可以使用InRead和InWrite将所有内容保存在一个文件中,还可以存储日期等可选数据

嗨,非常感谢你的帮助。我已经尝试了上面的代码,但是只得到了一个带有“newCount”字样的txt文件。我错过什么了吗?现在应该修好了。再试一次。您好,它仍然返回一个空白。很遗憾:(我说仍然,我的意思是它现在返回一个空白的count.txt文件。您认为Ini解决方案会更好吗?我已经找到了。非常感谢您的帮助。仅供参考,它需要在count.txt文件中设置一个起始数字0,现在它可以工作了。