Jump to content

IniRead-/Write


Zanaj
 Share

Recommended Posts

Still trying to learn the base of Autoit, got hang of it by now, through I ran into get a code working. I was making a random program that don't give sense, so I won't go into details as it doesn't matter for the problem itself... I was trying to make some options, thinking and walking back and forth in my small room and then I stumbled on IniRead and -Write. I really wanted to try it out, as it was perfect! Problem is...Can't get it to work.

That's my code:

 
Func UpdateOptions()
IniWrite("Option.Ini","TrashCan",$EmptyTrashcan)
IniWrite("Option.Ini","ScreenRelu",$ScreenR)
IniWrite("Option.Ini","Path",$Path)
 
$Path=IniRead("Option.Ini","Path")
$ScreenR=IniRead("Option.Ini","ScreenRelu")
$Trashcan=IniRead("Option.Ini","TrashCan")
Ini:
TrashCan=
ScreenRelu=
Path=

EndFunc

That's my failed attempt after the help file xD!...

Soo any better than Ini's to store and or save info for a program?

Thank you (:

Nicki/Zanaj~

Link to comment
Share on other sites

Oh sorry the part where it writes is another func called updateValues XD...And at the start of the program those are sat by my settings so when you open it does that and but you can change them through options!

Link to comment
Share on other sites

Try this:

$Path=IniRead("Option.Ini","info", "Path", "")
$ScreenR=IniRead("Option.Ini","info", "ScreenRelu", "")
$Trashcan=IniRead("Option.Ini","info", "TrashCan", "")

MsgBox(0,"", $Path)
MsgBox(0,"", $ScreenR)
MsgBox(0,"", $Trashcan)

ini:

[info]
TrashCan=test1
ScreenRelu=test2
Path=test3
Edited by EKY32

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Link to comment
Share on other sites

Well that part do work very well but doesn't seem my button func is working...Shall I repost or can anyone help what I do is this:

;Gui making
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 306, 167, 192, 124)
$RandomList = GUICtrlCreateList("", 8, 8, 121, 149)
GUICtrlSetData(-1, "TrashCanStuff|Whatever|Bishes")
$New = GUICtrlCreateButton("New Path", 136, 16, 163, 25)
$Start = GUICtrlCreateButton("Start", 136, 128, 163, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

;Making a new
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $New
$Path=IniRead("Option.Ini","info", "Path", "")
$ScreenR=IniRead("Option.Ini","info", "ScreenRelu", "")
$Trashcan=IniRead("Option.Ini","info", "TrashCan", "")

    InstallValues()

  Case $Start
    InstallValues()

EndSwitch
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...