Prev: on keypress
Next: Connect to WMI remotely with vbscript
From: acidrainlte on 10 Feb 2010 05:17 Hi, I have the following script that takes a password from IE (just to make use of the password masking). Set objExplorer = WScript.CreateObject _ ("InternetExplorer.Application", "IE_") objExplorer.Navigate "file:///C:\Documents and Settings\username\Desktop\password.htm" objExplorer.ToolBar = 0 objExplorer.StatusBar = 0 objExplorer.Width = 400 objExplorer.Height = 180 objExplorer.Left = 300 objExplorer.Top = 200 objExplorer.Visible = 1 Do While (objExplorer.Document.Body.All.OKClicked.Value = "") Wscript.Sleep 250 Loop strUsername = objExplorer.Document.Body.All.UserName.Value strPassword = objExplorer.Document.Body.All.UserPassword.Value strButton = objExplorer.Document.Body.All.OKClicked.Value objExplorer.Quit Wscript.Sleep 250 If strButton = "Cancelled" Then Wscript.Quit End If The external file "password.htm" has this code in it: <SCRIPT LANGUAGE="VBScript"> Sub RunScript OKClicked.Value = "OK" End Sub Sub CancelScript OKClicked.Value = "Cancelled" End Sub </SCRIPT> <BODY> <font size="2" face="Arial"> Username: </font><font face="Arial"> <input type="username" name="UserName" size="40"></font></p> <font size="2" face="Arial"> Password: </font><font face="Arial"> <input type="password" name="UserPassword" size="40"></font></p> <input type="hidden" name="OKClicked" size = "20"> <input id=runbutton class="button" type="button" value=" OK " name="ok_button" onClick="RunScript"> <input id=runbutton class="button" type="button" value="Cancel" name="cancel_button" onClick="CancelScript"> </BODY> Any idea why this has broken? It loads up the login page alright but then when I go to click "Ok" or "Cancel" it just doesn't do anything. Thanks in advance.
From: acidrainlte on 10 Feb 2010 06:10 Never mind. Turns out it was just a security setting in IE8 that stopped the code being run. "acidrainlte" wrote: > Hi, > > I have the following script that takes a password from IE (just to make use > of the password masking). > > Set objExplorer = WScript.CreateObject _ > ("InternetExplorer.Application", "IE_") > > objExplorer.Navigate "file:///C:\Documents and > Settings\username\Desktop\password.htm" > objExplorer.ToolBar = 0 > objExplorer.StatusBar = 0 > objExplorer.Width = 400 > objExplorer.Height = 180 > objExplorer.Left = 300 > objExplorer.Top = 200 > objExplorer.Visible = 1 > > Do While (objExplorer.Document.Body.All.OKClicked.Value = "") > Wscript.Sleep 250 > Loop > > strUsername = objExplorer.Document.Body.All.UserName.Value > strPassword = objExplorer.Document.Body.All.UserPassword.Value > strButton = objExplorer.Document.Body.All.OKClicked.Value > objExplorer.Quit > Wscript.Sleep 250 > > If strButton = "Cancelled" Then > Wscript.Quit > End If > > The external file "password.htm" has this code in it: > > <SCRIPT LANGUAGE="VBScript"> > > Sub RunScript > OKClicked.Value = "OK" > End Sub > > Sub CancelScript > OKClicked.Value = "Cancelled" > End Sub > > </SCRIPT> > > <BODY> > <font size="2" face="Arial"> > Username: </font><font face="Arial"> > <input type="username" name="UserName" size="40"></font></p> > > <font size="2" face="Arial"> > Password: </font><font face="Arial"> > <input type="password" name="UserPassword" size="40"></font></p> > > <input type="hidden" name="OKClicked" size = "20"> > > <input id=runbutton class="button" type="button" value=" OK " > name="ok_button" onClick="RunScript"> > > <input id=runbutton class="button" type="button" value="Cancel" > name="cancel_button" onClick="CancelScript"> > > </BODY> > > Any idea why this has broken? It loads up the login page alright but then > when I go to click "Ok" or "Cancel" it just doesn't do anything. > > Thanks in advance.
|
Pages: 1 Prev: on keypress Next: Connect to WMI remotely with vbscript |