Text Box populate with Text File

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
RDaga
Posts: 1
Joined: 19 Feb 2018, 15:45
Contact:

Text Box populate with Text File

19 Feb 2018, 16:39

#SingleInstance force

F9::
Gui, Destroy

Gui, Show, w474 h236, OneKey
Gui, Font, S12 CDefault, Verdana
Gui, Add, GroupBox, x12 y64 w441 h161 , Help

Gui, Add, Text, x12 y7 w105 h28 , User Name
Gui, Add, Text, x12 y36 w105 h28 , Password

Gui, Add, Edit, x108 y7 w240 h28 vUser_Name,
Gui, Add, Edit, x108 y36 w240 h28 Password vPassword,

Gui, Add, Button, x357 y7 w105 h57 gSave vSave, Save

Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x21 y84 w192 h19 , Win+n = Launch Notepad
Gui, Add, Text, x21 y103 w249 h19 , Win+v = Run mstsc.exe /console
Gui, Add, Text, x21 y122 w355 h19 , Win+w = Username + Password into a RDP session
Gui, Add, Text, x21 y141 w374 h19 , Win+q = Username + Password without domain name
Gui, Add, Text, x21 y160 w355 h19 , Win+t = Username + Password with domain name
Gui, Add, Text, x21 y180 w422 h19 , Win+a = Username + Password into CERNERASP dialog (IE)
Gui, Add, Text, x21 y199 w431 h19 , Win+s = Send's the contents of clipboard (For RDP sessions)

; Moves the window to the center of the screen
WinExist("A")
WinGetPos,,, sizeX, sizeY
WinMove, (A_ScreenWidth/2)-(sizeX/2), (A_ScreenHeight/2)-(sizeY/2)
return

Save:
gui, submit, NoHide
if (User_Name=="" && Password=="")
{
Msgbox, Please Update Your Credentials!
return
}
if (User_Name=="")
{
Msgbox, Please Update Your User Name!
return
}
if (Password=="")
{
Msgbox, Please Update Your Password!
return
}
FileDelete, C:\Users\%Username%\Documents\OneKey.txt
FileAppend User Name: %User_Name%`nPassword: %Password%, C:\Users\%Username%\Documents\OneKey.txt

MsgBox, Password Saved Successfully!

Gui, Destroy
return
;_____________________________________________________________________________________________________

#v::Run mstsc.exe /console
#n::Run Notepad
#w::Send %UserName%{tab}%Password%{tab}cernerasp{Enter} ; This Procedure will send the username and password into a RDP session
#q::Send %UserName%{tab}%Password% ; This Procedure will send the username and password without the domain name
#t::Send whq_nt_domain\%UserName%{tab}%Password%{Enter} ; This Procedure will send the username and password with the domain name
#a::Send cernerasp\%UserName%{tab}%Password%{Enter} ; This Procedure will send the username and password into a cernerasp dialog for windows explorer or internet explorer password security dialog boxes
#s::Send %Clipboard% ; This Procedure is used for sending the contents of the clipboard (For RDP sessions)

sleep 500
GuiClose:
Gui, Destroy
TQu

Re: Text Box populate with Text File

19 Feb 2018, 21:04

An ini read/write could work

Code: Select all

#SingleInstance force

F9::
Gui, Destroy

IniRead,User_Name,%A_ScriptFullPath%,OneKey,User_Name
IniRead,Password,%A_ScriptFullPath%,OneKey,Password

Gui, Show, w474 h236, OneKey
Gui, Font, S12 CDefault, Verdana
Gui, Add, GroupBox, x12 y64 w441 h161 , Help

Gui, Add, Text, x12 y7 w105 h28 , User Name
Gui, Add, Text, x12 y36 w105 h28 , Password

Gui, Add, Edit, x108 y7 w240 h28 vUser_Name, % User_Name
Gui, Add, Edit, x108 y36 w240 h28 Password vPassword, % Password
Gui, Add, Button, x357 y7 w105 h57 gSave vSave, Save

Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x21 y84 w192 h19 , Win+n = Launch Notepad
Gui, Add, Text, x21 y103 w249 h19 , Win+v = Run mstsc.exe /console
Gui, Add, Text, x21 y122 w355 h19 , Win+w = Username + Password into a RDP session
Gui, Add, Text, x21 y141 w374 h19 , Win+q = Username + Password without domain name
Gui, Add, Text, x21 y160 w355 h19 , Win+t = Username + Password with domain name
Gui, Add, Text, x21 y180 w422 h19 , Win+a = Username + Password into CERNERASP dialog (IE)
Gui, Add, Text, x21 y199 w431 h19 , Win+s = Send's the contents of clipboard (For RDP sessions)

; Moves the window to the center of the screen
WinExist("A")
WinGetPos,,, sizeX, sizeY
WinMove, (A_ScreenWidth/2)-(sizeX/2), (A_ScreenHeight/2)-(sizeY/2)
return

Save:
gui, submit, NoHide
if (User_Name=="" && Password==""){
	Msgbox, Please Update Your Credentials!
	return
}
if (User_Name==""){
	Msgbox, Please Update Your User Name!
	return
}
if (Password==""){
	Msgbox, Please Update Your Password!
	return
}

IniWrite,%User_Name%,%A_ScriptFullPath%,OneKey,User_Name
IniWrite,%Password%,%A_ScriptFullPath%,OneKey,Password

; FileDelete, C:\Users\%Username%\Documents\OneKey.txt
; FileAppend User Name: %User_Name%`nPassword: %Password%, C:\Users\%Username%\Documents\OneKey.txt

MsgBox, Save Successful

Gui, Destroy
return
; _______________________________________________________________

#v::Run mstsc.exe /console
#n::Run Notepad
#w::Send %UserName%{tab}%Password%{tab}cernerasp{Enter} ; This Procedure will send the username and password into a RDP session
#q::Send %UserName%{tab}%Password% ; This Procedure will send the username and password without the domain name
#t::Send whq_nt_domain\%UserName%{tab}%Password%{Enter} ; This Procedure will send the username and password with the domain name
#a::Send cernerasp\%UserName%{tab}%Password%{Enter} ; This Procedure will send the username and password into a cernerasp dialog for windows explorer or internet explorer password security dialog boxes
#s::Send %Clipboard% ; This Procedure is used for sending the contents of the clipboard (For RDP sessions)
Esc::ExitApp

GuiClose:
	Gui, Destroy
	IniWrite,%User_Name%,%A_ScriptFullPath%,OneKey,User_Name
	IniWrite,%Password%,%A_ScriptFullPath%,OneKey,Password
return
/*
[OneKey]
User_Name=Rajit
Password=RajitWasHere

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, prototype_zero, w_i_k_i_d and 325 guests