Sign in to follow this  
Followers 0
derkaderka

Multiple User Profiles

1 post in this topic

Hello, I am trying to make a program that will take the user data that I input and log into a proxy that I am connected to (I am just lazy to type in my log in information every time I open the internet). But I want to make multiple user profiles. I was wondering how I could do that, what I want to happen is that the user clicks on "New Profile", enters their information, and then clicks add profile. Then at the main screen the option will be added to the combo box. Then once the user chooses the profile they click connect, the internet opens and then the info is automatically entered into the boxes. I also want the profile info to be saved to an .ini settings file. In addition I would like the profile option to show up as a option to edit profile under the options menu. I don't know how much of this is possible but I could use some help. Here is what I have so far:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $sData1 = ""
Global $sData2 = ""
Global $sData3 = ""

$Main = GUICreate("Proxy Logger", 295, 101, 192, 124)
$Menu1 = GUICtrlCreateMenu("File")
$Menu2 = GUICtrlCreateMenu("Edit")
$Menu3 = GUICtrlCreateMenu("Help")
$AddP = GUICtrlCreateMenuItem("New Profile", $Menu1)
$Quit = GUICtrlCreateMenuItem("Quit", $Menu1)
$Options = GUICtrlCreateMenuItem("Options", $Menu2)
$Help = GUICtrlCreateMenuItem("Help", $Menu3)
$Validate = GUICtrlCreateCheckbox("Proxy Connected", 184, 16, 97, 25)
$Combo1 = GUICtrlCreateCombo("Select a Profile", 16, 16, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Connect = GUICtrlCreateButton("Connect", 16, 48, 243, 25)
GUICtrlSetState($Connect, $GUI_DISABLE)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Validate
            validate()
        Case $Connect
            connect()
        Case $Quit
            Exit
        Case $Options
            options()
        Case $Help
            help()
        Case $AddP
            newprofile()
    EndSwitch
WEnd

Func connect()
EndFunc

Func validate()
    $Read3 = GUICtrlRead($Combo1)
    If $Read3 = "Select a Profile" Then
        MsgBox(0, "Error", "Error: profile must be selected")
        GUICtrlSetState($Validate, $GUI_UNCHECKED)
        Return
    Else
        GUICtrlSetState($Connect, $GUI_ENABLE)
    EndIf
EndFunc

Func options()
$Form3 = GUICreate("Options", 346, 117, 194, 130)
$Autolog = GUICtrlCreateCheckbox("Automatic Log In", 16, 24, 97, 17)
$Profiles = GUICtrlCreateCombo("Select a Profile to Edit", 184, 48, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Edit = GUICtrlCreateLabel("Edit a Profile", 184, 24, 63, 17)
$WebBrowsSelect = GUICtrlCreateCombo("Select a Web Browser", 16, 48, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Firefox = GUICtrlSetData($WebBrowsSelect, "Firefox")
$Chrome = GUICtrlSetData($WebBrowsSelect, "Google Chrome")
$Save = GUICtrlCreateButton("Save", 136, 80, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form3)
            Return
        Case $Save
            
        Case $Firefox
            
        Case $Chrome
            
    EndSwitch
WEnd
EndFunc

Func help()
EndFunc

Func newprofile()
$Form2 = GUICreate("New Profile", 302, 159, 202, 126)
$Pname = GUICtrlCreateInput("", 16, 32, 121, 21)
GUICtrlSetCursor (-1, 5)
$Username = GUICtrlCreateInput("", 16, 88, 121, 21)
GUICtrlSetTip(-1, "Proxy Username")
GUICtrlSetCursor (-1, 5)
$Add = GUICtrlCreateButton("Create Profile", 80, 120, 123, 25)
$Name = GUICtrlCreateLabel("Profile Name:", 16, 8, 67, 17)
$UN = GUICtrlCreateLabel("Username:", 16, 64, 55, 17)
$PW = GUICtrlCreateLabel("Password:", 152, 64, 53, 17)
$Password = GUICtrlCreateButton("Add Password", 152, 88, 83, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form2)
            Return
        Case $Password
            $Pass = InputBox("Enter a Password", "Please enter your proxy password", "", "•")
        Case $Add
            $Read1 = GUICtrlRead($Pname)
            $Read2 = GUICtrlRead($Username)
            GUICtrlSetData($Combo1, $Read1)
            $sData1 = IniWrite(@ScriptDir & "\profile_settings.ini", "PROFILES", "Profile Name", $Read1)
            $SData2 = IniWrite(@ScriptDir & "\profile_settings.ini", "PROFILES", "Username", $Read2)
            $sData3 = IniWrite(@ScriptDir & "\profile_settings.ini", "PROFILES", "Password", $Pass)
            GUIDelete($Form2)
            Return
    EndSwitch
WEnd
EndFunc

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