Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Browsing to URL and reading contents

5 views
Skip to first unread message

Mike

unread,
Nov 16, 2003, 3:10:29 PM11/16/03
to
I am familiar with navigating to a URL and examining the text on a page,
but I want to be able to navigate here
http://www.chambersharrap.co.uk/chambers/wwizards/wwizards.py/main
put a word into the scrabble box, activate the arrow beside it, then
examine the results page that then follows to

There are other dictionary pages at this web page, but the word
validation is different and I need to validate against the scrabble box

Please can someone tell me how this is done
--
Mike
Please post replies to newsgroup to benefit others
Replace dead spam with ntl world to reply by email

Jake Marx

unread,
Nov 17, 2003, 9:59:47 AM11/17/03
to
Hi Mike,

This should work for you:

Public Function gbCheckScrabbleWord(rsWord) As Boolean
Dim ie As InternetExplorer
Dim sURL As String
Dim sHeader As String
Dim bytPostData() As Byte

Set ie = New InternetExplorer

ie.Visible = False

sURL =
"http://www.chambersharrap.co.uk/chambers/wwizards/wwizards.py/main"
bytPostData = "sword=" & rsWord & ""

bytPostData = StrConv(bytPostData, vbFromUnicode)
sHeader = "Content-Type: " & "application/x-www-form-urlencoded" &
vbCrLf
ie.Navigate sURL, 0, , bytPostData, sHeader

Do Until Not ie.Busy And ie.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

gbCheckScrabbleWord = InStr(1, ie.Document.body.innerhtml, "OSW ")

ie.Quit
Set ie = Nothing
End Function

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

Mike

unread,
Nov 18, 2003, 5:29:00 PM11/18/03
to
Cheers very much

Can you please explain the difference between the Busy and the
ReadyState attribute - isn't testing for both overkill

I know the IE window opens in the background as invisible, but are there
any API's for going to viewing contents of URL's without needing IE

Jake Marx

unread,
Nov 18, 2003, 6:00:49 PM11/18/03
to
Hi Mike,

Mike wrote:
> Can you please explain the difference between the Busy and the
> ReadyState attribute - isn't testing for both overkill

I don't know for sure. All I can say is that in some cases, using 1 or the
other seems to fail on my machine unless I put in Application.Wait or Sleep
statements.

> I know the IE window opens in the background as invisible, but are
> there any API's for going to viewing contents of URL's without
> needing IE

You can use the MSXMLHTTP object:

Sub test()
Dim xml As XMLHTTP40

Set xml = New XMLHTTP40

xml.Open "POST", "http://www.chambersharrap.co.uk/" & _
"chambers/wwizards/wwizards.py/main"
xml.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
xml.send "sword=test"
Debug.Print xml.responseText
Set xml = Nothing
End Sub

It does seem much faster, but I don't know what it's doing behind the
scenes. I assume it's using the core libraries IE does without actually
instantiating the IE application. I don't think it will be installed on all
machines, so you may have to distribute the library for your users.

Mike

unread,
Nov 19, 2003, 3:10:26 AM11/19/03
to
On Tue, 18 Nov 2003 at 16:00:49, Jake Marx (Jake Marx
<msn...@longhead.com>) wrote:
>You can use the MSXMLHTTP object:
>
> Sub test()
> Dim xml As XMLHTTP40
>
> Set xml = New XMLHTTP40
>
> xml.Open "POST", "http://www.chambersharrap.co.uk/" & _
> "chambers/wwizards/wwizards.py/main"
> xml.setRequestHeader "Content-Type",
>"application/x-www-form-urlencoded"
> xml.send "sword=test"
> Debug.Print xml.responseText
> Set xml = Nothing
> End Sub
>
>It does seem much faster, but I don't know what it's doing behind the
>scenes. I assume it's using the core libraries IE does without actually
>instantiating the IE application. I don't think it will be installed on all
>machines, so you may have to distribute the library for your users.
>
Jake - you are a star

It needs a slight bit of tweaking in the middle before I check
responseText and I've had to use version 3.0 with Office 2000

Mike

unread,
Nov 19, 2003, 3:28:11 AM11/19/03
to
On Mon, 17 Nov 2003 at 07:59:47, Jake Marx (Jake Marx
<msn...@longhead.com>) wrote:
> Do Until Not ie.Busy And ie.ReadyState = READYSTATE_COMPLETE
> DoEvents
> Loop
>
Is it possible to tell me the values and names of all the READYSTATE_
constants. I've tried loading my Office CD-ROM, but it just plays the
windows tune and doesn't bring up the dialogue box

It's just a problem with that CD (or something with Office on my hard
drive) as other software is fine

This would be a big help please

Jake Marx

unread,
Nov 19, 2003, 9:08:11 AM11/19/03
to
Hi Mike,

?READYSTATE_COMPLETE
4
?READYSTATE_INTERACTIVE
3
?READYSTATE_LOADED
2
?READYSTATE_LOADING
1
?READYSTATE_UNINITIALIZED
0

I forgot to mention in the previous posts, but if you add a reference to
Microsoft Internet Controls, these constants will be defined for you (as
well as the InternetExplorer class).

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

Mike

unread,
Nov 19, 2003, 3:16:54 PM11/19/03
to
On Wed, 19 Nov 2003 at 07:08:11, Jake Marx (Jake Marx
<msn...@longhead.com>) wrote:
>?READYSTATE_COMPLETE
> 4
>?READYSTATE_INTERACTIVE
> 3
>?READYSTATE_LOADED
> 2
>?READYSTATE_LOADING
> 1
>?READYSTATE_UNINITIALIZED
> 0
>
Many thanks


>I forgot to mention in the previous posts, but if you add a reference to
>Microsoft Internet Controls, these constants will be defined for you (as
>well as the InternetExplorer class).
>

No worries - I'd worked that one out. Took a little longer to work out
what reference to include for the XML stuff though

Mike

unread,
Nov 20, 2003, 1:47:32 PM11/20/03
to
On Tue, 18 Nov 2003 at 16:00:49, Jake Marx (Jake Marx
<msn...@longhead.com>) wrote:
>You can use the MSXMLHTTP object:
>
> Sub test()
> Dim xml As XMLHTTP40
>
> Set xml = New XMLHTTP40
>
> xml.Open "POST", "http://www.chambersharrap.co.uk/" & _
> "chambers/wwizards/wwizards.py/main"
> xml.setRequestHeader "Content-Type",
>"application/x-www-form-urlencoded"
> xml.send "sword=test"
> Debug.Print xml.responseText
> Set xml = Nothing
> End Sub
>
How would I do it for this one - used the same theory, but responseText
does not reflect the "yes!" or "not a word" (even when I do wait for a
ready status)


<http://www.mattelscrabble.com/cgi-bin/chambers/scrabbleword.pl?action=ac
tion&word=anticonvulsive>

Mike

unread,
Nov 20, 2003, 2:53:03 PM11/20/03
to
On Thu, 20 Nov 2003 at 18:47:32, Mike (Mike <swee...@deadspam.com>)
wrote:

>How would I do it for this one - used the same theory, but responseText
>does not reflect the "yes!" or "not a word" (even when I do wait for a
>ready status)
>
Sorry my fault - I was combining the whole URL into the Open with "" for
the Send
0 new messages