Jump to content
Sign in to follow this  
quick_sliver007

Help

Recommended Posts

quick_sliver007

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
Jos

$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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
quick_sliver007

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  

×