Sign in to follow this  
Followers 0
quick_sliver007

Help

3 posts in this topic

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()

Select

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

ExitLoop

Case $msg = $fileitem

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

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

Case $msg = $exititem

ExitLoop

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")

EndSelect

WEnd

;;;;;;;;;;;;;;;;;;;;;;;

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 )


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thank you very much.


.

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  
Followers 0