Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Add counter in AHK and save in reg file


  • Please log in to reply
1 reply to this topic
Natascha Baker
  • Guests
  • Last active:
  • Joined: --
Hello,

I have a reg.ini , in this file, it look like this:
name: me
pc: laptop

But now i want is every time, i start the ahk script, he must add a line into the regi.ini and save a counter log, so start the ahk script and he make this:

name: me
pc: laptop
counter: 1

and start again, he makes 2, start again and make 3 and 4 ...
But only he must add a counter number, not edit or replace the name and pc name, that must be same.

Any tips? thanks again

Frankie
  • Members
  • 2930 posts
  • Last active: Feb 05 2015 02:49 PM
  • Joined: 02 Nov 2008
FileName = C:\reg.ini
If !FileExist(FileName)
  IniWrite, 0, %FileName%, Counter, Counter
IniRead, Ctr, %FileName%, Counter, Counter
Ctr++
IniWrite, %Ctr%, %FileName%, Counter, Counter
IniWrite, Me, %FileName%, Section%Ctr%, Name
IniWrite, Laptop, %FileName%, Section%Ctr%, PC
It will look like this:
[Counter]
Counter=5
[Section1]
Name=Me
PC=Laptop
[Section2]
Name=Me
PC=Laptop
[Section3]
Name=Me
PC=Laptop
[Section4]
Name=Me
PC=Laptop
[Section5]
Name=Me
PC=Laptop

aboutscriptappsscripts
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run