Sign in to follow this  
Followers 0
derkaderka

Basic multiple profiles

1 post in this topic

This script asks the user to input a user name, then to enter a string. You can access this later by just typing in the profile name. Every time you add a profile you can access all the profiles, again by simply typing the profile name and pressing load. This is very basic but there is quite a bit you could do with this.

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

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

$Form1 = GUICreate("Test", 240, 125, 189, 123)
$Input1 = GUICtrlCreateInput("", 16, 24, 121, 21)
GUICtrlSetTip(-1, "Enter the name of the profile you would like to create")
$Button1 = GUICtrlCreateButton("Add", 144, 24, 75, 25)
$Button2 = GUICtrlCreateButton("Load", 144, 80, 75, 25)
$Input2 = GUICtrlCreateInput("", 16, 80, 121, 21)
GUICtrlSetTip(-1, "Enter the name of the profile you would like to load")
$Label1 = GUICtrlCreateLabel("Enter Profile Name:", 16, 8, 95, 17)
$Label2 = GUICtrlCreateLabel("Enter Profile Name:", 16, 64, 95, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _add()
        Case $Button2
            _load()
    EndSwitch
WEnd

Func _add()
    $read3 = InputBox("", "Enter a string", "")
    $read1 = GUICtrlRead($Input1)
    $Number = (Random(0, 9))
    $Letter = Chr(Random(Asc("a"), Asc("z"), 1))
    $CLetter = Chr(Random(Asc("A"), Asc("Z"), 1))
    $r = ($Number & $Letter & $Cletter)
    $source = ("\test_" & $r & ".ini")
    $sData1 = IniWrite(@ScriptDir & $source, "PROFILE", "Input1", $read3)
    $sData2 = IniWrite(@ScriptDir & "\profiles.ini", "PROFILE LIST", $read1, $source)
EndFunc

Func _load()
    $read2 = GUICtrlRead($Input2)
    $sData2 = IniRead(@ScriptDir & "\profiles.ini", "PROFILE LIST", $read2, "")
    $sData1 = IniRead(@ScriptDir & $sData2, "PROFILE", "Input1", "")
    MsgBox(0, "", $sData1)
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