Sign in to follow this  
Followers 0
Noobcube

Ini save

18 posts in this topic

how do make the ini save if

If BitAnd(GuiCtrlRead($checkloot),$GUI_CHECKED) then

Controlsend($a, "", "", "{SPACE}")

Endif

is checked or not

IniWrite("Ini", "Attack", "key", "this is a new value")

is there a way i can make it save if the box is checked or not?

Thanks in advance

sorry i cant explain better lol

Share this post


Link to post
Share on other sites



If BitAnd(GuiCtrlRead($checkloot),$GUI_CHECKED) then

Controlsend($a, "", "", "{SPACE}")

Endif

and that works for me

now i need iniwrite

i have

Case $Save

IniWrite("Ini", "Attack", "key", "this is a new value")

but how do i link them? so if the checkbox is saved when i load the ini file it will decet the box was checked if you understand

thanks in advance

dont know if thats better to understand :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I think this is what your looking for if not I need more info.

This reads from a file called myinifile.ini . And restores the check in the box if there was one when you saved. Note: I used 257 because sometimes it comes up as 257 for a check in the box not sure why.

$checkloot = IniRead("myinifile.ini", "main", "loot", "")
If $checkloot = "1"  Or $checkloot = "257"  Then
GUICtrlSetState($TreeView1_0, $GUI_CheckED)
Else
GUICtrlSetState($TreeView1_0, $GUI_UNCheckED)
EndIf

To Save

IniWrite("myinifile.ini", "main", "loot", GUICtrlRead($TreeView1_0))

Edited by JamesDover

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

kinda

my first checkbox is $checkloot

so would i just have Iniwrite("Ini", "Attack" ,$checkloot, :S)

i dunno what to put in that last bit

the when i do

