Code: Select all
AccountHandler() {
FileCreateDir, ./Accounts
IfNotExist, ./Accounts/Main.txt
FileAppend,
(
), ./Accounts/Main.txt
IfNotExist, ./Accounts/Test.txt
FileAppend,
(
), ./Accounts/Test.txt
IfNotExist, ./Accounts/Test2.txt
FileAppend,
(
), ./Accounts/Test2.txt
IfNotExist, ./Accounts/Test3.txt
FileAppend,
(
), ./Accounts/Test3.txt
}
AccountHandler()
FileReadLine, MainU, ./Accounts/Main.txt, 1
FileReadLine, MainP, ./Accounts/Main.txt, 2
FileReadLine, TestU, ./Accounts/Test.txt, 1
FileReadLine, TestP, ./Accounts/Test.txt, 2
FileReadLine, Test2U, ./Accounts/Test2.txt, 1
FileReadLine, Test2P, ./Accounts/Test2.txt, 2
FileReadLine, Test3U, ./Accounts/Test3.txt, 1
FileReadLine, Test3P, ./Accounts/Test3.txt, 2
Code: Select all
#NoEnv
#Warn
#SingleInstance Force
SetWorkingDir %A_ScriptDir%
#include %A_ScriptDir%/Libs/AFS.ahk
mainUser := MainU
mainPass := MainP
testUser := TestU
testPass := TestP
test2User := Test2U
test2Pass := Test2P
test3User := Test3U
test3Pass := Test3P
Gui -MaximizeBox +OwnDialogs
Gui Color, 0x1E1E1E
Gui Add, DropDownList, vUserChoice gUserSelect x100 y225 w220, Main (%mainUser%)||Test (%testUser%)|Test2 (%test2User%)|Test3Man (%test3User%)
Gui Add, Edit, hWndhEdit1 vUserBox x100 y250 w220 h21
DllCall("SendMessage", "Ptr", hEdit1, "UInt", 0x1501, "Ptr", 1, "WStr", "Username") ; Hint text
GuiControlGet, UserChoice
StringReplace, UserChoice, UserChoice, ),, All
out := RegExReplace(UserChoice, "(.*?)\(")
GuiControl,, UserBox, %out%
Gui Add, Edit, hWndhEdit2 vPassBox x100 y275 w220 h21 +Password
DllCall("SendMessage", "Ptr", hEdit2, "UInt", 0x1501, "Ptr", 1, "WStr", "Password") ; Hint text
Gui Add, Button, x150 y325 w120 h40, Login
Gui Show, w420 h400, OSPal
Return
GuiContextMenu:
Return
GuiEscape:
GuiClose:
ExitApp
UserSelect:
Gui, Submit, nohide
StringReplace, UserChoice, UserChoice, ),, All
out := RegExReplace(UserChoice, "(.*?)\(")
GuiControl,, UserBox, %out%
;GuiControlGet, UserChoice
if (UserChoice = Main (%mainUser%))
GuiControl,, PassBox, %mainPass%
else if (UserChoice = "Test (%testUser%)")
GuiControl,, PassBox, %testPass%
else if (UserChoice = "Test2 (%test2User%)")
GuiControl,, PassBox, %test2Pass%
else if (UserChoice = "Test3 (%test3User%)")
GuiControl,, PassBox, %TestPass%
return
I have a few problems at the minute;
no 1 is there a better way to handle the regex as i could suse out how to remover las bracket so i have to use a Stringreplace.
no 2 and this is my main problem is that i cant get it to place password in password edit box as i think the variables throw it off.
Any help or recommendations would be greatly appreciated
PS befor roast remember this is my first crack at AHK