Jump to content

Importing a Username/Password


Recommended Posts

Hello, I'm still a complete beginner with AutoIt, so I'm not sure if this could be done using a simple command or not.

Lets say I have a very simple script, to log into a website. (I'm still unfamiliar with the Mouse commands, so I use a simple Tab/Enter combo.)

Here is my script:

$Username = ""
$Password = ""

ShellExecute("http://www.myspace.com")
Sleep(5000)
Send("{TAB}")
Send($Username) ; Username goes here
Send("{TAB}")
Send($Password) ; Password goes here
Send("{ENTER}")
Exit
; End Script

Now, my question is, if compiled and sent to someone, they probably wouldn't know how to edit/decompile it,

So how would you let them edit the settings?

Lets say from a file in the folder along with the compiled script named settings.txt:

Username=""
Password=""

How could you, in the script, make it import those specified settings?

This might be more work than it's worth, but it's something I've been questioning.

Link to comment
Share on other sites

With Iniread. or maybe input boxes?

Inputbox

$Input2 = GUICtrlCreateInput("User Name", 72, 145, 185, 21)
$Input1 = GUICtrlCreateInput("Password", 72, 120, 185, 21, $ES_PASSWORD)

$Username = GUICtrlRead($Input1)
$Password = GUICtrlRead($Input2)

ShellExecute("http://www.myspace.com")
Sleep(5000)
Send("{TAB}")
Send($Username) ; Username goes here
Send("{TAB}")
Send($Password) ; Password goes here
Send("{ENTER}")
Exit

IniRead

If Not FileExists(@ScriptDir & "/SettingsIni.ini") Then
IniWrite(@ScriptDir & "/SettingsIni.ini", "UserName/Password", "Username","")
IniWrite(@ScriptDir & "/SettingsIni.ini", "UserName/Password", "Password","")
EndIf

$Username = IniRead(@ScriptDir & "/SettingsIni.ini", "UserName/Password", "Username","")
$Password = IniRead(@ScriptDir & "/SettingsIni.ini", "UserName/Password", "Password","")

ShellExecute("http://www.myspace.com")      

Sleep(5000)
Send("{TAB}")
Send($Username) ; Username goes here
Send("{TAB}")
Send($Password) ; Password goes here
Send("{ENTER}")
Exit
Edited by hot202
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...