jwcolby
jwcolby at colbyconsulting.com
Sat Apr 23 10:10:28 CDT 2011
> ...and that is a whole different subject/environment/topic. ASP.Net would be your best all around solution. Uh... this kind of thing needs to be done many different places. It is rarely about "pick your tool to do this", rather "this app uses X tool, how do I do it there". This app uses Access / VBA. How do I do it there? Telling me to go off and rewrite my app in some other tool so that I can use that tool to do one tiny piece is... draconian. It turns out that there is an IE object which knows how to do most of this kind of thing, and can be automated from VBA. It is really a matter of studying that long enough to figure it out. John W. Colby www.ColbyConsulting.com On 4/23/2011 10:18 AM, Jim Lawrence wrote: > Hi John: > > It is done via a process call screen-scraping and it can only be done using > webbased programs like PHP, Java, ASP, ASP.Net, JavaScript etc... > > ...and that is a whole different subject/environment/topic. ASP.Net would be > your best all around solution. > > Jim > > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Friday, April 22, 2011 11:14 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] How do I Grab the picture from the web page > > Has anyone here ever figured out how to early bind the WebBrowser activeX > object? > > John W. Colby > www.ColbyConsulting.com > > On 4/22/2011 10:40 AM, Michael Mattys wrote: >> John, >> >> OK, I think the best way to approach this is for you to visit >> http://www.w3schools.com/HTMLDOM/dom_nodes_access.asp >> >> It took me an hour or two to get the right elements for my project >> and then lots more to loop through the relevant tables, rows, >> childnodes, and cells to get the right info. >> >> Basically, you want the href of the image and then it's a simple >> binary save object to file, thus >> >> http://www.devx.com/vb2themax/Tip/18441 >> >> >> Michael R Mattys >> Business Process Developers >> www.mattysconsulting.com >> >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby >> Sent: Friday, April 22, 2011 9:35 AM >> To: Access Developers discussion and problem solving >> Subject: Re: [AccessD] How do I Grab the picture from the web page >> >> Michael, >> >> Thanks. The web page I navigate to is as follows: >> >> > http://webapps6.doc.state.nc.us/opi/viewoffender.do?method=view&offenderID=1 >> > 119894&searchOffenderId=1119894&listurl=pagelistoffendersearchresults&listpa >> ge=1 >> >> I literally replace the offenderID with the ID (called an OPUS number) of >> the inmate I am viewing or obtaining the record for. >> >> What you are viewing if you go to this link is an actual record of some >> inmate. Open this web page to view the html behind. >> >> Notice that the picture is obscured, with a "click to show photo" which I >> assume is actually a button? >> >> It is not that I need to get one or even several photos. I need the > *code* >> to do it from VBA, and I need to learn how it is done so I can do it again >> by myself. >> >> I would prefer to actually retrieve the photo to a file stored on disk, >> however I also want to learn how to click buttons (and enter data). >> >> The following is the actual search website. >> >> http://webapps6.doc.state.nc.us/opi/offendersearch.do?method=view >> >> I don't need it for this project because I can do a simple replace of the >> OPUS ID in that first string, but it would be good (for another project) > to >> know how I insert data into the controls and click the search button, how > to >> click the Clear Selection button etc. >> >> I currently use an ActiveX control inserted into a subform to retrieve >> pages, get the table collection etc. The web control is found by clicking >> the ellipsis in the toolbox bar in form design and going down until you >> find the Microsoft Web Browser control. >> >> I have found code in Google to do this other ways but this is the way I > have >> managed to get working. >> I wrote a class "wrapper" with methods that I call to parse out the > data. >> It is ugly but they apparently did not program the web site in a "nice" >> manner, tables just have one big long string etc. the following is the > code >> that I use to poke through the dozens of tables they use. >> >> Again, there might be an easier way but this is how I got it working. >> >> Function mSearchTable(wbbWebsite As Object) >> >> Dim varTables As Variant >> Dim varTable As Variant >> >> Dim strOffenderInfo As String >> Dim strMostRecent As String >> >> >> Set varTables = wbbWebsite.Document.All().tags("table") >> Set varTables = wbbWebsite.Document.All.tags("TABLE") >> For Each varTable In varTables >> >> Dim strInnerText As String >> strInnerText = varTable.innerText >> 'Use the innerText to see if this is the table we want. >> 'Debug.Print varTable.innerText >> >> If (InStr(strInnerText, "Offender Information")) And (Not >> mblnOffenderInfoFound) Then >> strOffenderInfo = strInnerText >> mParseInfoOffender strInnerText >> Else >> If (InStr(strInnerText, "Most Recent Incarceration Summary ")) And > (Not >> mblnMostRecentInfoFound) Then >> strMostRecent = strInnerText >> mParseMostRecent strMostRecent >> End If >> >> End If >> Next varTable >> >> End Function >> >> So what I need is not a fish, but to learn *how* to fish. >> >> Any assistance gratefully accepted. >> >> John W. Colby >> www.ColbyConsulting.com >> >> On 4/22/2011 9:06 AM, Michael Mattys wrote: >>> Hi John, >>> >>> I've just finished a similar project for downloading all pdf and xls >>> from a site and the iron is still hot. >>> >>> I know its volunteer - just send the relevant access info to my >>> address and I'll get your pics for you. >>> >>> Michael R Mattys >>> Business Process Developers >>> www.mattysconsulting.com >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >>