Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard Shortcut - Auto Login to a WordPress Dashboard
#1
Lightbulb 
If you maintain a WordPress site, chances are that you frequently have to go through the tedious process of accessing the Dashboard, which includes launching a web browser, opening the WordPress login page, inputting your username and password, and then clicking the Log In button. The following AutoHotkey script can be used with ShortKeeper to create a keyboard shortcut to automate the whole process.

Need help creating a keyboard shortcut with ShortKeeper using the following AutoHotkey code? This 5-minute tutorial will help!
Username := "YourUserName"
Password := "YourPassord"
URL := "http://yourdomain.com/wp-login.php"
wb := ComObjCreate("InternetExplorer.Application")
wb.Visible := True
wb.Navigate(URL)
TimeOut := 10
While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy
{
 Sleep, 1000
 TimeOut := TimeOut - 1
 if (TimeOut = 0)
   return
}
Sleep 500
wb.document.getElementById("user_login").value := Username
wb.document.getElementById("user_pass").value := Password
wb.document.getElementById("wp-submit").Click()
At lines #1 and #2, "YourUsername" and "YourPassword" must be replaced with the actual user name and password (do not remove quotation marks).

At line #3, "http://yourdomain.com/wp-login.php" must be replaced with the actual URL of the WordPress login page (do not remove quotation marks).

At line #7, a timeout delay of 10 seconds is set in case the script becomes unresponsive (e.g. due to a slow Internet connection) in attempting to load the WordPress login page. If the timeout expires, the script will simply terminate without inserting the username and password. The timeout delay can be changed if needed.

At line #15, a 500 milliseconds pause is inserted after the WordPress login page is loaded and before inserting the username and password. You might have to lengthen the pause for a slow computer.

Use a password stored in an external encrypted file

Someone with access to your ShortKeeper application might be able to see your WordPress password, which some users may find insecure. This section explains how to use a password stored in a separate file that is protected with a master password.

To begin, replace line #2 of the script above with the following two lines:
PasswordName := "wordpress1"
ExternalFileName := "T:\MyData.ini"
At line #2, "T:\MyData.ini" must refer to the path and filename of the external password file (do not remove quotation marks).

Now, to get the password from the external file, the following line of code must be inserted between line #16 and line #17 of the script above:
IniRead, Password, % ExternalFileName, % "Passwords", % PasswordName

The following line inserted between lines #17 and #18 will make sure the password in the computer memory is cleared as soon as possible:
Password :=

Then you will have to create an external file (a simple text file will do) with an ".ini" extension with content like this:

[Passwords]
wordpress1=hkdf77*&77767s8erw82w38
wordpress2=76349286&876&*987&*fGG

You can add all of your other passwords to the same file.

If the external file cannot be read (e.g. if it is encrypted), the inserted password will be "ERROR" instead of the actual password.

There are several ways to encrypt/decrypt the external file. If you are using TrueCrypt, you could insert the following code between lines #3 and #4 above. This will prompt you to enter the master password if the file is not already decrypted:
if (!FileExist(ExternalFileName))
{
 TrueCryptPath := "C:\Program Files (x86)\TrueCrypt\TrueCrypt.exe"
 ContainerPath := "U:\TrueCryptContainer.tc"
 RunWait % TrueCryptPath . " /q /lt /v " . ContainerPath
}
At line #3, "C:\Program Files (x86)\TrueCrypt\TrueCrypt.exe" must refer to the path of TrueCrypt.exe (do not remove quotation marks).

At line #4, "U:\TrueCryptContainer.tc" must refer to the path of the TrueCrypt file container (do not remove quotation marks).
Enterpad: For those who need more than a few shortcuts.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)