Jump to content
Sign in to follow this  


Recommended Posts

I am tring to get my script to read what is in the Ini file and then to add 1 to value in the Ini and then to write the value in the Ini file(replace the old value). I want it to do all of this when I push the button named "a" and for it to add 1 ever time i push the a button.. Here is what i have.

While 1

$msg = GUIGetMsg()


Case $msg = $GUI_EVENT_CLOSE Or $msg = $bbutton


Case $msg = $fileitem

$file = FileOpenDialog("Choose file...",@TempDir,"All (*.*)")

If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu)

Case $msg = $exititem


Case $msg = $abutton

$currentvalue = IniRead ( "counter.ini", "counter", "currentcount", "unknown" ) + 1

Iniwrite ( "counter.ini", "counter", "currentcount", "$currentvalue" )

Case $msg = $aboutitem

Msgbox(0,"About","GUI Menu Test")




I have tried it like.

Case $msg = $abutton

$currentvalue = ( IniRead "counter.ini", "counter", "currentcount", "unknown" ) + 1

Iniwrite ( "counter.ini", "counter", "currentcount", "$currentvalue" )

And I have tried it like this too.

$msg = $abutton

$currentvalue = IniRead ( "counter.ini", "counter", "currentcount", "unknown" )

$newcurrentvalue = 1 + $currentvalue

Iniwrite ( "counter.ini", "counter", "currentcount", "$newcurrentvalue" )

With both ways, it is not writing in the Ini file at all. Can anyone help me with this. If so I give my thanks.


Share this post

Link to post
Share on other sites

$currentvalue = IniRead ("counter.ini", "counter", "currentcount", "0" ) + 1
Iniwrite ( "counter.ini", "counter", "currentcount", $currentvalue )

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...