Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; =============================================================
- ; --------------------- Configs ---------------------------
- ; =============================================================
- #Include, Class_LV_Colors.ahk
- #SingleInstance, force
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- { ; RUN SCRIPT AS ADMIN
- Loop, %0% ; For each parameter:
- {
- param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
- params .= A_Space . param
- }
- ShellExecute := A_IsUnicode ? "shell32\ShellExecute":"shell32\ShellExecuteA"
- if not A_IsAdmin
- {
- If A_IsCompiled
- DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_ScriptFullPath, str, params , str, A_WorkingDir, int, 1)
- Else
- DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_AhkPath, str, """" . A_ScriptFullPath . """" . A_Space . params, str, A_WorkingDir, int, 1)
- ExitApp
- }
- }
- { ; Change Tray Icon
- I_Icon = GoldenKey64x.ico
- ICON [I_Icon] ;Changes a compiled script's icon (.exe)
- if I_Icon <>
- IfExist, %I_Icon%
- Menu, Tray, Icon, %I_Icon% ;Changes menu tray icon
- }
- ; =============================================================
- ; ------------------- Guis & Menus -------------------------
- ; =============================================================
- Gui, Main: +AlwaysOnTop
- Gui, Main: Add, ListView, w340 gEvent vVLV R8 hwndHLV AltSubmit, Servidor|Char|ID|Password|Info
- Gui, Login: +AlwaysOnTop -SysMenu +Owner
- Gui, Login: Add, Edit, vMasterPassword gValidatePassword Password*
- Gui, NewAccount: +AlwaysOnTop -SysMenu +Owner
- Gui, NewAccount: Add, Text, x12 y9 w90 h20 +Right, Servidor:
- Gui, NewAccount: Add, Text, x12 y39 w90 h20 +Right, Char:
- Gui, NewAccount: Add, Text, x12 y69 w90 h20 +Right, ID:
- Gui, NewAccount: Add, Text, x12 y99 w90 h20 +Right, Password:
- Gui, NewAccount: Add, Text, x12 y129 w90 h20 +Right, Extra Info:
- Gui, NewAccount: Add, Edit, x112 y9 w100 h20 vServidor
- Gui, NewAccount: Add, Edit, x112 y39 w100 h20 vChar
- Gui, NewAccount: Add, Edit, x112 y69 w100 h20 vID
- Gui, NewAccount: Add, Edit, x112 y99 w100 h20 vPassword
- Gui, NewAccount: Add, Edit, x112 y129 w100 h20 vExtraInfo
- Gui, NewAccount: Add, Button, gAddAccountToFile x62 y159 w100 h30, Send
- Menu, Options, Add, Add Account, AddAccountWindow
- ; =============================================================
- ; ----------------------- Main ----------------------------
- ; =============================================================
- LoadAccountsToWindow()
- LV_ModifyCol()
- ; =============================================================
- ; --------------------- Hotkeys ---------------------------
- ; =============================================================
- <^>!m::
- Gui, Login: Show, Center, Master
- return
- ; =============================================================
- ; -------------------- Functions --------------------------
- ; =============================================================
- LoadAccountsToWindow() {
- Gui, Main: Default
- LV_Delete()
- FileRead, Hold, file.txt
- AccountsData := StrSplit(Hold, "`n")
- Loop, % AccountsData.MaxIndex() {
- AccountData := AccountsData[A_Index]
- servidor := QuickRegEx(AccountData, "Servidor: (\w+)")
- char := QuickRegEx(AccountData, "Char: (\w+)")
- id := QuickRegEx(AccountData, "ID: (\w+)")
- password := QuickRegEx(AccountData, "Password: (\w+)")
- extra_info := QuickRegEx(AccountData, "ExtraInfo: (.*)")
- LV_Add("", servidor, char, id, password, extra_info)
- LV_ModifyCol()
- }
- }
- SetUpColors() {
- Gui, Main: Default
- CLV := New LV_Colors(HLV, True)
- Loop, % LV_GetCount()
- {
- LV_GetText(ServerName, A_Index, 1)
- if ServerName = Mkmt2
- {
- ; MsgBox, 1 TESTING
- CLV.Row(A_Index, 0xFF6B6B)
- }
- }
- }
- QuickRegEx(String, Patern, ReturnValue := 1) {
- RegExMatch(String, Patern, RE_Match)
- if (RE_Match%ReturnValue% != ""){
- ReturnValue := RE_Match%ReturnValue%
- return ReturnValue
- } else {
- return "null"
- }
- }
- ; =============================================================
- ; ------------------- SubRoutines -------------------------
- ; =============================================================
- Event:
- if (A_GuiEvent = "RightClick") {
- Menu, Options, Show
- }
- if (A_GuiEvent = "DoubleClick") {
- LV_GetText(id, A_EventInfo, 3)
- LV_GetText(pw, A_EventInfo, 4)
- Sleep, 2500
- Send, %id%
- Sleep, 50
- Send, {Tab}
- Sleep, 50
- Send, %pw%
- Sleep, 50
- Send, {Enter}
- }
- return
- ValidatePassword:
- Gui, Login: Submit, NoHide
- if (MasterPassword = "12345") {
- GuiControl, , MasterPassword
- Gui, Cancel
- Gui, Main: Show, Center, Contas
- SetUpColors()
- }
- return
- AddAccountToFile:
- Gui, NewAccount: Submit
- FileAppend, % "`nServidor: " Servidor "`t Char: " Char "`t ID: " ID "`t Password: " Password "`t ExtraInfo: " ExtraInfo , file.txt
- Sleep, 200
- LoadAccountsToWindow()
- LV_ModifyCol()
- return
- AddAccountWindow:
- Gui, NewAccount: Show, Center , Adicionar Conta
- return
- ~Escape::
- GuiControl,, Texto,
- Gui, Cancel
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement