Jump to content

IniWrite


Jayson
 Share

Recommended Posts

Hello, i'm kinda new to AutoIt and i'm getting stuck with my stuff.

Here it is :

I added 2 input that would store the info into an .ini file. The problem is that it overwrite the info that was there before when im entering new user/pass. I want my code to add another line under the Login section without deleting the actual one.

That's my small code for now

#include <String.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("Selecting application", 300, 267, 100, 124)
$Label1 = GUICtrlCreateLabel("Username :", 8, 192, 70, 22)
$Label2 = GUICtrlCreateLabel("Password :", 8, 216, 67, 22)
$add = GUICtrlCreateButton("ADD", 8, 240, 75, 17, $WS_GROUP)
$user = GUICtrlCreateInput("", 96, 192, 121, 21)
$pass = GUICtrlCreateInput("", 96, 216, 121, 21)
$Label3 = GUICtrlCreateLabel("Username selected :", 1, 23, 120, 22)
$rpass = GUICtrlCreateInput("", 100, 45, 121, 21, $WS_DISABLED)
$ruser = GUICtrlCreateCombo("", 100, 20, 121, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $add
            IniWrite("manager1.ini", "Login", "Name", GUICtrlRead($user,1))
            IniWrite("manager1.ini", "Login", "Encrypt", StringToBinary(GUICtrlRead($pass)))
    EndSwitch
WEnd
Link to comment
Share on other sites

Thx alot it worked !!

This is my updated code so far :

#include <String.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("Selecting application", 300, 267, 100, 124)
$Label1 = GUICtrlCreateLabel("Username :", 8, 168, 70, 22)
$Label2 = GUICtrlCreateLabel("Password :", 8, 192, 67, 22)
$Label3 = GUICtrlCreateLabel("Application :", 8, 216, 67, 22)
$Label4 = GUICtrlCreateLabel("Username selected :", 1, 23, 120, 22)
$Label5 = GUICtrlCreateLabel("Password :", 45, 47, 120, 22)
$Label5 = GUICtrlCreateLabel("Application :", 38, 71, 120, 22)
$user = GUICtrlCreateInput("", 96, 168, 121, 21)
$pass = GUICtrlCreateInput("", 96, 192, 121, 21, $ES_PASSWORD)
$app = GUICtrlCreateInput("", 96, 216, 121, 21)
$add = GUICtrlCreateButton("ADD", 8, 240, 75, 17, $WS_GROUP)
$ruser = GUICtrlCreateCombo("", 100, 20, 180, 21)
GUICtrlSetData(-1, IniRead("manager1.ini", "Roxanne", "Username", ""))
GUICtrlSetData(-1, IniRead("manager1.ini", "Jason", "Username", ""))
$rpass = GUICtrlCreateInput("", 100, 45, 121, 21, $ES_READONLY)
$rapp = GUICtrlCreateCombo("", 100, 70, 121, 21)
GUICtrlSetData(-1, IniRead("manager1.ini", "Roxanne", "Application", ""))
GUICtrlSetData(-1, IniRead("manager1.ini", "Jason", "Application", ""))
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $add
            If GUICtrlRead($user,1) = "blabla@hotmail.com" Then
                $sIni = @DesktopDir & "\manager1.ini"
                IniWrite($sIni, "Jason", StringToBinary(GUICtrlRead($pass)), GUICtrlRead($app) )  
                    ElseIf GUICtrlRead($user,1) = "blabla1@hotmail.com" Then
                    $sIni = @DesktopDir & "\manager1.ini"
                    IniWrite($sIni, "Roxanne", StringToBinary(GUICtrlRead($pass)), GUICtrlRead($app) ) 
            Else
                MsgBox(4096, "Something missing !", "You forget to add your username/password !")
                ;Exit
            EndIf
        Case $ruser
    EndSwitch
WEnd

But how i can read the information like this 0x6C6F6C=okman ?

When i choose okman by the combo i would like the Binary password appear in the edit $rpass.

Can you help me pls !

Edited by Jayson
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...