none
auto fill router login screen RRS feed

  • Question

  • hi all,

    I want to auto fill user name and pass

    the webpage is open but the vbs throw error in line 6 char 1

    I try use the following VbsScript but with no luck..

    Set IE = CreateObject("InternetExplorer.Application")
    set WshShell = WScript.CreateObject("WScript.Shell") 
    IE.Navigate "192.168.2.99"
    IE.Visible = True
    Wscript.Sleep 6000
    IE.Document.All.Item("User name").Value = "Admin"
    IE.Document.All.Item("fld_password").Value = "Admin"
    WshShell.AppActivate "IE"
    WshShell.SendKeys "{ENTER}"

    plz assist

    assaf

     

     

    Saturday, September 7, 2013 2:02 PM

Answers

  • A sleep won't work, you need to pump the message for the navigation to begin.

    I suggest you to create a windows forms application in VB.net to do this in a webbrowser control and run it in your command line. You need to put your autofilling code in the DocumentComplete event handler.



    Visual C++ MVP

    Tuesday, September 10, 2013 11:49 PM

All replies

  • A sleep won't work, you need to pump the message for the navigation to begin.

    I suggest you to create a windows forms application in VB.net to do this in a webbrowser control and run it in your command line. You need to put your autofilling code in the DocumentComplete event handler.



    Visual C++ MVP

    Tuesday, September 10, 2013 11:49 PM
  • The following works for me:

     Const READYSTATE_COMPLETE = 4

     Set objIE = WScript.CreateObject("InternetExplorer.Application", "IE_")

    'NOTE the "IE_" as a second parameter.
    'I use it to create two subs at the bottom to monitor Navigate and Document Completed events ...

     '.... Code - Navigate to the page
     '...
     '...
     
     '
     Do While (objIE.Busy)
      objIE.StatusText = "Loading Web Page ..."
      WshShell.AppActivate objIE.Document.Title
      WScript.Sleep 5000
     Loop

     Do While (objIE.ReadyState <> READYSTATE_COMPLETE)
      objIE.StatusText = "Document ..." & CStr(objIE.ReadyState)
      WScript.Sleep 5000
     Loop

     '.... Code - Get the element, assign uid, pwd values
     '...
     '...

     Sub IE_NavigateComplete2(ByVal pDisp, URL)
          WScript.Echo "Navigated to", URL
     End Sub
     
     Sub IE_DocumentComplete(ByVal pDisp, URL)
           WScript.Echo "IE_DocumentComplete ...", URL
             If (pDisp Is objIE) Then
                WScript.Echo  "Web document is finished downloading"
             Else
                WScript.Echo  "Document is NOT finished downloading..."        
             End If
     End Sub 

    Sergio

    Saturday, December 14, 2013 6:08 PM