|
-
Sep 14th, 2009, 12:16 PM
#1
Thread Starter
Addicted Member
Web browser ?
Hello.
It's me again.
This time I need help or I want answere on this question.
I have made a form with a button.
Now I want something to happend on a web browser when I press this button.
Like for example if I open mozilla and google and press the button the button writes in VBforums and press search.
Anyone that can help me=
//Worqy
Last edited by worqy; Sep 14th, 2009 at 12:28 PM.
-
Sep 25th, 2009, 10:54 AM
#2
Thread Starter
Addicted Member
Re: Web browser ?
Hello.
My computter broke down so I haven't been on this forum for over 1 week.
Today I saw that nobody have replyed to this post.
I don't know why but I'll make this more clear and hope that somebody will reply here soon.
I want to make my own E-mail "reader".
So I make a two text boxes. One for the username and one for the password.
And then a button.
Now when I press the button I want it to go to www.hotmail.com and that the textbox 1 is the email address and the textbox 2 is the password and that it presses "Sign in"
Anyone?
-
Sep 26th, 2009, 12:43 AM
#3
Addicted Member
Re: Web browser ?
Can do for IE but haven't delved into mozilla api's at all.
-
Sep 26th, 2009, 01:31 AM
#4
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by ZenDisaster
Can do for IE but haven't delved into mozilla api's at all.
How do you do it for IE then?
-
Sep 26th, 2009, 06:43 PM
#5
Frenzied Member
Re: Web browser ?
http://www.vbforums.com/showthread.php?t=583416
this guy was doing what you wanna do...
basically u need to get the field / form names...
then set them... then on the button... ".click" even makes it go to the login...
ie@: open ie webbrowser control should b good... - most likely hidden im guessing?....
then when its completed...
ie document complete...
if url = locationurl and url = "whatever you want it to be like" then
webbrowser1.document.all("name of what you wanna set").value = text1.text
"" """ """ .all("Password").value = text2.text
""""""".all("Login Button").click
end if
of course this needs doing properly [what its not in code tags]
but hope that helps?
-
Sep 27th, 2009, 12:47 AM
#6
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by wpearsall
http://www.vbforums.com/showthread.php?t=583416
this guy was doing what you wanna do...
basically u need to get the field / form names...
then set them... then on the button... ".click" even makes it go to the login...
ie@: open ie webbrowser control should b good... - most likely hidden im guessing?....
then when its completed...
ie document complete...
if url = locationurl and url = "whatever you want it to be like" then
webbrowser1.document.all("name of what you wanna set").value = text1.text
"" """ """ .all("Password").value = text2.text
""""""".all("Login Button").click
end if
of course this needs doing properly [what its not in code tags]
but hope that helps?
OK thank you. It helped a bit.
But Im still wondering a bit how to do it:
Have can I know what the button has fore name (inte the link you posted it was "con")
Like lets say. I make this code:
[HIGHLIGHT="Private Sub Command1_Click() Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE + text1.text" End Sub"[/HIGHLIGHT]
and then I want it to write in "Visual Basic" on the google search and press "Search".
-
Sep 27th, 2009, 02:54 AM
#7
Re: Web browser ?
i tried to login to hotmail for someone else, but i was unable to do so, as the usual form methods would no work on that site
Last edited by westconn1; Sep 27th, 2009 at 03:07 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 27th, 2009, 05:51 AM
#8
Frenzied Member
Re: Web browser ?
also it would be easier to add reference to the internet explorer
create one, and then control it directly...
if you shell an ie, you would need ALOT of api coding to control it... im assuming you want to control this IE for a while, yes?
-
Sep 27th, 2009, 06:27 AM
#9
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by wpearsall
also it would be easier to add reference to the internet explorer
create one, and then control it directly...
if you shell an ie, you would need ALOT of api coding to control it... im assuming you want to control this IE for a while, yes?
Yes.
I did just shell it to show you.
What would be the easy way?
-
Sep 27th, 2009, 04:20 PM
#10
Re: Web browser ?
try like this
vb Code:
Set wb = CreateObject("internetexplorer.application") wb.navigate2 "www.hotmail.com" Do Until wb.readystate = 4 DoEvents Loop wb.Visible = True 'optional if you want to see the window Set ele = wb.document.forms(0) ele.all("passwd").Value = "pass" ele.submit wb.Quit Set wb = Nothing
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 29th, 2009, 09:48 AM
#11
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by westconn1
try like this
vb Code:
Set wb = CreateObject("internetexplorer.application")
wb.navigate2 "www.hotmail.com"
Do Until wb.readystate = 4
DoEvents
Loop
wb.Visible = True 'optional if you want to see the window
Set ele = wb.document.forms(0)
ele.all("passwd").Value = "pass"
ele.submit
wb.Quit
Set wb = Nothing
There comes an error on the:
vb Code:
"Set WB = CreateObject("internetexplorer.application")"
"Wrong number of argument or invalide property assignment"
-
Sep 29th, 2009, 04:39 PM
#12
Re: Web browser ?
if wb is a webbrowser control this line is not required or valid
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 29th, 2009, 05:16 PM
#13
Frenzied Member
Re: Web browser ?
when u use createobject you dont need to set reference do u~? its only when dim ??? as ???, correct?
im not sure if i forgot to actually post my last post on here, but it doesnt seem to be here... but i would recommend using the WebBrowser control [in the components list its Microsoft Internet Controls - ieframe.dll]
it will give u more working easier
and also...
Dim WB as Object
before the set WB =
that may fix it
-
Sep 30th, 2009, 03:32 AM
#14
Re: Web browser ?
when u use createobject you dont need to set reference do u~? its only when dim ??? as ???, correct?
if you have a reference then you can declare your variable as the correct type, even if you use createobject
if you want to use latebinding, then do not use reference and declare variable as object
sometimes easier to add reference while writing code, then remove reference before compiling, to avoid compatibility issues for users
i was working with an instance of internet explorer, but the op may be using a webbrowser control, most of the code will work fine, but if WB is his webbrowser it will error when trying to assign an instance of internt explorer to the control
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 30th, 2009, 07:38 AM
#15
Thread Starter
Addicted Member
Re: Web browser ?
Now thats working.
BUT there comes and error on ele.All("login").Value = "[email protected]"
Run time error "91"
Object variable or With block variable not set
-
Sep 30th, 2009, 04:21 PM
#16
Re: Web browser ?
you could try replacing
Set ele = wb.document.forms(0)
ele.all("login").Value = " [email protected]"
ele.all("passwd").Value = "pass"
ele.submit
with
vb Code:
With wb.document.forms(0) .all("passwd").Value = "pass" .submit End With
if you still get error it would appear that the page has not loaded correctly
i tested the code here and it was working correctly
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 1st, 2009, 09:22 AM
#17
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by westconn1
you could try replacing
with
vb Code:
With wb.document.forms(0)
.all("passwd").Value = "pass"
.submit
End With
if you still get error it would appear that the page has not loaded correctly
i tested the code here and it was working correctly
There comes and error (424) but I think I know why. Because when I press the "Start" button to run the program and its open www.hotmail.com it comes to this site http://login.live.com/login.srf?wa=w...4855&mkt=fi-FI , then finish login site. (Because I live in Finland) so can this be the reason it comes the "error 424 Object required"?
-
Oct 1st, 2009, 05:03 PM
#18
Re: Web browser ?
when i go directly to the finnish login page it all works
wb.Navigate2 "http://mail.live.com/default.aspx&lc=1035&id=64855&mkt=fi-FI"
Code:
Olet yrittänyt kirjautua sisään liian monta kertaa käyttämällä virheellistä osoitetta tai salasanaa.
Kirjaudu sisään käyttämällä toista tiliä
Määritä uusi salasana
Kirjaudu sisään uudelleen käyttämällä kuvassa näkyviä merkkejä. Miksi?
Windows Live ID: [email protected]
Salasana:
Oletko unohtanut salasanasi?
Kuva:
6 merkkiä
Merkit:
i guess that says invalid username and password
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 2nd, 2009, 12:02 AM
#19
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by westconn1
when i go directly to the finnish login page it all works
wb.Navigate2 "http://mail.live.com/default.aspx&lc=1035&id=64855&mkt=fi-FI"
Code:
Olet yrittänyt kirjautua sisään liian monta kertaa käyttämällä virheellistä osoitetta tai salasanaa.
Kirjaudu sisään käyttämällä toista tiliä
Määritä uusi salasana
Kirjaudu sisään uudelleen käyttämällä kuvassa näkyviä merkkejä. Miksi?
Windows Live ID: [email protected]
Salasana:
Oletko unohtanut salasanasi?
Kuva:
6 merkkiä
Merkit:
i guess that says invalid username and password
Thats says: You have tryed to many times to login with a wrong Username/Password. Login with a diffrent account.....
But I was wondering why mine didnt work. Beacuse when I enter www.hotmail.com it jumps to the finnish login page and maby the ("login") and the ("passwd") isn't the same in finnish? Can we please take one more example? Lets say this site: www.gpro.se that site is allways in english. And I have a question more: How do I tell the program form example to press the login button on that page? Isi't like Press ("Login") ???
-
Oct 2nd, 2009, 03:17 AM
#20
Re: Web browser ?
How do I tell the program form example to press the login button on that page? Isi't like Press ("Login") ???
if it is input submit button, you can just submit the form, as my example
most times submit buttons do not have names or ids, so the only way is to loop through the elements to find some property to match then click the element
when you navigate 2 hotmail the site must redirect, after the browser readystate ha been reached, so the next page has not loaded when your code runs (guessing here)
vb Code:
Set wb = CreateObject("internetexplorer.application") wb.Navigate2 "www.gpro.se" wb.Visible = True Do Until wb.readystate = 4 DoEvents Loop Set ele = wb.document.forms("form1") ele.all("textpassword").Value = "pass" ele.submit
on this site the button does have a name and id, but it is not common for input buttons to have name
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 2nd, 2009, 03:49 AM
#21
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by westconn1
if it is input submit button, you can just submit the form, as my example
most times submit buttons do not have names or ids, so the only way is to loop through the elements to find some property to match then click the element
when you navigate 2 hotmail the site must redirect, after the browser readystate ha been reached, so the next page has not loaded when your code runs (guessing here)
vb Code:
Set wb = CreateObject("internetexplorer.application")
wb.Navigate2 "www.gpro.se"
wb.Visible = True
Do Until wb.readystate = 4
DoEvents
Loop
Set ele = wb.document.forms("form1")
ele.all("textpassword").Value = "pass"
ele.submit
on this site the button does have a name and id, but it is not common for input buttons to have name
OK but how do I who what the buttons have for name? And for example how did you know that the place where to input the username is "textlogin"?The code doesnet work beacuse I think that you must have the name of the button and not jus Submit
-
Oct 2nd, 2009, 04:30 AM
#22
Re: Web browser ?
i assure you it works as i tested it, i ran the code exactly as posted, i was redirected to a page the says i must login first, as my username was invalid
OK but how do I who what the buttons have for name?
read the page source code
or loop through all the input elements in debug mode to check out all the properties
vb Code:
for each ele in wb.document.getelementsbytagname("input") if ele.type = "submit" then msgbox ele.name next
Last edited by westconn1; Oct 2nd, 2009 at 04:36 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 2nd, 2009, 09:04 AM
#23
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by westconn1
i assure you it works as i tested it, i ran the code exactly as posted, i was redirected to a page the says i must login first, as my username was invalid
read the page source code
or loop through all the input elements in debug mode to check out all the properties
vb Code:
for each ele in wb.document.getelementsbytagname("input")
if ele.type = "submit" then msgbox ele.name
next
How do I get to see the source code?
-
Oct 2nd, 2009, 04:00 PM
#24
Re: Web browser ?
open the page in your default browser, right click > view source
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 3rd, 2009, 07:44 AM
#25
Thread Starter
Addicted Member
Re: Web browser ?
ok thank you.
And one last question:
what does the "ele.all" mean?
-
Oct 3rd, 2009, 08:56 AM
#26
Re: Web browser ?
in this case ele was an object for forms(1)
ele.all is all elements in form1
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 5th, 2009, 01:09 PM
#27
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by westconn1
in this case ele was an object for forms(1)
ele.all is all elements in form1
Ok thank you. Is there some other commands that I need to know.
For example how do I getdata from a site. Lets say www.gpro.se
If I want to print the time on the timer (next race.... in 1day 10h 20min 58sec) into a textbox
-
Oct 5th, 2009, 03:38 PM
#28
Re: Web browser ?
you need to find the element that contains the timer, then read the appropriate property, which may be value
on looking at the source
Code:
<font class="normal11" color="#FFFFFF">Season 16 - Race 14 - <a href="TrackDetails.asp?id=34">Melbourne GP (Australia)</a>: October 6th 2009
</font>
</td><td class="noborder" align="center" valign="middle" nowrap>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="350" height="20" ID="Shockwaveflash1" VIEWASTEXT>
<param name="movie" value="/flashstuff/cuenta%20regresiva.swf?serverDay=0&serverHour=0&serverMin=0&serverSec=77519&Group=">
<param name="quality" value="high">
<embed src="/flashstuff/cuenta%20regresiva.swf?serverDay=0&serverHour=0&serverMin=0&serverSec=77519&Group=" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="350" height="20"></embed>
</object>
it would appear that the countdown is a movie so i have no idea about haw to display that in your form
if you can get the start time for the race it would be easier to calculate the difference using a timer
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 6th, 2009, 08:35 AM
#29
Thread Starter
Addicted Member
Re: Web browser ?
 Originally Posted by westconn1
you need to find the element that contains the timer, then read the appropriate property, which may be value
on looking at the source
Code:
<font class="normal11" color="#FFFFFF">Season 16 - Race 14 - <a href="TrackDetails.asp?id=34">Melbourne GP (Australia)</a>: October 6th 2009
</font>
</td><td class="noborder" align="center" valign="middle" nowrap>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="350" height="20" ID="Shockwaveflash1" VIEWASTEXT>
<param name="movie" value="/flashstuff/cuenta%20regresiva.swf?serverDay=0&serverHour=0&serverMin=0&serverSec=77519&Group=">
<param name="quality" value="high">
<embed src="/flashstuff/cuenta%20regresiva.swf?serverDay=0&serverHour=0&serverMin=0&serverSec=77519&Group=" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="350" height="20"></embed>
</object>
it would appear that the countdown is a movie so i have no idea about haw to display that in your form
if you can get the start time for the race it would be easier to calculate the difference using a timer
OK but lets take something else:
The top 16 Elite standings after race 13 of 17.
How do I inport that to my form and view it in a textbox of something
-
Oct 6th, 2009, 03:33 PM
#30
Re: Web browser ?
try like this
vb Code:
Set es = wb.document.getelementbyid("table10") For Each ele In es.getelementsbytagname("tr") For Each td In ele.getelementsbytagname("td") msg = msg & td.innertext & " " Next msg = msg & vbNewLine Next MsgBox msg
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|