Sign in to follow this  
Followers 0
Penisaurus

Importing a Username/Password

6 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Ah, thank you!

The IniRead works great for me. :]

Still confused on the Input part, but the Ini works well.

Share this post


Link to post
Share on other sites

with the inputboxes you need to make a gui its in the help file look for GuiCreate

Share this post


Link to post
Share on other sites

You can even look up Ie.au3 you wont have to send tab to go to the password and username.

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