Results 1 to 14 of 14
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    is possible to fill dialog box on web page (6.0 20

    After i click on "Area Clienti" appear the tipical autenticatin box (see image)
    How to insert in user box the value of my_var = user, and in password box the value of my_password=mypassword
    and after click on "ok" button?????

    naturally in VB or VBA code

    here the link : http://www.cerved.com/


    my fist code buty naturally not work:
    Set oIE = CreateObject("InternetExplorer.Application")
    Set oWSH = CreateObject("WScript.Shell")

    sUsername = "utente"
    sPassword = "password"

    oIE.Visible = True

    oIE.Navigate "https://www.cerved.com/xportal/web/ita/protected" _
    & "/abbonati/menu_abbonati.jsp"

    Do While Not oWSH.AppActivate("Connetti a www.cerved.com")

    Loop

    oWSH.SendKeys sUsername & "{TAB}" & sPassword & "{ENTER}"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: is possible to fill dialog box on web page (6.0 20

    You'll probably have more success if you continue the discussion in interact with user dialobbox user e passord.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: is possible to fill dialog box on web page (6.

    AS Hans states, you seem to be having a reasonably good discussion on Google Groups. The code the two users have provided you is OK but you may want to get the script to pause for a few seconds in case of a slow response from the server.

    Try this:

    Set oIE = CreateObject("InternetExplorer.Application")
    Set oWSH = CreateObject("WScript.Shell")

    sUsername = "Sal21"
    sPassword = "Password"

    oIE.Visible = True
    oIE.Navigate "https://www.cerved.com/xportal/web/ita/protected/abbonati/menu_abbonati.jsp"


    WScript.Sleep 5000

    oWSH.SendKeys sUsername & "{TAB}" & sPassword & "{ENTER}"

    I have tested it against the Lounge log in and it works fine. Just to remember to paste this into a text file and save it as sal21.vbs then click on it. Ensure you run the code when the vbs file is closed as you may find that the SendKeys gets sent to the text file and not the explorer window.
    Jerry

  4. #4
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: is possible to fill dialog box on web page (6.

    works for me too, (against the lounge login). Cheers Jerry.

    Never used this before, but can think of a few useful places!!

  5. #5
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: is possible to fill dialog box on web page (6.

    I am trying to modify this for use with another application.

    Open AOL (application) and insert log-in details. (I know that I can do this within AOL itself, I am just trying to understand the concept)

    Set oAOL = CreateObject("C:Program FilesAOL 9.0 VRaol.exe")
    Set oWSH = CreateObject("WScript.Shell")

    sUsername = "xyz"
    sPassword = "123"

    oAOL.Visible = True


    WScript.Sleep 5000

    oWSH.SendKeys sUsername & "{TAB}" & sPassword & "{ENTER}"

    Where am I going wrong <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>
    Or maybe I am on the wrong track altogether? Would this be more appropriate in a batch file <img src=/S/question.gif border=0 alt=question width=15 height=15>

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: is possible to fill dialog box on web page (6.

    CreateObject only works with applications that support automation. I'm not sure that AOL.exe does.

    You could replace the line

    Set oAOL = CreateObject("C:Program FilesAOL 9.0 VRaol.exe")

    with

    Shell "C:Program FilesAOL 9.0 VRaol.exe", 3

    and remove the line

    oAOL.Visible = True

    Also, the SendKeys line assumes that when the application starts, the insertion point is in the username box, that pressing Tab activates the password box and that pressing Enter is equivalent to clicking the login button.

    Finally, how are you testing this code, i.e. where are you writing and testing it?

  7. #7
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: is possible to fill dialog box on web page (6.

    When the application starts, the insertion point is the password box, so I would need to 'backward tab' ????? once, insert username, tab, insert password and enter.

    I was trying this in .vbs but maybe .bat is more appropriate?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: is possible to fill dialog box on web page (6.

    A .vbs is OK. To add the "backwards tab", try

    oWSH.SendKeys "+{TAB}" & sUsername & "{TAB}" & sPassword & "{ENTER}"

    To get more info about SendKeys:
    - Activate the Visual Basic Editor in any Office application.
    - Activate the Immediate window (Ctrl+G).
    - Type sendkeys
    - Press F1.

  9. #9
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: is possible to fill dialog box on web page (6.

    Thankyou Hans. I will do some research on both .vbs and sendkeys as suggested. I can then 'play around' with this further.

    I'm concious of hijacking Sal's thread here, so if I have any further questions,I will create a new one. Thanks again..

  10. #10
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: is possible to fill dialog box on web page (6.

    Hi Jerry the code work fine!!!!
    Now i have create the text file sal21.vbs and saved on Desktop.
    I click on the icon and the code fill the dialogbox and appera the next page authenticate.
    But is possible to insert the vbs code in a VBA macro or i can call the vbs script only from icon?
    For example i can call the vbs script via Shell in VBA? or other way existis?

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: is possible to fill dialog box on web page (6.

    You can include a slightly modified version of Jerry's code directly in your VBA code, for example in Excel:

    Set oIE = CreateObject("InternetExplorer.Application")

    sUsername = "Sal21"
    sPassword = "Password"

    oIE.Visible = True
    oIE.Navigate "https://www.cerved.com/xportal/web/ita/protected/abbonati/menu_abbonati.jsp"

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

    SendKeys sUsername & "{TAB}" & sPassword & "{ENTER}"

  12. #12
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: is possible to fill dialog box on web page (6.

    hI Hans.... Good morning
    Maked this code but i dont see the box in dialogbox are filled with value of 2 var

    Sub FILL_DIALOG()

    Set oIE = CreateObject("InternetExplorer.Application")

    sUsername = "Sal21"
    sPassword = "Password"

    oIE.Visible = True
    oIE.Navigate "https://www.cerved.com/xportal/web/ita/protected/abbonati/menu_abbonati.jsp"

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

    SendKeys sUsername & "{TAB}" & sPassword & "{ENTER}"

    End Sub

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: is possible to fill dialog box on web page (6.

    It works for me, but you have to wait a few seconds before the username and password are filled in.

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: is possible to fill dialog box on web page (6.

    You have to run the code from Excel, for example by selecting Tools | Macro | Macros..., and not from the Visual Basic Editor. If you run the code from within the Visual Basic Editor, the text (or part of it) may be inserted there instead of in the dialog box.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •