I have a display monitor in a school that rotates through some web pages that displays current building usage. The Monitor has a small form computer mounted to the back of it to get internet access. There cannot be a keyboard or mouse attached because we need to keep people from messing with it. I want the computer to bootup, open IE, go to an IP address and enter the Username and Password, Send the U/P - Which will open and display the rotating script (Pages) -. I was thinking I could use AutoHotKey to start IE and log into with the Username/Password, and use a Startup Bat file to start the Autokey Script on Startup. I tried different examples from the site on auto logins and I can get it to start IE and go the Webpage page but I can get it to fill the User Name and Password fields in. If someone could show me how to achieve this I would be very grateful. And if you have a better suggestion than the way I am going about this please let me know.
Thanks for any help,
M.
Here is the part of the script that has the login fields from the page I am trying to log into.
</td>
</tr>
<tr>
<td align="left" style="width: 40%">
<span id="ctl00_OWSMasterPlaceholder_lblUserID" class="ContentHeading" key="LoginPage.lblUserID">User ID*</span>
</td>
<td>
<input name="ctl00$OWSMasterPlaceholder$txtUserName" type="text" maxlength="32" id="ctl00_OWSMasterPlaceholder_txtUserName" tabindex="1" class="InputFieldStyle" />
<span id="ctl00_OWSMasterPlaceholder_lblErrorUserName" class="ErrorMark"></span>
</td>
</tr>
<tr>
<td align="left" style="width: 40%">
<span id="ctl00_OWSMasterPlaceholder_lblPassword" class="ContentHeading" key="LoginPage.lblPassword">Password*</span>
</td>
<td>
<input name="ctl00$OWSMasterPlaceholder$txtPassword" type="password" maxlength="32" id="ctl00_OWSMasterPlaceholder_txtPassword" tabindex="2" class="InputFieldStyle" />
<span id="ctl00_OWSMasterPlaceholder_lblErrorPassword" class="ErrorMark"></span>
</td>
</tr>
<tr>
<td class="ContentToButtonsBreak" colspan="2">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="ctl00$OWSMasterPlaceholder$btnOk" value="Log in" onclick="return fnValidateForm();" id="ctl00_OWSMasterPlaceholder_btnOk" tabindex="5" class="AdjacentButtons" key="LoginPage.btnSubmit" />
</td>
Script help (Auto login)
Re: Script help (Auto login)
Hi M,
You should have included the form but you can also use the button. Try this code for the login (untested).
Fill the variables at the beginning.
You should have included the form but you can also use the button. Try this code for the login (untested).
Fill the variables at the beginning.
Code: Select all
SiteAddress := "IPAddressHere"
Username := "UserNameHere"
Password := "PasswordHere"
ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := true
ie.Navigate(SiteAddress)
IELoad(ie)
ie.document.getElementsByName("ctl00$OWSMasterPlaceholder$txtUserName")[0].Value := Username
ie.document.getElementsByName("ctl00$OWSMasterPlaceholder$txtPassword")[0].Value := Password
ie.document.getElementsByName("ctl00$OWSMasterPlaceholder$btnOk")[0].Click()
return
IELoad(Pwb)
{
If !Pwb
Return False
While !(Pwb.busy)
Sleep, 100
While (Pwb.busy)
Sleep, 100
While !(Pwb.document.Readystate = "Complete")
Sleep, 100
Return True
}
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)