Jump to content
Sign in to follow this  
eckyecky

ini files

Recommended Posts

nevermind solved mods please delete this

can someone help me with this

$cb* is a checkbox and $tb* is an input

Func OnAutoItExit ()
    
$enableglobaluser = GUICtrlRead($cbEnableglobaluser)
$enableglobalpass = GUICtrlRead($cbEnableglobalpass)
$globaluser = GUICtrlRead($tbGlobaluser)
$globalpass = _StringEncrypt(1,GUICtrlRead($tbGlobalPass),$encryptionpass)
$enableadvercash = GUICtrlRead($cbAdvercashenabled)
$advercashuser = GUICtrlRead($tbadvercashuser)
$advercashpass = _StringEncrypt(1,GUICtrlRead($tbadvercashpass),$encryptionpass)
    
    
iniwrite($inifile,"Default","EnableGlobaluser",$enableglobaluser)
iniwrite($inifile,"Default","EnableGlobalpass",$enableglobalpass)
iniwrite($inifile,"Default","Globaluser",$globaluser)
iniwrite($inifile,"Default","Globalpass",$enableadvercash)
Iniwrite($inifile, "Default", "EnableAdvercash", $enableadvercash) 
IniWrite($inifile, "Default", "Advercashuser", $advercashuser)
IniWrite($inifile, "Default", "advercashpass", $advercashpass)
EndFunc;==>OnAutoItExit

when they all have useful stuff in the variables i get the following ini

[Default]
EnableGlobaluser=0
EnableGlobalpass=0
Globaluser=0
Globalpass=0
EnableAdvercash=0
Advercashuser=0
advercashpass=
Edited by eckyecky

Share this post


Link to post
Share on other sites

Hi eckyecky,

I'm not sure what you expected for the output data, but if you want to

have the checkbox state you need to use this piece of code:

CODE
BitAnd(GUICtrlRead($Item),$GUI_CHECKED)

It will return 0 "zero" for Not Checked and it will return 1 "one" for Checked.

Also I assume that the vars used to read the guicontrols are the handles to those controls.

If not you need to use handles to them.

Something like...

CODE
#include <GUIConstants.au3>

GUICreate("My GUI Checkbox") ; will create a dialog box or 'form' that when displayed is centered

$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20) ;create a checkbox on the GUI created above

;^-----------------is the handle of that checkbox

$BtnCheck=GUICtrlCreateButton("Check State",10,50,120,20) ;create a button

;^-----------------is the handle of that button

GUISetState () ; will display an dialog box with 1 checkbox and one button

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $BtnCheck

MsgBox(0,"CheckBox State","The state is now " & BitAnd(GUICtrlRead($checkCN),$GUI_CHECKED) )

EndSelect

Wend

Edited by Scriptonize

If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites

thanks but i set it to run those before it started exiting

code was fine just in wrong place

it seemed it deleted the controls before i accessed them

so moved it to before autoit exit

Edited by eckyecky

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  

×
×
  • Create New...