If you really want to go the route of incrementing an integer in the registry, then just do:
regset64 "[HKEY_LOCAL_MACHINE\SOFTWARE\CORP]" "RunCount"="{unique value of (it + 1) of (it as string as integer) of values "RunCount" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\CORP" of native registry | 1}"
You don’t need any if/then/else checks or anything. This will return 1 if the value doesn’t already exist, otherwise it returns the current value + 1
if done right, you can avoid almost all if/then/else checks by writing the relevance differently, and end up with something that is more efficient, more compact, and I think easier to follow:
unique value of (it + 1) of (it as string as integer) of values "RunCount" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\CORP" of native registry | 1
it is the | 1
at the end that ensures it always returns 1 no matter what.
That said, you don’t technically need to do this, also this method only works on windows, while the ActionHistory.DB method is cross platform.
If you want some help with the ActionHistory.db method, then let me know. I recommend using the DB Browser for SQLite to examine it and help write the needed SQLite query:
The hardest part of this is you have to do a join on 2 different tables to get the name of the action and the active count of the same action.
To get the active count of all actions:
SELECT "ActionID", "ActiveCount" FROM "main"."ACTION_STATE_HISTORY"
To get the ActionID to Name mapping:
SELECT "ActionID", "ActionName" FROM "main"."ACTION_HISTORY"
The hard part is joining these 2 queries with either relevance or SQLite query. I’m not a SQL expert. I would have to find an example.
These example have a JOIN already that is similar to what is needed: