msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Select checkboxes in web page

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI
Author Message
IainM



Joined: 14 Jan 2008
Posts: 4

PostPosted: Mon Jan 14, 2008 7:59 am    Post subject: Select checkboxes in web page Reply with quote

I'm looking for VB (v6 preferably or 2005) code to automatically select
checkboxes on a web page displayed within a web browser.

The story is that my webmail provider doesn't block spam, and I frequently
have hundreds of spam emails to delete. The only way to do this is to
manually select a checkbox next to every individual email I want to delete.
This is *very* time consuming.

Any help would be very much appreciated.
Iain

Archived from group: microsoft>public>vb>winapi
Back to top
View user's profile Send private message
Larry Serflaten



Joined: 04 Oct 2007
Posts: 2644

PostPosted: Mon Jan 14, 2008 11:56 am    Post subject: Re: Select checkboxes in web page Reply with quote

"IainM" wrote
> I'm looking for VB (v6 preferably or 2005) code to automatically select
> checkboxes on a web page displayed within a web browser.
>
> The story is that my webmail provider doesn't block spam, and I frequently
> have hundreds of spam emails to delete. The only way to do this is to
> manually select a checkbox next to every individual email I want to delete.
> This is *very* time consuming.
>
> Any help would be very much appreciated.


A. Isn't there a 'Check All' option?
B. Use a WebBrowser control to navigate to your webmail, and
when the page is loaded, access the WB Document object to
manipulate objects on the page.
C. You know that page is just so much data that came over the wire.
The same for your reply, when you submit the form with all the
checked boxes. Look at the data that gets sent, and see if you can just
send the data that looks like you checked the boxes....

What method appeals to you?
LFS

LFS
Back to top
View user's profile Send private message
IainM



Joined: 14 Jan 2008
Posts: 4

PostPosted: Mon Jan 14, 2008 10:13 am    Post subject: Re: Select checkboxes in web page Reply with quote

There is no "check all" button, so I'm very keen to write an app to help me
(and loads of others out).

I'm haven't got much experience in programming, so I wouldn't know where to
start to manipulate objects on a web page.
I have some basic code to send text to an external window, and I could
follow that OK, so I thought that would be the easiest way to go.
I just need to get code to enumerate and select checkboxes in an IE window.

Thanks for replying,
Iain



"Larry Serflaten" wrote:

>
> "IainM" wrote
> > I'm looking for VB (v6 preferably or 2005) code to automatically select
> > checkboxes on a web page displayed within a web browser.
> >
> > The story is that my webmail provider doesn't block spam, and I frequently
> > have hundreds of spam emails to delete. The only way to do this is to
> > manually select a checkbox next to every individual email I want to delete.
> > This is *very* time consuming.
> >
> > Any help would be very much appreciated.
>
>
> A. Isn't there a 'Check All' option?
> B. Use a WebBrowser control to navigate to your webmail, and
> when the page is loaded, access the WB Document object to
> manipulate objects on the page.
> C. You know that page is just so much data that came over the wire.
> The same for your reply, when you submit the form with all the
> checked boxes. Look at the data that gets sent, and see if you can just
> send the data that looks like you checked the boxes....
>
> What method appeals to you?
> LFS
>
> LFS
>
>
>
Back to top
View user's profile Send private message
Larry Serflaten



Joined: 04 Oct 2007
Posts: 2644

PostPosted: Mon Jan 14, 2008 6:49 pm    Post subject: Re: Select checkboxes in web page Reply with quote

"IainM" wrote

> I'm haven't got much experience in programming, so I wouldn't know where to
> start to manipulate objects on a web page.

> I have some basic code to send text to an external window, and I could
> follow that OK, so I thought that would be the easiest way to go.
> I just need to get code to enumerate and select checkboxes in an IE window.

Let me put it this way...

You say you want to fly, and ask how to do that.
I might have said use an airplane, or perhaps a hang glider.
You reply you already have a kite and some string and thought
that would be the easiest way to go.

Even if you get the kite working, you won't have much control.
If you use the airplane or the glider, you'll have complete control....

So, how about getting started with controling InternetExplorer
to do your bidding? Now is as good a time to learn, as any....

For an example of hooking into InternetExplorer, start a new project
and add a command button to the form. Then find the VB menu item
Project>References and check the box by 'Microsoft Internet Controls'
and hit OK to dismiss the dialog. Then paste in the code below and
run the program.

When it starts up, it loads IE and navigates to Google.com. Watch
the Immediate window for a list of all the objects on that webpage.
(There are only 4). When that list appears, the page is fully loaded
and available for you to modify. Click the button to modify one of
the objects on that page (it adds text to the search text area).

Now navigate to your webmail page and again watch the Immediate window.

Whatever it lists would be available to you to modify, just like the
textbox at Google. Of course you can't use the supplied command
button because that was set up for google, so stop the program and
add a second button to the form. Then change the Navigate2 call to
load in your own webpage, and start experimenting on setting the
checkbox values.

Checkboxes have a 'Checked' property you can set to True or False....

Ex: doc.all("chkLine1").Checked = True

HTH
LFS


'Reference "Microsoft Internet Controls" for:
Private WithEvents Explorer As InternetExplorer
Private doc As Object

Private Sub Form_Load()
Set Explorer = New InternetExplorer
Explorer.Visible = True
Explorer.Navigate2 "http:\\www.google.com"
End Sub

Private Sub Command1_Click()
If Not (doc Is Nothing) Then
doc.All("q").Value = "Button clicked at: " & Now
End If
End Sub

Private Sub Explorer_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim obj

If pDisp Is Explorer Then
On Error Resume Next
Debug.Print vbCrLf; "TYPE", "NAME", "VALUE"
For Each obj In Explorer.Document.All()
Debug.Print obj.Type, obj.Name, obj.Value
Next
Set doc = Explorer.Document
End If

End Sub
Back to top
View user's profile Send private message
IainM



Joined: 14 Jan 2008
Posts: 4

PostPosted: Tue Jan 15, 2008 4:13 am    Post subject: Re: Select checkboxes in web page Reply with quote

OK, you've convinced me. I created a new VB6 project and followed your
instructions. IE launches OK, but nothing appears in the Immediate window.
Anyway, as you say, now is a good time to learn and I've got a good start
with the code you have provided.

Thanks a million for replying to my post and supplying the code, much
appreciated.

Iain


"Larry Serflaten" wrote:

>
> "IainM" wrote
>
> > I'm haven't got much experience in programming, so I wouldn't know where to
> > start to manipulate objects on a web page.
>
> > I have some basic code to send text to an external window, and I could
> > follow that OK, so I thought that would be the easiest way to go.
> > I just need to get code to enumerate and select checkboxes in an IE window.
>
> Let me put it this way...
>
> You say you want to fly, and ask how to do that.
> I might have said use an airplane, or perhaps a hang glider.
> You reply you already have a kite and some string and thought
> that would be the easiest way to go.
>
> Even if you get the kite working, you won't have much control.
> If you use the airplane or the glider, you'll have complete control....
>
> So, how about getting started with controling InternetExplorer
> to do your bidding? Now is as good a time to learn, as any....
>
> For an example of hooking into InternetExplorer, start a new project
> and add a command button to the form. Then find the VB menu item
> Project>References and check the box by 'Microsoft Internet Controls'
> and hit OK to dismiss the dialog. Then paste in the code below and
> run the program.
>
> When it starts up, it loads IE and navigates to Google.com. Watch
> the Immediate window for a list of all the objects on that webpage.
> (There are only 4). When that list appears, the page is fully loaded
> and available for you to modify. Click the button to modify one of
> the objects on that page (it adds text to the search text area).
>
> Now navigate to your webmail page and again watch the Immediate window.
>
> Whatever it lists would be available to you to modify, just like the
> textbox at Google. Of course you can't use the supplied command
> button because that was set up for google, so stop the program and
> add a second button to the form. Then change the Navigate2 call to
> load in your own webpage, and start experimenting on setting the
> checkbox values.
>
> Checkboxes have a 'Checked' property you can set to True or False....
>
> Ex: doc.all("chkLine1").Checked = True
>
> HTH
> LFS
>
>
> 'Reference "Microsoft Internet Controls" for:
> Private WithEvents Explorer As InternetExplorer
> Private doc As Object
>
> Private Sub Form_Load()
> Set Explorer = New InternetExplorer
> Explorer.Visible = True
> Explorer.Navigate2 "http:\\www.google.com"
> End Sub
>
> Private Sub Command1_Click()
> If Not (doc Is Nothing) Then
> doc.All("q").Value = "Button clicked at: " & Now
> End If
> End Sub
>
> Private Sub Explorer_DocumentComplete(ByVal pDisp As Object, URL As Variant)
> Dim obj
>
> If pDisp Is Explorer Then
> On Error Resume Next
> Debug.Print vbCrLf; "TYPE", "NAME", "VALUE"
> For Each obj In Explorer.Document.All()
> Debug.Print obj.Type, obj.Name, obj.Value
> Next
> Set doc = Explorer.Document
> End If
>
> End Sub
>
>
>
>
>
>
>
Back to top
View user's profile Send private message
Mike Scirocco



Joined: 04 Oct 2007
Posts: 197

PostPosted: Tue Jan 15, 2008 4:51 pm    Post subject: Re: Select checkboxes in web page Reply with quote

IainM wrote:
> I'm looking for VB (v6 preferably or 2005) code to automatically select
> checkboxes on a web page displayed within a web browser.
>
> The story is that my webmail provider doesn't block spam, and I frequently
> have hundreds of spam emails to delete. The only way to do this is to
> manually select a checkbox next to every individual email I want to delete.
> This is *very* time consuming.
>
> Any help would be very much appreciated.
> Iain

A fun alternative is using javascript to do it using the Greasemonkey in
a Firefox browser.

https://addons.mozilla.org/en-US/firefox/addon/748
Back to top
View user's profile Send private message
IainM



Joined: 14 Jan 2008
Posts: 4

PostPosted: Wed Jan 16, 2008 5:23 am    Post subject: Re: Select checkboxes in web page Reply with quote

Mike,
That looks like as if it is very useful - I'll have a good look at that too.

Thanks a lot.
Iain

"Mike Scirocco" wrote:

> IainM wrote:
> > I'm looking for VB (v6 preferably or 2005) code to automatically select
> > checkboxes on a web page displayed within a web browser.
> >
> > The story is that my webmail provider doesn't block spam, and I frequently
> > have hundreds of spam emails to delete. The only way to do this is to
> > manually select a checkbox next to every individual email I want to delete.
> > This is *very* time consuming.
> >
> > Any help would be very much appreciated.
> > Iain
>
> A fun alternative is using javascript to do it using the Greasemonkey in
> a Firefox browser.
>
> https://addons.mozilla.org/en-US/firefox/addon/748
>

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group