Solved SendKeys for Windows Security Login Window Problem

September 9, 2013 at 14:45:22
Specs: Macintosh
I have outdated and no-longer-supported Axis brand security cameras that I have to access via the their IP addresses on my local LAN. When I point Internet Explorer to their IP addresses a "Windows Security" small window pops up requesting username and password, which I then enter and then I can get into the security camera. I am trying to automate this with a 1-button click using my extremely limited programming skills. I got it to work -- kind of -- using the following code, but the problem is that if the camera has been logged into recently then it doesn't ask for username and password and consequently the SendKeys function has Internet Explorer search the web for the pre-programmed password because it puts the password on the address bar/search of the browser rather than sending the password text to the Window Security window which isn't there. Is there a way to fix this or do this better than my stupid way? I will paste the code below, but is there a better language that I should be using than Visual Basic for which I could download the programming environment? I have a feeling someone out there could write this entire code over and in a better way in 10 seconds than what I came with below that took me several hours (embarrassed!):

Sub Button1_Click()
'
' Button1_Click Macro

Set oIE = CreateObject("InternetExplorer.Application")

sUsername = "user123"
sPassword = "password123"

Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True

oIE.navigate "10.114.143.55"

Application.Wait Now + TimeSerial(0, 0, 3)

SendKeys sUsername & "{TAB}"

Application.Wait Now + TimeSerial(0, 0, 1)

SendKeys sPassword & "{ENTER}"

End Sub


See More: SendKeys for Windows Security Login Window Problem

Report •


#1
September 9, 2013 at 18:08:29
✔ Best Answer
Here's what I've done in the past, but like yourself, I figure there's a better solution waiting in the wings:

z=appactivate ("Window Security")
if z then
Application.Wait Now + TimeSerial(0, 0, 3)
SendKeys sUsername & "{TAB}"
Application.Wait Now + TimeSerial(0, 0, 1)
SendKeys sPassword & "{ENTER}"
end if...

'====== end snip

just make sure your window title is correct ("Window Security").


Report •
Related Solutions


Ask Question