Guest User

Autohotkey Spoop Counter

a guest
Oct 25th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Enter your TXT file path:
  2. filePath = C:\Users\USERNAME\Documents\Streaming\spoops.txt
  3.  
  4. ;Label before the number, make an empty string to just have a bare number:
  5. label := "Spoops: "
  6.  
  7. FileReadLine, spoopString, %filePath%, 1
  8.  
  9. ;When you press Numpad + it will increment and update the death counter in the .txt
  10.     NumpadAdd::
  11.         ;Creates txt file with a count of 0 which is incremented to 1 if it doesn't exist.
  12.         IfNotExist, %filePath%
  13.         {
  14.             FileAppend, 0, %filePath%
  15.             spoopCount := 0
  16.         }
  17.         ;Created a file.
  18.         ;Inputs number of spoops in spoopCount variable.
  19.         FileReadLine, spoopString, %filePath%, 1
  20.         spoopCount:= SubStr(spoopString, StrLen(label))
  21.         spoopCount++
  22.         FileDelete, %filePath%
  23.         FileAppend, %label%%spoopCount%, %filePath%
  24.     return
  25.  
  26. ;When you press Numpad - it will decrement and update the death counter in the .txt
  27.     NumpadSub::
  28.         ;Inputs number of spoops in spoopCount variable.
  29.         FileReadLine, spoopString, %filePath%, 1
  30.         spoopCount:= SubStr(spoopString, StrLen(label))
  31.        
  32.         ;Don't go below 0
  33.         if(spoopCount = 0)
  34.             return
  35.  
  36.         spoopCount--
  37.         FileDelete, %filePath%
  38.         FileAppend, %label%%spoopCount%, %filePath%
  39.     return
Add Comment
Please, Sign In to add comment