Iniread("Ini", "Attack", $checkloot", :S)

still dunno that last bit it should check/uncheck what ever is saved

also where abouts would the code go in

would it be inbetween this

If BitAnd(GuiCtrlRead($checkloot),$GUI_CHECKED) then

Controlsend($a, "", "", "{SPACE}")

Endif

If BitAnd(GuiCtrlRead($Attspeed),$GUI_CHECKED) then

sleep($input)

Endif

Edited by Noobcube

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

IniWrite("myinifile.ini", "Attack", "loot", GUICtrlRead($checkloot))

$checkloot = IniRead("myinifile.ini", "Attack", "loot", "")

If $checkloot = "1" Or $checkloot = "257" Then

GUICtrlSetState($checkloot, $GUI_CheckED)

Else

GUICtrlSetState($checkloot, $GUI_UNCheckED)

EndIf

Edited by JamesDover

Share this post


Link to post
Share on other sites

Thanks it almost works

i check the box

press save

it saves fine

untick the box

press load but the box doesnt re-tick

Case $Save

IniWrite("myinifile.ini", "Attack", "loot", GUICtrlRead($checkloot))

$checkloot = IniRead("myinifile.ini", "Attack", "loot", "")

If $checkloot = "1" Or $checkloot = "257" Then

GUICtrlSetState($checkloot, $GUI_CheckED)

Else

GUICtrlSetState($checkloot, $GUI_UNCheckED)

EndIf

Case $Load

IniRead("myinifile.ini", "Attack", "loot", GUICtrlRead($checkloot))

thats what i have so far

am i missing something out?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Why the Case? Search the help for: Select...Case...EndSelect

Maybe this works for you, it may not because I dont have the rest of your program.

IniWrite("myinifile.ini", "Attack", "loot", GUICtrlRead($checkloot))

$checkloot = IniRead("myinifile.ini", "Attack", "loot", $GUI_Unchecked)
If $checkloot = "1" Or $checkloot = "257" Then
    GUICtrlSetState($checkloot, $GUI_CheckED)
Else
    GUICtrlSetState($checkloot, $GUI_UNCheckED)
EndIf

Edit: May made it simpeler.

Edited by Triblade

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

what is under your myinifile.ini under attack then loot? I'm looking for the number.

Share this post


Link to post
Share on other sites

Why the Case? Search the help for: Select...Case...EndSelect

Maybe this works for you, it may not because I dont have the rest of your program.

IniWrite("myinifile.ini", "Attack", "loot", GUICtrlRead($checkloot))

$checkloot = IniRead("myinifile.ini", "Attack", "loot", $GUI_Unchecked)
If $checkloot = "1" Or $checkloot = "257" Then
    GUICtrlSetState($checkloot, $GUI_CheckED)
Else
    GUICtrlSetState($checkloot, $GUI_UNCheckED)
EndIf

Edit: May made it simpeler.

Same problem

saves but loadnt load:(

Share this post


Link to post
Share on other sites

Why the Case? Search the help for: Select...Case...EndSelect

Maybe this works for you, it may not because I dont have the rest of your program.

IniWrite("myinifile.ini", "Attack", "loot", GUICtrlRead($checkloot))

$checkloot = IniRead("myinifile.ini", "Attack", "loot", $GUI_Unchecked)
If $checkloot = "1" Or $checkloot = "257" Then
    GUICtrlSetState($checkloot, $GUI_CheckED)
Else
    GUICtrlSetState($checkloot, $GUI_UNCheckED)
EndIf

Edit: May made it simpeler.

Same problem

saves but loadnt load:(

Share this post


Link to post
Share on other sites

come-on you guys helping...

$checkloot = IniRead("myinifile.ini", "Attack", "loot", $GUI_Unchecked)

and

GUICtrlSetState($checkloot, $GUI_CheckED)

is NOT POSSIBLE!!!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

thanks :)

does first one go under save button( Case $Save)

and second under load button?(Case $Load)

so far i have

Case $Save

Case $Load

ive tried adding all your suggestions in :P

but no load again after

if one of you very helpful people could fill in the gaps with the correct order i would be very gratful

ive tried all the combinations i can think of :P

Edited by Noobcube

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Yes one "can" be save and one load, however normally the "load" is done when the script starts. The "save" is done by a button

; save portion
IniWrite("myinifile.ini", "Attack", "loot", GUICtrlRead($checkloot))

; load portion
$loot = IniRead("myinifile.ini", "Attack", "loot", "0")
If $loot = "1" Or $loot = "257" Then
    GUICtrlSetState($checkloot, $GUI_CHECKED)
Else
    GUICtrlSetState($checkloot, $GUI_UNCHECKED)
EndIf

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

hmm could you help me do it so i can load at will :)

because the program im making, i have 11 checkboxes and i would need to save a few differnent combos( i can make it write a few diff ini's myself, i figure THAT out lol)

so i need a button to load a few different ones

Share this post


Link to post
Share on other sites

come-on you guys helping...

$checkloot = IniRead("myinifile.ini", "Attack", "loot", $GUI_Unchecked)

and

GUICtrlSetState($checkloot, $GUI_CheckED)

is NOT POSSIBLE!!!

8)

Hmm, Okay, didn't see that one there. Sorry m8 :)

I - very dumb btw - just edited the original code without thinking...

$checkboxcontrol = GUICtrlCreateCheckbox()

Noobcube -> The $checkboxcontrol variable you have to edit to the var that is holding your checkbox id.

#include <GUIConstants.au3>

IniWrite("myinifile.ini", "Attack", "loot", GUICtrlRead($checkboxcontrol))
load()

Func load()
    $checkloot = IniRead("myinifile.ini", "Attack", "loot", $GUI_Unchecked)

    If $checkloot = "1" Or $checkloot = "257" Then
        GUICtrlSetState($checkboxcontrol, $GUI_Checked)
    Else
        GUICtrlSetState($checkboxcontrol, $GUI_UNChecked)
    EndIf
EndFunc

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

; actually I always use this for checkboxes

; save portion
IniWrite("myinifile.ini", "Attack", "loot", _IsChecked($checkloot))

; load portion
$loot = IniRead("myinifile.ini", "Attack", "loot", "0")
If $loot Then
    GUICtrlSetState($checkloot, $GUI_CHECKED)
EndIf

; when crreated, it is already un-checked

Func _IsChecked($control)
    Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Hmm, Okay, didn't see that one there. Sorry m8 :)

I - very dumb btw - just edited the original code without thinking...

$checkboxcontrol = GUICtrlCreateCheckbox()

Noobcube -> The $checkboxcontrol variable you have to edit to the var that is holding your checkbox id.

#include <GUIConstants.au3>

IniWrite("myinifile.ini", "Attack", "loot", GUICtrlRead($checkboxcontrol))
load()

Func load()
    $checkloot = IniRead("myinifile.ini", "Attack", "loot", $GUI_Unchecked)

    If $checkloot = "1" Or $checkloot = "257" Then
        GUICtrlSetState($checkboxcontrol, $GUI_Checked)
    Else
        GUICtrlSetState($checkboxcontrol, $GUI_UNChecked)
    EndIf
EndFunc
i tried that one aswell but same prob , doesnt load up again :P

So far i have

Case $Save

$Ininame = InputBox("Name", "Name This Save(Add .ini at the end)", "")

$checkboxcontrol = GUICtrlCreateCheckbox("Loot?" , 48 , 32 , 97 , 17)

IniWrite($Ininame, "Attack", "loot", GUICtrlRead($checkboxcontrol))

Case $Load

load()

Func load()

$Ininame1 = InputBox("Name", "Which Load?(Add .ini at the end)", "")

$checkloot = IniRead($Ininame1, "Attack", "loot", $GUI_Unchecked)

If $checkloot = "1" Or $checkloot = "257" Then

GUICtrlSetState($checkboxcontrol, $GUI_Checked)

Else

GUICtrlSetState($checkboxcontrol, $GUI_UNChecked)

EndIf

EndFunc

i must have a made a very nooby mistake somewhere lol

can you spot it coz i cant find it :P

IniWrite($Ininame, "Attack", "loot", _iIsChecked($checkloot))

i tried that but the _IsChecked causes a problem

what there something missing out?

Edited by Noobcube

Share this post


Link to post
Share on other sites

Have you tried making msgbox's or ConsoleWrite's everywhere to show you values of outcomes. For example the outcome of $Ininame1 and $checkloot etc.

For example, if your $checkloot variable isnt't 1 or 257 it's never gonna work so you need to know if that value is really returned.

Did you use $checkboxcontrol as the name of the checkbox you make in you GUI?

If you can and your script isn't to large, could you show the rest of your script?

P.S. In your IniWrite at the bottom there is a typo. _iIsChecked instead of _IsChecked.


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

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