What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » VB auto click

VB auto click
Author: Message:
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. VB auto click
Hi I'm making a program that will automaticly navigate a website. It's for a friend of mine. I just can't figure out how to click on things in the IE web browser control in VB. Any one have any ideas?
[Image: top.gif]
05-06-2005 11:37 PM
Profile PM Web Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
RE: VB auto click
code:
Web1.Document.All("username").Value = txtEmail.text
Web1.Document.All("password").Value = txtPass.text
Web1.Document.All("null").Click

I don't know if that helps but thats how I login into my Google Adsense account through VB.

I'm not sure if it works for links.
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
05-06-2005 11:43 PM
Profile E-Mail PM Web Find Quote Report
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. RE: VB auto click
That code does not work for me. I get a "Object varible or With block not set" error.
[Image: top.gif]
05-06-2005 11:55 PM
Profile PM Web Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
RE: VB auto click
did you make sure the page was fully loaded before you used it?  And did you modify the code or do it on a page that has text fields called 'username' and 'password' ?
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
05-07-2005 12:00 AM
Profile E-Mail PM Web Find Quote Report
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. RE: VB auto click
this code works better:

code:
Private Sub Command1_Click()
Do Until wb.ReadyState = READYSTATE_COMPLETE


    DoEvents
    Loop
    On Error Resume Next
    wb.Document.Forms(0).email.Value = "username"
    wb.Document.Forms(0).passwd.Value = "password"
    wb.Document.Forms(0).submit
End Sub

Private Sub Form_Load()
wb.Navigate "https://www.google.com/accounts/ServiceLogin?
service=mail&passive=true&continue=http%3A%2F%2Fgmail.google.com
%2Fgmail%3Fui%3Dhtml%26zy%3Dl"
End Sub

Does any one know how to click on links?

This post was edited on 05-07-2005 at 03:24 AM by WDZ.
[Image: top.gif]
05-07-2005 12:19 AM
Profile PM Web Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
RE: VB auto click
code:
Sub ReplaceElementAttributes()
    Dim objDoc As FPHTMLDocument
    Dim objElement As IHTMLElement
    Dim strTempText As String

    Const CHARACTER_LENGTH As Integer = 7
    Const STRING_FOUND As Integer = 1
    Const TAG_NAME As String = "a"
    Const ATTRIBUTE_NAME As String = "href"
    Const TARGET_STRING As String = "http://"

    Set objDoc = ActiveDocument

    ' Remove "http://" from the href attribute of all
    ' A elements in the document.
    For Each objElement In objDoc.all.tags(tagName:=TAG_NAME)
        strTempText = objElement.getAttribute _
            (strAttributeName:=ATTRIBUTE_NAME)
        ' Remove "http://" only if it appears at the beginning
        ' of the href attribute's value.
        If InStr(strTempText, TARGET_STRING) = STRING_FOUND Then
            strTempText = Right(strTempText, _
                Len(strTempText) - CHARACTER_LENGTH)
        End If
    Next objElement
End Sub
I found that on msdn here

you could use that and the link url is in 'strTempText' then u could do like
code:
wb.navigate strTempText
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
05-07-2005 12:27 AM
Profile E-Mail PM Web Find Quote Report
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. RE: VB auto click
Interesting, do you know where I could find all the opetions for the web browser control. Like I never knew there was a .Document thing that you can use to control the web page. I want to know more about that.
[Image: top.gif]
05-07-2005 01:38 AM
Profile PM Web Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
RE: VB auto click
Reference for Visual Basic Developers (Internet Explorer - WebBrowser)
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
05-07-2005 08:46 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On