Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.excel.programming > #109489 > unrolled thread
| Started by | Walter Briscoe <wbriscoe@nospam.demon.co.uk> |
|---|---|
| First post | 2016-10-29 14:59 +0100 |
| Last post | 2016-11-04 01:52 +0000 |
| Articles | 20 on this page of 27 — 7 participants |
Back to article view | Back to microsoft.public.excel.programming
Watchdog timer issues Walter Briscoe <wbriscoe@nospam.demon.co.uk> - 2016-10-29 14:59 +0100
Re: Watchdog timer issues GS <gs@v.invalid> - 2016-10-29 17:50 -0400
Re: Watchdog timer issues Walter Briscoe <wbriscoe@nospam.demon.co.uk> - 2016-10-30 20:34 +0000
Re: Watchdog timer issues GS <gs@v.invalid> - 2016-10-29 17:52 -0400
Re: Watchdog timer issues Walter Briscoe <wbriscoe@nospam.demon.co.uk> - 2016-10-30 20:38 +0000
Re: Watchdog timer issues GS <gs@v.invalid> - 2016-10-30 17:14 -0400
Re: Watchdog timer issues GS <gs@v.invalid> - 2016-10-30 17:36 -0400
Re: Watchdog timer issues Walter Briscoe <wbriscoe@nospam.demon.co.uk> - 2016-11-02 09:43 +0000
Re: Watchdog timer issues GS <gs@v.invalid> - 2016-11-02 13:30 -0400
Re: Watchdog timer issues Adrian Caspersz <email@here.invalid> - 2016-11-03 17:44 +0000
Re: Watchdog timer issues GS <gs@v.invalid> - 2016-11-03 15:33 -0400
Re: Watchdog timer issues Adrian Caspersz <email@here.invalid> - 2016-11-03 20:11 +0000
Re: Watchdog timer issues GS <gs@v.invalid> - 2016-11-03 16:47 -0400
Re: Watchdog timer issues Walter Briscoe <wbriscoe@nospam.demon.co.uk> - 2016-11-06 10:37 +0000
Re: Watchdog timer issues Walter Briscoe <wbriscoe@nospam.demon.co.uk> - 2016-11-06 11:42 +0000
Re: Watchdog timer issues GS <gs@v.invalid> - 2016-11-07 12:18 -0500
Re: Watchdog timer issues Tqlebvng514 <Thlebkng152@gmail.com> - 2016-10-30 06:03 +0000
Re: Watchdog timer issues Tqlebvng514 <Thlebkng152@gmail.com> - 2016-10-30 07:03 +0000
Re: Watchdog timer issues Tqlebvng514 <Thlebkng152@gmail.com> - 2016-10-30 08:03 +0000
Re: Watchdog timer issues Tqlebvng514 <Thlebkng152@gmail.com> - 2016-10-30 11:04 +0000
Re: Watchdog timer issues Tqlebvng514 <Thlebkng152@gmail.com> - 2016-10-30 13:04 +0000
Re: Watchdog timer issues Tqlebvng514 <Thlebkng152@gmail.com> - 2016-10-30 14:03 +0000
Re: Watchdog timer issues Tqlebvng514 <Thlebkng152@gmail.com> - 2016-10-30 15:03 +0000
Re: Watchdog timer issues Tqlebvng514 <Thlebkng152@gmail.com> - 2016-10-30 16:03 +0000
Re: Watchdog timer issues giaxeoto4banh <giaxeoto4banh@gmail.com> - 2016-11-03 12:19 +0000
Re: Watchdog timer issues tinhdauhcm1 <tinhdauhcm1@gmail.com> - 2016-11-03 16:01 +0000
Re: Watchdog timer issues dailycuacuonhcm <dailycuacuonhcm@gmail.com> - 2016-11-04 01:52 +0000
Page 1 of 2 [1] 2 Next page →
| From | Walter Briscoe <wbriscoe@nospam.demon.co.uk> |
|---|---|
| Date | 2016-10-29 14:59 +0100 |
| Subject | Watchdog timer issues |
| Message-ID | <v59JEhDatKFYFw1d@freenetname.co.uk> |
I am using XL 2003.
I have a need to run Internet Explorer for about 20k URLs.
This is beyond the capacity of IE on my system.
I use a 30 second watchdog timer to detect IE becoming unreasonably slow.
Relevant code is:
' Needs Tools/References/Microsoft Internet Controls
Public ie As SHDocVw.InternetExplorer
Private killtime As Date
Private Const killduration As String = "00:00:30"
...
Private Sub kill_ie()
Debug.Print now & " kill_ie() called"
killtime = 0
Set ie = Nothing
End Sub
Public Function Wait4IEretry(ByVal operation As String) As Boolean
...
On Error GoTo newie
...
killtime = now + TimeValue(killduration)
Application.OnTime EarliestTime:=killtime, Procedure:="kill_ie", Schedule:=True
Wait4IE operation
Application.OnTime EarliestTime:=killtime, Procedure:="kill_ie", Schedule:=False
If False Then
newie:
If killtime <> 0 Then
On Error Resume Next ' ontime may not be set
Application.OnTime EarliestTime:=killtime, Procedure:="kill_ie", Schedule:=False
End If
Set ie = Nothing
Resume retry
Stop
retry:
' Stop
Wait4IEretry = False
Exit Function
End If
...
Wait4IEretry = True
Exit Function
....
End Function
So Wait4IEretry starts a 3o second watchdog timer on Wait4IE completing
in 30 seconds.
If 30 seconds elapses, kill_ie is called and ie is made nothing, causing
Wait4IE to complete with an error and transfer control to label newie.
I find "On Error Resume Next" ineffective against errors in Application.OnTime.
I zero killtime in kill_ie so Application.OnTime is not called.
If I hit escape to allow me to save my XL file, Application.OnTime is called and errors.
Why is "On Error Resume Next" ineffective?
If 30 seconds does not elapse, the timer is cancelled without problem.
I can't work out how to make killduration a date.
In the immediate debug window, I see
?#00:00:30#
00:00:30
?timevalue("00:00:30")
00:00:30
In the debug code window,
Private Const killduration As Date = #00:00:30#
is transformed into
Private Const killduration As Date = #12:00:30 AM#
As an sside, many cells in my worksheet have a small triangle marking
their upper left corner. I remember that as meaning there is some
strangeness about the data in the marked cells. I just can't
work out how to Google it.
excel cell warning message is ineffective.
excel cell triangle corner suggests a formula error and that a trace
error button should appear - it does not - the cells contain values.
Unsetting Tools/Options/Error checking/Number stored as text
causes those triangles to vanish and I now know what the issue is.
How to I get "Number stored as text" to appear as a warning?
--
Walter Briscoe
[toc] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2016-10-29 17:50 -0400 |
| Message-ID | <nv35ig$sla$1@dont-email.me> |
| In reply to | #109489 |
Walter, Try... Private Const vKillET = "00:00:30" ..and in your function... killtime = TimeValue(Now) + TimeValue(vKill_ET) 'returns time in hh:mm:ss AM/PM Also, in your function you might want to def a var to hold the boolean value used in your If..Then block. It can be set True as a default unless a condition toggles it false... Dim bMyVar As Boolean bMyVar = True '//assume success '//some code that preserves or toggles bMyVar If Not bMyVar Then newie: ... -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | Walter Briscoe <wbriscoe@nospam.demon.co.uk> |
|---|---|
| Date | 2016-10-30 20:34 +0000 |
| Message-ID | <C0nSn3JwllFYFwAc@freenetname.co.uk> |
| In reply to | #109490 |
In message <nv35ig$sla$1@dont-email.me> of Sat, 29 Oct 2016 17:50:33 in microsoft.public.excel.programming, GS <gs@v.invalid> writes Gary, Thanks for your input. >Walter, > >Try... > > Private Const vKillET = "00:00:30" That is effectively what I do in >Private Const killduration As String = "00:00:30" I don't do Magyar. ;) I feel I should be able to do Private Const vKillET as date = sommething. > >..and in your function... > > killtime = TimeValue(Now) + TimeValue(vKill_ET) > 'returns time in hh:mm:ss AM/PM I do that partially with > killtime = now + TimeValue(killduration) Why would you "cast" now? ?typename(now) Date ?typename(timevalue(now)) Date > >Also, in your function you might want to def a var to hold the boolean >value used in your If..Then block. It can be set True as a default >unless a condition toggles it false... > > Dim bMyVar As Boolean > bMyVar = True '//assume success > > '//some code that preserves or toggles bMyVar > > If Not bMyVar Then >newie: > ... > I must concede I am overloading killtime as both a value and a flag. Slightly insanitary. ;) How do I turn green cell north west corners into text? -- Walter Briscoe
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2016-10-29 17:52 -0400 |
| Message-ID | <nv35lg$su1$1@dont-email.me> |
| In reply to | #109489 |
Not sure why you're automating IE since most things it does can be accessed directly via APIs with no wait time! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | Walter Briscoe <wbriscoe@nospam.demon.co.uk> |
|---|---|
| Date | 2016-10-30 20:38 +0000 |
| Message-ID | <xkZeDIKJplFYFwG5@freenetname.co.uk> |
| In reply to | #109491 |
In message <nv35lg$su1$1@dont-email.me> of Sat, 29 Oct 2016 17:52:09 in microsoft.public.excel.programming, GS <gs@v.invalid> writes >Not sure why you're automating IE since most things it does can be >accessed directly via APIs with no wait time! > Gary, I know no better. What APIs do you refer to? I send a URL, await a response and analyse ie.doc. I repeat, I know no better. ;) -- Walter Briscoe
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2016-10-30 17:14 -0400 |
| Message-ID | <nv5nqu$v4k$1@dont-email.me> |
| In reply to | #109501 |
> In message <nv35lg$su1$1@dont-email.me> of Sat, 29 Oct 2016 17:52:09 > in microsoft.public.excel.programming, GS <gs@v.invalid> writes >> Not sure why you're automating IE since most things it does can be >> accessed directly via APIs with no wait time! >> > > Gary, I know no better. > What APIs do you refer to? > I send a URL, await a response and analyse ie.doc. > I repeat, I know no better. ;) Have a look at my replies to the post by Robert Baer in this forum on May 26th to see if it applies to what you are trying to do... -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2016-10-30 17:36 -0400 |
| Message-ID | <nv5p4k$421$1@dont-email.me> |
| In reply to | #109502 |
>> In message <nv35lg$su1$1@dont-email.me> of Sat, 29 Oct 2016 >> 17:52:09 in microsoft.public.excel.programming, GS <gs@v.invalid> >> writes >>> Not sure why you're automating IE since most things it does can be >>> accessed directly via APIs with no wait time! >>> >> >> Gary, I know no better. >> What APIs do you refer to? >> I send a URL, await a response and analyse ie.doc. >> I repeat, I know no better. ;) > > Have a look at my replies to the post by Robert Baer in this forum on > May 26th to see if it applies to what you are trying to do... Subject of his post is... "Read (and parse) file on the web" -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | Walter Briscoe <wbriscoe@nospam.demon.co.uk> |
|---|---|
| Date | 2016-11-02 09:43 +0000 |
| Message-ID | <z56O0wFLVbGYFw+M@freenetname.co.uk> |
| In reply to | #109503 |
In message <nv5p4k$421$1@dont-email.me> of Sun, 30 Oct 2016 17:36:45 in
microsoft.public.excel.programming, GS <gs@v.invalid> writes
>>> In message <nv35lg$su1$1@dont-email.me> of Sat, 29 Oct 2016
>>>17:52:09 in microsoft.public.excel.programming, GS <gs@v.invalid>
>>>writes
>>>> Not sure why you're automating IE since most things it does can be
>>>> accessed directly via APIs with no wait time!
>>>>
>>>
>>> Gary, I know no better.
>>> What APIs do you refer to?
>>> I send a URL, await a response and analyse ie.doc.
>>> I repeat, I know no better. ;)
>>
>> Have a look at my replies to the post by Robert Baer in this forum on
>>May 26th to see if it applies to what you are trying to do...
>
>Subject of his post is...
>
> "Read (and parse) file on the web"
>
Thanks!
I had a look at your contributions to this 92 member thread.
I saw 2 interesting "names": URLDownloadToFile and fParseWebPages.frm.
I googled URLDownloadToFile.
I adapted a web example. (I later found an example from Auric in the
thread.)
When I opened the downloaded page in IE, it looked different - simpler.
I made another example, which downloaded to memory. The download was
about 120k, compared with 110k.
I converted that example to write to a file. The file was similarly
simpler.
I would like an API technique to convert the downloaded HTML to DOM.
I have a reliable - but slow - method for analysing DOM information.
While Googling, I learned Regular Expressions are not recommended for
HTML analysis.
I also grabbed ParseWebPages.zip from https://www.nsncenter.com/NSN/.
When I ran the code, I got "Method or data member not found" referring
to webbrowser in
Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("PgNum") Then
Range("WebAddr") = gsUrl1 & Target.Value: Me.WebBrowser1.Navigate
Range("WebAddr"): SetBtnState
End If
End Sub
I found no "Me" definition.
My understanding is zilch, but I am happy to learn.
OOPS! I nearly forgot to quote my example code:
Public Declare Function URLDownloadToFile Lib "urlmon" Alias
"URLDownloadToFileA" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As
String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Function GetWebPage(ByRef URL As String) As String
Dim xml As Object ' need reference to get IXMLHTTPRequest
On Error Resume Next
Set xml = CreateObject("Microsoft.XMLHTTP")
With xml
.Open "GET", URL, False
.send
GetWebPage = .responseText
End With
Set xml = Nothing ' Is this needed?
End Function
Public Function DownloadFile1() As String
Dim lngRetVal As Long
Dim hFile As Long
Dim localFilename As String
Dim strCurrentURL As String
Dim content As String
localFilename = "C:\Users\IBM\AppData\Roaming\Microsoft\Excel\Downlo
ad.htm"
strCurrentURL = "https://tfl.gov.uk/bus/stop/490000235Z/new-oxford-
street?"
If True Then
content = GetWebPage(strCurrentURL)
hFile = FreeFile
Open localFilename For Output As #hFile
Write #hFile, content
Close #hFile
Else
lngRetVal = URLDownloadToFile(0, strCurrentURL, localFilename, 0, 0)
End If
hFile = FreeFile
Open localFilename For Input As #hFile
DownloadFile1 = Input$(LOF(hFile), hFile)
Close #hFile
End Function
Public Function DownloadFile0() As String
Dim lngRetVal As Long
Dim hFile As Long
Dim localFilename As String
Dim strCurrentURL As String
localFilename = "C:\Users\IBM\AppData\Roaming\Microsoft\Excel\Downlo
ad.htm"
strCurrentURL = "https://tfl.gov.uk/bus/stop/490000235Z/new-oxford-
street?"
lngRetVal = URLDownloadToFile(0, strCurrentURL, localFilename, 0, 0)
hFile = FreeFile
Open localFilename For Input As #hFile
DownloadFile = Input$(LOF(hFile), hFile)
Close #hFile
End Function
--
Walter Briscoe
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2016-11-02 13:30 -0400 |
| Message-ID | <nvd7q9$pcg$1@dont-email.me> |
| In reply to | #109513 |
The latest version of ParseWebPages.xls doesn't contain any userforms. You can download it's zip here... https://app.box.com/s/23yqum8auvzx17h04u4f ..and review what it does and how it works. Let me know if you need further assistance... -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | Adrian Caspersz <email@here.invalid> |
|---|---|
| Date | 2016-11-03 17:44 +0000 |
| Message-ID | <e81bciFiqhtU1@mid.individual.net> |
| In reply to | #109515 |
On 02/11/16 17:30, GS wrote: > The latest version of ParseWebPages.xls doesn't contain any userforms. > You can download it's zip here... > > This one of the projects that my directions would be "If I wanted to get there, I wouldn't start from here". Use Pup. http://www.compciv.org/recipes/cli/pup-for-parsing-html/ https://github.com/EricChiang/pup Works in Windows and in everything else. -- Adrian C
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2016-11-03 15:33 -0400 |
| Message-ID | <nvg3e6$2c5$1@dont-email.me> |
| In reply to | #109518 |
> On 02/11/16 17:30, GS wrote: >> The latest version of ParseWebPages.xls doesn't contain any >> userforms. >> You can download it's zip here... >> >> > > This one of the projects that my directions would be "If I wanted to > get there, I wouldn't start from here". > > Use Pup. > > http://www.compciv.org/recipes/cli/pup-for-parsing-html/ > https://github.com/EricChiang/pup > > Works in Windows and in everything else. Very nice tool! Not sure the usefullness importing the data into Excel is from a command window without additional arduous coding. Do you have any suggestions for Walter? -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | Adrian Caspersz <email@here.invalid> |
|---|---|
| Date | 2016-11-03 20:11 +0000 |
| Message-ID | <e81jutFktekU1@mid.individual.net> |
| In reply to | #109520 |
On 03/11/16 19:33, GS wrote: >> On 02/11/16 17:30, GS wrote: >>> The latest version of ParseWebPages.xls doesn't contain any userforms. >>> You can download it's zip here... >>> >>> >> >> This one of the projects that my directions would be "If I wanted to >> get there, I wouldn't start from here". >> >> Use Pup. >> >> http://www.compciv.org/recipes/cli/pup-for-parsing-html/ >> https://github.com/EricChiang/pup >> >> Works in Windows and in everything else. > > Very nice tool! Not sure the usefullness importing the data into Excel > is from a command window without additional arduous coding. Do you have > any suggestions for Walter? > Well, for one it would enable dropping the nasty internet controls stuff from Excel, and CLI results can be got at through WScript.Shell http://stackoverflow.com/questions/17956651/execute-a-command-in-command-prompt-using-excel-vba I use pup in a bash script on linux, but the thing would be a fit here with less overall coding. -- Adrian C
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2016-11-03 16:47 -0400 |
| Message-ID | <nvg7oi$j76$1@dont-email.me> |
| In reply to | #109521 |
> On 03/11/16 19:33, GS wrote: >>> On 02/11/16 17:30, GS wrote: >>>> The latest version of ParseWebPages.xls doesn't contain any >>>> userforms. >>>> You can download it's zip here... >>>> >>>> >>> >>> This one of the projects that my directions would be "If I wanted >>> to >>> get there, I wouldn't start from here". >>> >>> Use Pup. >>> >>> http://www.compciv.org/recipes/cli/pup-for-parsing-html/ >>> https://github.com/EricChiang/pup >>> >>> Works in Windows and in everything else. >> >> Very nice tool! Not sure the usefullness importing the data into >> Excel >> is from a command window without additional arduous coding. Do you >> have >> any suggestions for Walter? >> > > Well, for one it would enable dropping the nasty internet controls > stuff from Excel, and CLI results can be got at through WScript.Shell > > > http://stackoverflow.com/questions/17956651/execute-a-command-in-command-prompt-using-excel-vba > > I use pup in a bash script on linux, but the thing would be a fit > here with less overall coding. Thanks! The idea behind Excel development is to primarily use VBA for automating tasks. Any command line can be run to execute external programs, but further automation code is required to manipulate as desired. Not much different than automating IE, IMO. The sample I linked to demos using the WebBrowser as well as using pure VB[A] so the differences are exposed; -the major one being the speed of using an API/VB is orders of magnitude faster than automating! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | Walter Briscoe <wbriscoe@nospam.demon.co.uk> |
|---|---|
| Date | 2016-11-06 10:37 +0000 |
| Message-ID | <syO52lEdfwHYFwEj@freenetname.co.uk> |
| In reply to | #109521 |
In message <e81jutFktekU1@mid.individual.net> of Thu, 3 Nov 2016 20:11:09 in microsoft.public.excel.programming, Adrian Caspersz <email@here.invalid> writes >On 03/11/16 19:33, GS wrote: >>> On 02/11/16 17:30, GS wrote: >>>> The latest version of ParseWebPages.xls doesn't contain any userforms. >>>> You can download it's zip here... >>>> >>>> >>> >>> This one of the projects that my directions would be "If I wanted to >>> get there, I wouldn't start from here". >>> >>> Use Pup. >>> >>> http://www.compciv.org/recipes/cli/pup-for-parsing-html/ >>> https://github.com/EricChiang/pup >>> >>> Works in Windows and in everything else. >> >> Very nice tool! Not sure the usefullness importing the data into Excel >> is from a command window without additional arduous coding. Do you have >> any suggestions for Walter? >> > >Well, for one it would enable dropping the nasty internet controls >stuff from Excel, and CLI results can be got at through WScript.Shell > >http://stackoverflow.com/questions/17956651/execute-a-command-in- >command-prompt-using-excel-vba > >I use pup in a bash script on linux, but the thing would be a fit here >with less overall coding. > Adrian, Thanks! I do not see how to port Pup to Windows (Vista Business Service Pack 2 for me). Even if I did do so, It does not seem capable of returning a DOM (Document Object Model). -- Walter Briscoe
[toc] | [prev] | [next] | [standalone]
| From | Walter Briscoe <wbriscoe@nospam.demon.co.uk> |
|---|---|
| Date | 2016-11-06 11:42 +0000 |
| Message-ID | <vAwZamImcxHYFw2t@freenetname.co.uk> |
| In reply to | #109515 |
In message <nvd7q9$pcg$1@dont-email.me> of Wed, 2 Nov 2016 13:30:11 in microsoft.public.excel.programming, GS
<gs@v.invalid> writes
>The latest version of ParseWebPages.xls doesn't contain any userforms. You can download it's zip here...
>
> https://app.box.com/s/23yqum8auvzx17h04u4f
>
>..and review what it does and how it works. Let me know if you need further assistance...
>
Garry,
This is my day for admitting stupidity. I downloaded the revised
ParseWebPages.zip file and opened ParseWebPages.xls. I can't see what
it does. When I try to run AutoParse, I get "Compile Error
Can't find project or library". Format is highlighted in
"oTimer.StopTimer: Debug.Print "AutoParse took " & Format(oTimer.Elapsed, "#.000000") & " seconds.""
I am suspicious it is a problem with my own implementation.
For a while, I have not been able to run Bob Bovey's VBA Code Cleaner,
found in <http:www.appspro.com/Utilities/CodeCleaner.htm>
It installs, but quietly fails to add a menu item to the VBE Tools Menu.
VBA CODE DECOMPILER AND COMPACTOR from http://orlando.mvps.org
seems to have vanished since I use it on 20160524.
I have had success with getting URLs into strings using
"Microsoft.XMLHTTP". Thousand of successful reads had a mean of about
a second and a standard deviation of about 1.5 seconds.
I Googled Microsoft.XMLHTTP and saw a reference to a responseXML member.
I can't again find something I read that it is only set for IE10 and
upwards. (I run IE9 and IE10 won't run on Vista).
I ran happily, grabbing each piece of information with a dedicated
regular expression (RE). Naughtily (I did not measure timing), I decided to
go for one RE for all pieces of information.
I ended with
Const grabpage0 As String = "^[\x00-\xFF]*([\x00-\xFF]{100}headline-info with-icon[\x00-\xFF]{500})" & _
"[\x00-\xFF]*arrival times of the next bus, text (\d{5}) to 87287[" & _
"[\x00-\xFF]*(first-last-details.*)" & _
"[\x00-\xFF]*(toId=.*)" & _
"[\x00-\xFF]*(href..*maps..*InputGeolocation=.*)[\x00-\xFF]*$"
That RE is 95%+ effective. Some data are missing from some pages.
I tried (:arrival times of the next bus, text (\d{5}) to 87287)?, but
that always returned empty - the RE engine finds it "easier" to
skip a datum than to set it, when given a choice.
The code seems to run in about 6 hours, rather than 12 when I started.
I aim to run it about once a week.
I don't have a watchdog timer on "Microsoft.XMLHTTP".
It seems less susceptible to seizing up than the IE9 browser.
--
Walter Briscoe
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2016-11-07 12:18 -0500 |
| Message-ID | <nvqd0g$rle$1@dont-email.me> |
| In reply to | #109557 |
> Garry,
> This is my day for admitting stupidity. I downloaded the revised
> ParseWebPages.zip file and opened ParseWebPages.xls. I can't see what
> it does. When I try to run AutoParse, I get "Compile Error
> Can't find project or library". Format is highlighted in
> "oTimer.StopTimer: Debug.Print "AutoParse took " &
> Format(oTimer.Elapsed, "#.000000") & " seconds.""
The project requires 'References' to:
Microsoft Internet Controls
Microsoft HTML Object Library
All the controls on 'Sheet1' work with WebBrowser1 and txtPgSrc.
You must 1st 'View Source' for the page rendered in the browser.
If the page is a 'parent' it contains links to items (child pages);
Click 'Get Item Links' to parse these links into txtPgSrc;
If you click a link in the browser:
Click 'View Source' to load the HTML into txtPgSrc;
Click 'Get Item Info' to load the search results into txtPgSrc;
The 'AutoParse' proc in m_OpenClose uses 'URLDownloadToFile()'. This
returns the entire web page source which, you will see if you compare,
is entirely different than the source returned for the rendered page in
the browser.
This example searches nsncenter.com for specific product info. It demos
how to parse the same info from a browser as well as directly from a
downloaded file. Some links have more than 1 product item listed, which
you'll see using the controls on 'Sheet1'. The same info is written to
an output file using the 'AutoParse' proc. Currently, this proc is
hard-coded to process 10 parent pages, each of which contain links to
11 child pages.
As of this reply both approaches are working as expected. Try closing
Excel and start over. Be careful to not just 'End' VBA when an error
occurs because this leaves objects loaded to memory; -make sure these
are set to 'Nothing'.
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | Tqlebvng514 <Thlebkng152@gmail.com> |
|---|---|
| Date | 2016-10-30 06:03 +0000 |
| Message-ID | <Tqlebvng514.125b4d58@excelbanter.com> |
| In reply to | #109489 |
Walter Briscoe;1626539 Wrote: > I am using XL 2003. I have a need to run Internet Explorer for about 20k > URLs. This is beyond the capacity of IE on my system. I use a 30 second > watchdog timer to detect IE becoming unreasonably slow. Relevant code > is: ' Needs Tools/References/Microsoft Internet Controls Public ie As > SHDocVw.InternetExplorer Private killtime As Date Private Const > killduration As String = "00:00:30" .... Private Sub kill_ie() > Debug.Print now & " kill_ie() called" killtime = 0 Set ie > = Nothing End Sub Public Function Wait4IEretry(ByVal operation As > String) As Boolean .... On Error GoTo newie .... killtime = now + > TimeValue(killduration) Application.OnTime EarliestTime:=killtime, > Procedu="kill_ie", Schedule:=True Wait4IE operation > Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", > Schedule:=False If False Then newie: If killtime <> 0 Then On > Error Resume Next ' ontime may not be set Application.OnTime > EarliestTime:=killtime, Procedu="kill_ie", Schedule:=False End > If Set ie = Nothing Resume retry Stop retry: ' Stop Wait4IEretry = False > Exit Function End If .... Wait4IEretry = True Exit Function ..... End > Function So Wait4IEretry starts a 3o second watchdog timer on Wait4IE > completing in 30 seconds. If 30 seconds elapses, kill_ie is called and > ie is made nothing, causing Wait4IE to complete with an error and > transfer control to label newie. I find "On Error Resume Next" > ineffective against errors in Application.OnTime. I zero killtime in > kill_ie so Application.OnTime is not called. If I hit escape to allow me > to save my XL file, Application.OnTime is called and errors. Why is > "On Error Resume Next" ineffective? If 30 seconds does not > elapse, the timer is cancelled without problem. I can't work out how to > make killduration a date. In the immediate debug window, I see > ?#00:00:30# 00:00:30 ?timevalue("00:00:30") 00:00:30 In the > debug code window, Private Const killduration As Date = #00:00:30# is > transformed into Private Const killduration As Date = #12:00:30 AM# As > an sside, many cells in my worksheet have a small triangle marking their > upper left corner. I remember that as meaning there is some strangeness > about the data in the marked cells. I just can't work out how to Google > it. excel cell warning message is ineffective. excel cell triangle > corner suggests a formula error and that a trace error button should > appear - it does not - the cells contain values. Unsetting > Tools/Options/Error checking/Number stored as text causes those > triangles to vanish and I now know what the issue is. How to I get > "Number stored as text" to appear as a warning? -- Walter > Briscoe Xin lá»—i thÃ*y cô đã luôn quan tâm vÃ* dạy tôi những Ä‘iá»u hay lẽ phải, dạy tôi những thứ không 1 admin nÃ*o có thể dạy em như: sống trên Ä‘á»i phải biết bao dung, nhân loại vá»›i nhau không nên thanh lá»c lẫn nhau, copy vÃ* paste lÃ* 2 thÃ*nh tá»±u khoa há»c hÃ*ng đầu thế giá»›i vÃ* được các chuyên gia hÃ*ng đầu vá» tin há»c tin dùng…. -- Tqlebvng514
[toc] | [prev] | [next] | [standalone]
| From | Tqlebvng514 <Thlebkng152@gmail.com> |
|---|---|
| Date | 2016-10-30 07:03 +0000 |
| Message-ID | <Tqlebvng514.125b5b68@excelbanter.com> |
| In reply to | #109489 |
Walter Briscoe;1626539 Wrote: > I am using XL 2003. I have a need to run Internet Explorer for about 20k > URLs. This is beyond the capacity of IE on my system. I use a 30 second > watchdog timer to detect IE becoming unreasonably slow. Relevant code > is: ' Needs Tools/References/Microsoft Internet Controls Public ie As > SHDocVw.InternetExplorer Private killtime As Date Private Const > killduration As String = "00:00:30" .... Private Sub kill_ie() > Debug.Print now & " kill_ie() called" killtime = 0 Set ie > = Nothing End Sub Public Function Wait4IEretry(ByVal operation As > String) As Boolean .... On Error GoTo newie .... killtime = now + > TimeValue(killduration) Application.OnTime EarliestTime:=killtime, > Procedu="kill_ie", Schedule:=True Wait4IE operation > Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", > Schedule:=False If False Then newie: If killtime <> 0 Then On > Error Resume Next ' ontime may not be set Application.OnTime > EarliestTime:=killtime, Procedu="kill_ie", Schedule:=False End > If Set ie = Nothing Resume retry Stop retry: ' Stop Wait4IEretry = False > Exit Function End If .... Wait4IEretry = True Exit Function ..... End > Function So Wait4IEretry starts a 3o second watchdog timer on Wait4IE > completing in 30 seconds. If 30 seconds elapses, kill_ie is called and > ie is made nothing, causing Wait4IE to complete with an error and > transfer control to label newie. I find "On Error Resume Next" > ineffective against errors in Application.OnTime. I zero killtime in > kill_ie so Application.OnTime is not called. If I hit escape to allow me > to save my XL file, Application.OnTime is called and errors. Why is > "On Error Resume Next" ineffective? If 30 seconds does not > elapse, the timer is cancelled without problem. I can't work out how to > make killduration a date. In the immediate debug window, I see > ?#00:00:30# 00:00:30 ?timevalue("00:00:30") 00:00:30 In the > debug code window, Private Const killduration As Date = #00:00:30# is > transformed into Private Const killduration As Date = #12:00:30 AM# As > an sside, many cells in my worksheet have a small triangle marking their > upper left corner. I remember that as meaning there is some strangeness > about the data in the marked cells. I just can't work out how to Google > it. excel cell warning message is ineffective. excel cell triangle > corner suggests a formula error and that a trace error button should > appear - it does not - the cells contain values. Unsetting > Tools/Options/Error checking/Number stored as text causes those > triangles to vanish and I now know what the issue is. How to I get > "Number stored as text" to appear as a warning? -- Walter > Briscoe Má»›i gá»i lên nhÃ* mạng há»i mạng hôm nay bị cái éo gì ấy, đăng stt facebook cả mấy tiếng rồi ko thấy ai like -- Tqlebvng514
[toc] | [prev] | [next] | [standalone]
| From | Tqlebvng514 <Thlebkng152@gmail.com> |
|---|---|
| Date | 2016-10-30 08:03 +0000 |
| Message-ID | <Tqlebvng514.125b697a@excelbanter.com> |
| In reply to | #109489 |
Walter Briscoe;1626539 Wrote: > I am using XL 2003. I have a need to run Internet Explorer for about 20k > URLs. This is beyond the capacity of IE on my system. I use a 30 second > watchdog timer to detect IE becoming unreasonably slow. Relevant code > is: ' Needs Tools/References/Microsoft Internet Controls Public ie As > SHDocVw.InternetExplorer Private killtime As Date Private Const > killduration As String = "00:00:30" .... Private Sub kill_ie() > Debug.Print now & " kill_ie() called" killtime = 0 Set ie > = Nothing End Sub Public Function Wait4IEretry(ByVal operation As > String) As Boolean .... On Error GoTo newie .... killtime = now + > TimeValue(killduration) Application.OnTime EarliestTime:=killtime, > Procedu="kill_ie", Schedule:=True Wait4IE operation > Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", > Schedule:=False If False Then newie: If killtime <> 0 Then On > Error Resume Next ' ontime may not be set Application.OnTime > EarliestTime:=killtime, Procedu="kill_ie", Schedule:=False End > If Set ie = Nothing Resume retry Stop retry: ' Stop Wait4IEretry = False > Exit Function End If .... Wait4IEretry = True Exit Function ..... End > Function So Wait4IEretry starts a 3o second watchdog timer on Wait4IE > completing in 30 seconds. If 30 seconds elapses, kill_ie is called and > ie is made nothing, causing Wait4IE to complete with an error and > transfer control to label newie. I find "On Error Resume Next" > ineffective against errors in Application.OnTime. I zero killtime in > kill_ie so Application.OnTime is not called. If I hit escape to allow me > to save my XL file, Application.OnTime is called and errors. Why is > "On Error Resume Next" ineffective? If 30 seconds does not > elapse, the timer is cancelled without problem. I can't work out how to > make killduration a date. In the immediate debug window, I see > ?#00:00:30# 00:00:30 ?timevalue("00:00:30") 00:00:30 In the > debug code window, Private Const killduration As Date = #00:00:30# is > transformed into Private Const killduration As Date = #12:00:30 AM# As > an sside, many cells in my worksheet have a small triangle marking their > upper left corner. I remember that as meaning there is some strangeness > about the data in the marked cells. I just can't work out how to Google > it. excel cell warning message is ineffective. excel cell triangle > corner suggests a formula error and that a trace error button should > appear - it does not - the cells contain values. Unsetting > Tools/Options/Error checking/Number stored as text causes those > triangles to vanish and I now know what the issue is. How to I get > "Number stored as text" to appear as a warning? -- Walter > Briscoe ÄÆ°á»£c lÃ*m cmt đầu tiên tôi cảm thấy rất lÃ* hạnh phúc vÃ* rất lÃ* hồi há»™p. -- Tqlebvng514
[toc] | [prev] | [next] | [standalone]
| From | Tqlebvng514 <Thlebkng152@gmail.com> |
|---|---|
| Date | 2016-10-30 11:04 +0000 |
| Message-ID | <Tqlebvng514.125b93a8@excelbanter.com> |
| In reply to | #109489 |
Walter Briscoe;1626539 Wrote: > I am using XL 2003. I have a need to run Internet Explorer for about 20k > URLs. This is beyond the capacity of IE on my system. I use a 30 second > watchdog timer to detect IE becoming unreasonably slow. Relevant code > is: ' Needs Tools/References/Microsoft Internet Controls Public ie As > SHDocVw.InternetExplorer Private killtime As Date Private Const > killduration As String = "00:00:30" .... Private Sub kill_ie() > Debug.Print now & " kill_ie() called" killtime = 0 Set ie > = Nothing End Sub Public Function Wait4IEretry(ByVal operation As > String) As Boolean .... On Error GoTo newie .... killtime = now + > TimeValue(killduration) Application.OnTime EarliestTime:=killtime, > Procedu="kill_ie", Schedule:=True Wait4IE operation > Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", > Schedule:=False If False Then newie: If killtime <> 0 Then On > Error Resume Next ' ontime may not be set Application.OnTime > EarliestTime:=killtime, Procedu="kill_ie", Schedule:=False End > If Set ie = Nothing Resume retry Stop retry: ' Stop Wait4IEretry = False > Exit Function End If .... Wait4IEretry = True Exit Function ..... End > Function So Wait4IEretry starts a 3o second watchdog timer on Wait4IE > completing in 30 seconds. If 30 seconds elapses, kill_ie is called and > ie is made nothing, causing Wait4IE to complete with an error and > transfer control to label newie. I find "On Error Resume Next" > ineffective against errors in Application.OnTime. I zero killtime in > kill_ie so Application.OnTime is not called. If I hit escape to allow me > to save my XL file, Application.OnTime is called and errors. Why is > "On Error Resume Next" ineffective? If 30 seconds does not > elapse, the timer is cancelled without problem. I can't work out how to > make killduration a date. In the immediate debug window, I see > ?#00:00:30# 00:00:30 ?timevalue("00:00:30") 00:00:30 In the > debug code window, Private Const killduration As Date = #00:00:30# is > transformed into Private Const killduration As Date = #12:00:30 AM# As > an sside, many cells in my worksheet have a small triangle marking their > upper left corner. I remember that as meaning there is some strangeness > about the data in the marked cells. I just can't work out how to Google > it. excel cell warning message is ineffective. excel cell triangle > corner suggests a formula error and that a trace error button should > appear - it does not - the cells contain values. Unsetting > Tools/Options/Error checking/Number stored as text causes those > triangles to vanish and I now know what the issue is. How to I get > "Number stored as text" to appear as a warning? -- Walter > Briscoe Ta từng nghÄ© mình lÃ* thiên hạ vô song, bao năm lăn lá»™i chốn giang hồ, công phu phun gió phóng bão tưởng chừng không tìm ra đối thá»§. Thế mÃ* tháº*t không ngá», má»›i rữa tay gác kiếm chưa lâu thì chốn giang hồ kia lại dáº*y lên bao tay cao thá»§, miệng dẽo má» dÃ*i lưỡi loe loa, quả lÃ* ghê gá»›m thay!. Äỉnh Côn Lôn chót vót phá»§ mây kia tưởng rằng lÃ* cao nhất, leo lên tá»›i rồi má»›i biết ê vÆ¡ rét còn cao hÆ¡n!, ngẫm chốn giang hồ cÅ©ng tháº*t bÃ* hiểm, các cao nhân dị lão như ngá»a hổ tÃ*ng long, quả tháº*t vê lá», vê lá» ! -- Tqlebvng514
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | microsoft.public.excel.programming
csiph-web