From jwcolby at colbyconsulting.com Tue Apr 26 09:10:51 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Tue, 26 Apr 2005 10:10:51 -0400 Subject: [dba-VB] Pushing data to a web page Message-ID: <001201c54a69$c4cfc760$6c7aa8c0@ColbyM6805> Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From DWUTKA at marlow.com Tue Apr 26 09:36:14 2005 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Tue, 26 Apr 2005 09:36:14 -0500 Subject: [dba-VB] Pushing data to a web page Message-ID: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From pharold at proftesting.com Wed Apr 27 11:51:14 2005 From: pharold at proftesting.com (Perry Harold) Date: Wed, 27 Apr 2005 12:51:14 -0400 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Message-ID: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> Drew Do you perhaps have a sample of going the other way - Retrieving from a web page? I regularly access a site to retrieve data for one of my databases. Go to main page - select by an id number and then clip some of the data. Would like to automate if possible. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, April 26, 2005 10:36 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From stuart at lexacorp.com.pg Wed Apr 27 12:50:48 2005 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 28 Apr 2005 03:50:48 +1000 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> References: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Message-ID: <42705D98.13804.107CF3E7@stuart.lexacorp.com.pg> On 27 Apr 2005 at 12:51, Perry Harold wrote: > Drew > > Do you perhaps have a sample of going the other way - Retrieving from a web > page? I regularly access a site to retrieve data for one of my databases. > Go to main page - select by an id number and then clip some of the data. > Would like to automate if possible. > For automating writing to or reading from webpages or any other application, IMHO the best solution is to use a tool designed specifically for that type of operation rather than trying to cobble something together in VB or whatever. Take a look at AutoIt http://www.autoitscript.com/autoit3/ The latest version includes a DLL/COM control so that you can add AutoIt features to your VB applications -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. From DWUTKA at marlow.com Wed Apr 27 12:58:37 2005 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Wed, 27 Apr 2005 12:58:37 -0500 Subject: [dba-VB] Pushing data to a web page Message-ID: <123701F54509D9119A4F00D0B747349016D3D6@main2.marlow.com> Sure, my example could work both ways. It's actually pretty easy. To pull data off, you have two options, though. Option 1 is to pull it from a browser. This is handy if the data is already segmented out the way you want. To pull it from a browser, just create a browser object, and navigate to the site you want data from. Then loop through the browser's document object, to grab the data within the document's objects. That's pretty easy. Just open the source of the page, and use the various control names to get the values. Option 2 is faster, and easier to code, but a little more difficult to 'sort out' the data. You can use API calls to directly download the web page, then with a little string manipulation, you can pull the data out. Drew -----Original Message----- From: Perry Harold [mailto:pharold at proftesting.com] Sent: Wednesday, April 27, 2005 11:51 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Drew Do you perhaps have a sample of going the other way - Retrieving from a web page? I regularly access a site to retrieve data for one of my databases. Go to main page - select by an id number and then clip some of the data. Would like to automate if possible. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, April 26, 2005 10:36 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From martyconnelly at shaw.ca Wed Apr 27 14:57:29 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Wed, 27 Apr 2005 12:57:29 -0700 Subject: [dba-VB] Pushing data to a web page References: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> Message-ID: <426FEEA9.4020103@shaw.ca> You can do this with xmlhttp and web scraping, you just have to know how the web post form works just find the submission button name and textbox name from the html source From this movie web form the select button is named "select" and the text box "for" Then add to Send in xml call All this code below is equivalent to the url http://www.imdb.com/Find?select=All&for="Sahara" Then run code below to dump to an html file or string which can be parsed. This won't work if the html changes or the site obfuscates the form to stop this with page redirects. partial HTML source from "http://www.imdb.com/Find"
 
'FindMovie ("Sahara") Public Function FindMovie(strTitle As String) As String ' Dim oHttp As MSXML2.XMLHTTP Dim oHttp As Object Dim strFileNameH As String Dim strFileNameT As String Dim strSend As String Dim strSubmit As String Dim strStockName As String 'make use of the XMLHTTPRequest object contained in msxml.dll Set oHttp = CreateObject("Microsoft.XMLHTTP") ' Set oHttp = CreateObject("MSXML2.XMLHTTP") 'set according to form type 'oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'oHttp.setRequestHeader "Content-Type", "text/xml" 'oHttp.setRequestHeader "Content-Type", "multipart/form-data" oHttp.Open "POST", "http://www.imdb.com/Find", False oHttp.send "select=All&for=" & strTitle 'oHttp.send (strSend) ' oHttp.send Debug.Print "strSend=" & strSend 'check the feedback Debug.Print "Ready State =" & oHttp.readyState 'normal state =4 Debug.Print "Status =" & oHttp.status 'normal status = 200 ' Debug.Print "Status Text =" & oHttp.statusText Debug.Print oHttp.getAllResponseHeaders() 'Debug.Print "Response Body =" & oHttp.responseBody ' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode) 'Debug.Print "Response Text =" & oHttp.responseText 'Parse response text string here or send to file strFileNameH = "c:\Accesshtmlstealer\Amazon" strFileNameH = strFileNameH & Format(Now, "yyyymmddhhmmss") & ".htm" WriteFile strFileNameH, oHttp.responseText ' HypeLinkFile strFileNameH strFileNameT = "c:\Accesshtmlstealer\Amazon" strFileNameT = strFileNameT & Format(Now, "yyyymmddhhmmss") & ".txt" WriteFile strFileNameT, oHttp.responseText ' FindMovie = strFileNameH Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & Err.Number ' Resume Next End Function Public Sub WriteFile(ByVal sFileName As String, ByVal sContents As String) ' Dump XML String to File for debugging Dim fhFile As Integer fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Output As #fhFile Print #fhFile, sContents; Close #fhFile Debug.Print "Out File" & sFileName End Sub Public Sub ReadFile(ByVal sFileName As String, ByRef sContents As String) ' Dump XML String to File for debugging Dim strLine As String Dim intLine As Long Dim fhFile As Integer intLine = 0 sContents = "" fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Input As #fhFile Do While Not EOF(1) ' Loop until end of file. Input #1, strLine ' Read data intLine = intLine + 1 sContents = sContents & strLine 'Debug.Print sContents ' Print data to Debug window. Loop Close #fhFile ' Close file. Debug.Print "Input File" & sFileName & " lines=" & intLine End Sub Perry Harold wrote: >Drew > >Do you perhaps have a sample of going the other way - Retrieving from a web >page? I regularly access a site to retrieve data for one of my databases. >Go to main page - select by an id number and then clip some of the data. >Would like to automate if possible. > >Perry Harold > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com >Sent: Tuesday, April 26, 2005 10:36 AM >To: dba-vb at databaseadvisors.com >Subject: RE: [dba-VB] Pushing data to a web page > > >Just sent you an example offlist. > >Drew > >-----Original Message----- >From: John W. Colby [mailto:jwcolby at colbyconsulting.com] >Sent: Tuesday, April 26, 2005 9:11 AM >To: 'Access Developers discussion and problem solving'; VBA >Subject: [dba-VB] Pushing data to a web page > > >Does anyone know how to manipulate a web page from VB/VB.net? I need to >place values in text boxes, click radio buttons, click command buttons etc. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Thu Apr 28 11:05:01 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 28 Apr 2005 09:05:01 -0700 Subject: [dba-VB] VB.Net expert In-Reply-To: <426FEEA9.4020103@shaw.ca> Message-ID: <0IFN00728ZCAVV@l-daemon> Hi All: A fellow developer has got himself into a bit of a bind with having to just 'display' an existing project that was written in VB.Net. The references do not all work and I just could not help resolving the issues. There is a dead-line of Friday...Yeh Friday. He will pay at a negotiable rate. Anyone in the Victoria/Vancouver area preferred but a remote talent would be acceptable. TIA Jim From martyconnelly at shaw.ca Thu Apr 28 14:12:19 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 28 Apr 2005 12:12:19 -0700 Subject: [dba-VB] VB.Net expert References: <0IFN00728ZCAVV@l-daemon> Message-ID: <42713593.5090500@shaw.ca> Just some maybes It is possible he has copied something into his project with the same name, and end up with confusing situations (for instance, it is very logical to call a Dataset "customers" when that Dataset deals with customers, but then you'll be tempted to name it's helper class "customer" as well, because that class also deals with customers. I know it's annoying, but I'ld stick with "dsCustomers", "clsCustomers",. If you have duplicate names,somehow. When loading a project, the IDE cannot warn you nicely like it does when you compile/deploy a project : if it sees duplicate/ambiguous names, it has to handle them in any way it sees fit, and that often means removing one of the references. Remember that it can remove object/methods from your code, because as much as it can generate code, it can also remove it (that is what it does when you remove a control from the designer : it removes the corresponding lines of code from the code-behind). Also check if auto-generate has been ticked off , to fire when you press F5 sometimes it gets unchecked. Check if the project folder is read-only, remove the read-only attribute of project or bin folder. try to rename/delete the .pdb file also. see if it works . These debugging files can get out of sync. Jim Lawrence wrote: >Hi All: > >A fellow developer has got himself into a bit of a bind with having to just >'display' an existing project that was written in VB.Net. The references do >not all work and I just could not help resolving the issues. There is a >dead-line of Friday...Yeh Friday. > >He will pay at a negotiable rate. > >Anyone in the Victoria/Vancouver area preferred but a remote talent would be >acceptable. > >TIA >Jim > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Thu Apr 28 15:36:31 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 28 Apr 2005 13:36:31 -0700 Subject: [dba-VB] VB.Net expert In-Reply-To: <42713593.5090500@shaw.ca> Message-ID: <0IFO00KOIBWVWJ@l-daemon> Hi Marty: Thanks for the information and I have passed it along and hope that it helps. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Thursday, April 28, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] VB.Net expert Just some maybes It is possible he has copied something into his project with the same name, and end up with confusing situations (for instance, it is very logical to call a Dataset "customers" when that Dataset deals with customers, but then you'll be tempted to name it's helper class "customer" as well, because that class also deals with customers. I know it's annoying, but I'ld stick with "dsCustomers", "clsCustomers",. If you have duplicate names,somehow. When loading a project, the IDE cannot warn you nicely like it does when you compile/deploy a project : if it sees duplicate/ambiguous names, it has to handle them in any way it sees fit, and that often means removing one of the references. Remember that it can remove object/methods from your code, because as much as it can generate code, it can also remove it (that is what it does when you remove a control from the designer : it removes the corresponding lines of code from the code-behind). Also check if auto-generate has been ticked off , to fire when you press F5 sometimes it gets unchecked. Check if the project folder is read-only, remove the read-only attribute of project or bin folder. try to rename/delete the .pdb file also. see if it works . These debugging files can get out of sync. Jim Lawrence wrote: >Hi All: > >A fellow developer has got himself into a bit of a bind with having to just >'display' an existing project that was written in VB.Net. The references do >not all work and I just could not help resolving the issues. There is a >dead-line of Friday...Yeh Friday. > >He will pay at a negotiable rate. > >Anyone in the Victoria/Vancouver area preferred but a remote talent would be >acceptable. > >TIA >Jim > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From pharold at proftesting.com Fri Apr 29 13:48:12 2005 From: pharold at proftesting.com (Perry Harold) Date: Fri, 29 Apr 2005 14:48:12 -0400 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <426FEEA9.4020103@shaw.ca> Message-ID: <000601c54ceb$ff63c000$192da8c0@D58BT131Perry> Marty, Stuart, Drew Thanks for the help. Guess I have to find time to get it up and running now. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Wednesday, April 27, 2005 3:57 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Pushing data to a web page You can do this with xmlhttp and web scraping, you just have to know how the web post form works just find the submission button name and textbox name from the html source >From this movie web form the select button is named "select" and the text box "for" Then add to Send in xml call All this code below is equivalent to the url http://www.imdb.com/Find?select=All&for="Sahara" Then run code below to dump to an html file or string which can be parsed. This won't work if the html changes or the site obfuscates the form to stop this with page redirects. partial HTML source from "http://www.imdb.com/Find"
 
'FindMovie ("Sahara") Public Function FindMovie(strTitle As String) As String ' Dim oHttp As MSXML2.XMLHTTP Dim oHttp As Object Dim strFileNameH As String Dim strFileNameT As String Dim strSend As String Dim strSubmit As String Dim strStockName As String 'make use of the XMLHTTPRequest object contained in msxml.dll Set oHttp = CreateObject("Microsoft.XMLHTTP") ' Set oHttp = CreateObject("MSXML2.XMLHTTP") 'set according to form type 'oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'oHttp.setRequestHeader "Content-Type", "text/xml" 'oHttp.setRequestHeader "Content-Type", "multipart/form-data" oHttp.Open "POST", "http://www.imdb.com/Find", False oHttp.send "select=All&for=" & strTitle 'oHttp.send (strSend) ' oHttp.send Debug.Print "strSend=" & strSend 'check the feedback Debug.Print "Ready State =" & oHttp.readyState 'normal state =4 Debug.Print "Status =" & oHttp.status 'normal status = 200 ' Debug.Print "Status Text =" & oHttp.statusText Debug.Print oHttp.getAllResponseHeaders() 'Debug.Print "Response Body =" & oHttp.responseBody ' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode) 'Debug.Print "Response Text =" & oHttp.responseText 'Parse response text string here or send to file strFileNameH = "c:\Accesshtmlstealer\Amazon" strFileNameH = strFileNameH & Format(Now, "yyyymmddhhmmss") & ".htm" WriteFile strFileNameH, oHttp.responseText ' HypeLinkFile strFileNameH strFileNameT = "c:\Accesshtmlstealer\Amazon" strFileNameT = strFileNameT & Format(Now, "yyyymmddhhmmss") & ".txt" WriteFile strFileNameT, oHttp.responseText ' FindMovie = strFileNameH Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & Err.Number ' Resume Next End Function Public Sub WriteFile(ByVal sFileName As String, ByVal sContents As String) ' Dump XML String to File for debugging Dim fhFile As Integer fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Output As #fhFile Print #fhFile, sContents; Close #fhFile Debug.Print "Out File" & sFileName End Sub Public Sub ReadFile(ByVal sFileName As String, ByRef sContents As String) ' Dump XML String to File for debugging Dim strLine As String Dim intLine As Long Dim fhFile As Integer intLine = 0 sContents = "" fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Input As #fhFile Do While Not EOF(1) ' Loop until end of file. Input #1, strLine ' Read data intLine = intLine + 1 sContents = sContents & strLine 'Debug.Print sContents ' Print data to Debug window. Loop Close #fhFile ' Close file. Debug.Print "Input File" & sFileName & " lines=" & intLine End Sub Perry Harold wrote: >Drew > >Do you perhaps have a sample of going the other way - Retrieving from a >web page? I regularly access a site to retrieve data for one of my >databases. Go to main page - select by an id number and then clip some >of the data. Would like to automate if possible. > >Perry Harold > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of >DWUTKA at marlow.com >Sent: Tuesday, April 26, 2005 10:36 AM >To: dba-vb at databaseadvisors.com >Subject: RE: [dba-VB] Pushing data to a web page > > >Just sent you an example offlist. > >Drew > >-----Original Message----- >From: John W. Colby [mailto:jwcolby at colbyconsulting.com] >Sent: Tuesday, April 26, 2005 9:11 AM >To: 'Access Developers discussion and problem solving'; VBA >Subject: [dba-VB] Pushing data to a web page > > >Does anyone know how to manipulate a web page from VB/VB.net? I need >to place values in text boxes, click radio buttons, click command >buttons etc. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Apr 26 09:10:51 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Tue, 26 Apr 2005 10:10:51 -0400 Subject: [dba-VB] Pushing data to a web page Message-ID: <001201c54a69$c4cfc760$6c7aa8c0@ColbyM6805> Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From DWUTKA at marlow.com Tue Apr 26 09:36:14 2005 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Tue, 26 Apr 2005 09:36:14 -0500 Subject: [dba-VB] Pushing data to a web page Message-ID: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From pharold at proftesting.com Wed Apr 27 11:51:14 2005 From: pharold at proftesting.com (Perry Harold) Date: Wed, 27 Apr 2005 12:51:14 -0400 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Message-ID: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> Drew Do you perhaps have a sample of going the other way - Retrieving from a web page? I regularly access a site to retrieve data for one of my databases. Go to main page - select by an id number and then clip some of the data. Would like to automate if possible. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, April 26, 2005 10:36 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From stuart at lexacorp.com.pg Wed Apr 27 12:50:48 2005 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 28 Apr 2005 03:50:48 +1000 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> References: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Message-ID: <42705D98.13804.107CF3E7@stuart.lexacorp.com.pg> On 27 Apr 2005 at 12:51, Perry Harold wrote: > Drew > > Do you perhaps have a sample of going the other way - Retrieving from a web > page? I regularly access a site to retrieve data for one of my databases. > Go to main page - select by an id number and then clip some of the data. > Would like to automate if possible. > For automating writing to or reading from webpages or any other application, IMHO the best solution is to use a tool designed specifically for that type of operation rather than trying to cobble something together in VB or whatever. Take a look at AutoIt http://www.autoitscript.com/autoit3/ The latest version includes a DLL/COM control so that you can add AutoIt features to your VB applications -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. From DWUTKA at marlow.com Wed Apr 27 12:58:37 2005 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Wed, 27 Apr 2005 12:58:37 -0500 Subject: [dba-VB] Pushing data to a web page Message-ID: <123701F54509D9119A4F00D0B747349016D3D6@main2.marlow.com> Sure, my example could work both ways. It's actually pretty easy. To pull data off, you have two options, though. Option 1 is to pull it from a browser. This is handy if the data is already segmented out the way you want. To pull it from a browser, just create a browser object, and navigate to the site you want data from. Then loop through the browser's document object, to grab the data within the document's objects. That's pretty easy. Just open the source of the page, and use the various control names to get the values. Option 2 is faster, and easier to code, but a little more difficult to 'sort out' the data. You can use API calls to directly download the web page, then with a little string manipulation, you can pull the data out. Drew -----Original Message----- From: Perry Harold [mailto:pharold at proftesting.com] Sent: Wednesday, April 27, 2005 11:51 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Drew Do you perhaps have a sample of going the other way - Retrieving from a web page? I regularly access a site to retrieve data for one of my databases. Go to main page - select by an id number and then clip some of the data. Would like to automate if possible. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, April 26, 2005 10:36 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From martyconnelly at shaw.ca Wed Apr 27 14:57:29 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Wed, 27 Apr 2005 12:57:29 -0700 Subject: [dba-VB] Pushing data to a web page References: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> Message-ID: <426FEEA9.4020103@shaw.ca> You can do this with xmlhttp and web scraping, you just have to know how the web post form works just find the submission button name and textbox name from the html source From this movie web form the select button is named "select" and the text box "for" Then add to Send in xml call All this code below is equivalent to the url http://www.imdb.com/Find?select=All&for="Sahara" Then run code below to dump to an html file or string which can be parsed. This won't work if the html changes or the site obfuscates the form to stop this with page redirects. partial HTML source from "http://www.imdb.com/Find"
 
'FindMovie ("Sahara") Public Function FindMovie(strTitle As String) As String ' Dim oHttp As MSXML2.XMLHTTP Dim oHttp As Object Dim strFileNameH As String Dim strFileNameT As String Dim strSend As String Dim strSubmit As String Dim strStockName As String 'make use of the XMLHTTPRequest object contained in msxml.dll Set oHttp = CreateObject("Microsoft.XMLHTTP") ' Set oHttp = CreateObject("MSXML2.XMLHTTP") 'set according to form type 'oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'oHttp.setRequestHeader "Content-Type", "text/xml" 'oHttp.setRequestHeader "Content-Type", "multipart/form-data" oHttp.Open "POST", "http://www.imdb.com/Find", False oHttp.send "select=All&for=" & strTitle 'oHttp.send (strSend) ' oHttp.send Debug.Print "strSend=" & strSend 'check the feedback Debug.Print "Ready State =" & oHttp.readyState 'normal state =4 Debug.Print "Status =" & oHttp.status 'normal status = 200 ' Debug.Print "Status Text =" & oHttp.statusText Debug.Print oHttp.getAllResponseHeaders() 'Debug.Print "Response Body =" & oHttp.responseBody ' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode) 'Debug.Print "Response Text =" & oHttp.responseText 'Parse response text string here or send to file strFileNameH = "c:\Accesshtmlstealer\Amazon" strFileNameH = strFileNameH & Format(Now, "yyyymmddhhmmss") & ".htm" WriteFile strFileNameH, oHttp.responseText ' HypeLinkFile strFileNameH strFileNameT = "c:\Accesshtmlstealer\Amazon" strFileNameT = strFileNameT & Format(Now, "yyyymmddhhmmss") & ".txt" WriteFile strFileNameT, oHttp.responseText ' FindMovie = strFileNameH Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & Err.Number ' Resume Next End Function Public Sub WriteFile(ByVal sFileName As String, ByVal sContents As String) ' Dump XML String to File for debugging Dim fhFile As Integer fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Output As #fhFile Print #fhFile, sContents; Close #fhFile Debug.Print "Out File" & sFileName End Sub Public Sub ReadFile(ByVal sFileName As String, ByRef sContents As String) ' Dump XML String to File for debugging Dim strLine As String Dim intLine As Long Dim fhFile As Integer intLine = 0 sContents = "" fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Input As #fhFile Do While Not EOF(1) ' Loop until end of file. Input #1, strLine ' Read data intLine = intLine + 1 sContents = sContents & strLine 'Debug.Print sContents ' Print data to Debug window. Loop Close #fhFile ' Close file. Debug.Print "Input File" & sFileName & " lines=" & intLine End Sub Perry Harold wrote: >Drew > >Do you perhaps have a sample of going the other way - Retrieving from a web >page? I regularly access a site to retrieve data for one of my databases. >Go to main page - select by an id number and then clip some of the data. >Would like to automate if possible. > >Perry Harold > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com >Sent: Tuesday, April 26, 2005 10:36 AM >To: dba-vb at databaseadvisors.com >Subject: RE: [dba-VB] Pushing data to a web page > > >Just sent you an example offlist. > >Drew > >-----Original Message----- >From: John W. Colby [mailto:jwcolby at colbyconsulting.com] >Sent: Tuesday, April 26, 2005 9:11 AM >To: 'Access Developers discussion and problem solving'; VBA >Subject: [dba-VB] Pushing data to a web page > > >Does anyone know how to manipulate a web page from VB/VB.net? I need to >place values in text boxes, click radio buttons, click command buttons etc. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Thu Apr 28 11:05:01 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 28 Apr 2005 09:05:01 -0700 Subject: [dba-VB] VB.Net expert In-Reply-To: <426FEEA9.4020103@shaw.ca> Message-ID: <0IFN00728ZCAVV@l-daemon> Hi All: A fellow developer has got himself into a bit of a bind with having to just 'display' an existing project that was written in VB.Net. The references do not all work and I just could not help resolving the issues. There is a dead-line of Friday...Yeh Friday. He will pay at a negotiable rate. Anyone in the Victoria/Vancouver area preferred but a remote talent would be acceptable. TIA Jim From martyconnelly at shaw.ca Thu Apr 28 14:12:19 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 28 Apr 2005 12:12:19 -0700 Subject: [dba-VB] VB.Net expert References: <0IFN00728ZCAVV@l-daemon> Message-ID: <42713593.5090500@shaw.ca> Just some maybes It is possible he has copied something into his project with the same name, and end up with confusing situations (for instance, it is very logical to call a Dataset "customers" when that Dataset deals with customers, but then you'll be tempted to name it's helper class "customer" as well, because that class also deals with customers. I know it's annoying, but I'ld stick with "dsCustomers", "clsCustomers",. If you have duplicate names,somehow. When loading a project, the IDE cannot warn you nicely like it does when you compile/deploy a project : if it sees duplicate/ambiguous names, it has to handle them in any way it sees fit, and that often means removing one of the references. Remember that it can remove object/methods from your code, because as much as it can generate code, it can also remove it (that is what it does when you remove a control from the designer : it removes the corresponding lines of code from the code-behind). Also check if auto-generate has been ticked off , to fire when you press F5 sometimes it gets unchecked. Check if the project folder is read-only, remove the read-only attribute of project or bin folder. try to rename/delete the .pdb file also. see if it works . These debugging files can get out of sync. Jim Lawrence wrote: >Hi All: > >A fellow developer has got himself into a bit of a bind with having to just >'display' an existing project that was written in VB.Net. The references do >not all work and I just could not help resolving the issues. There is a >dead-line of Friday...Yeh Friday. > >He will pay at a negotiable rate. > >Anyone in the Victoria/Vancouver area preferred but a remote talent would be >acceptable. > >TIA >Jim > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Thu Apr 28 15:36:31 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 28 Apr 2005 13:36:31 -0700 Subject: [dba-VB] VB.Net expert In-Reply-To: <42713593.5090500@shaw.ca> Message-ID: <0IFO00KOIBWVWJ@l-daemon> Hi Marty: Thanks for the information and I have passed it along and hope that it helps. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Thursday, April 28, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] VB.Net expert Just some maybes It is possible he has copied something into his project with the same name, and end up with confusing situations (for instance, it is very logical to call a Dataset "customers" when that Dataset deals with customers, but then you'll be tempted to name it's helper class "customer" as well, because that class also deals with customers. I know it's annoying, but I'ld stick with "dsCustomers", "clsCustomers",. If you have duplicate names,somehow. When loading a project, the IDE cannot warn you nicely like it does when you compile/deploy a project : if it sees duplicate/ambiguous names, it has to handle them in any way it sees fit, and that often means removing one of the references. Remember that it can remove object/methods from your code, because as much as it can generate code, it can also remove it (that is what it does when you remove a control from the designer : it removes the corresponding lines of code from the code-behind). Also check if auto-generate has been ticked off , to fire when you press F5 sometimes it gets unchecked. Check if the project folder is read-only, remove the read-only attribute of project or bin folder. try to rename/delete the .pdb file also. see if it works . These debugging files can get out of sync. Jim Lawrence wrote: >Hi All: > >A fellow developer has got himself into a bit of a bind with having to just >'display' an existing project that was written in VB.Net. The references do >not all work and I just could not help resolving the issues. There is a >dead-line of Friday...Yeh Friday. > >He will pay at a negotiable rate. > >Anyone in the Victoria/Vancouver area preferred but a remote talent would be >acceptable. > >TIA >Jim > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From pharold at proftesting.com Fri Apr 29 13:48:12 2005 From: pharold at proftesting.com (Perry Harold) Date: Fri, 29 Apr 2005 14:48:12 -0400 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <426FEEA9.4020103@shaw.ca> Message-ID: <000601c54ceb$ff63c000$192da8c0@D58BT131Perry> Marty, Stuart, Drew Thanks for the help. Guess I have to find time to get it up and running now. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Wednesday, April 27, 2005 3:57 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Pushing data to a web page You can do this with xmlhttp and web scraping, you just have to know how the web post form works just find the submission button name and textbox name from the html source >From this movie web form the select button is named "select" and the text box "for" Then add to Send in xml call All this code below is equivalent to the url http://www.imdb.com/Find?select=All&for="Sahara" Then run code below to dump to an html file or string which can be parsed. This won't work if the html changes or the site obfuscates the form to stop this with page redirects. partial HTML source from "http://www.imdb.com/Find"
 
'FindMovie ("Sahara") Public Function FindMovie(strTitle As String) As String ' Dim oHttp As MSXML2.XMLHTTP Dim oHttp As Object Dim strFileNameH As String Dim strFileNameT As String Dim strSend As String Dim strSubmit As String Dim strStockName As String 'make use of the XMLHTTPRequest object contained in msxml.dll Set oHttp = CreateObject("Microsoft.XMLHTTP") ' Set oHttp = CreateObject("MSXML2.XMLHTTP") 'set according to form type 'oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'oHttp.setRequestHeader "Content-Type", "text/xml" 'oHttp.setRequestHeader "Content-Type", "multipart/form-data" oHttp.Open "POST", "http://www.imdb.com/Find", False oHttp.send "select=All&for=" & strTitle 'oHttp.send (strSend) ' oHttp.send Debug.Print "strSend=" & strSend 'check the feedback Debug.Print "Ready State =" & oHttp.readyState 'normal state =4 Debug.Print "Status =" & oHttp.status 'normal status = 200 ' Debug.Print "Status Text =" & oHttp.statusText Debug.Print oHttp.getAllResponseHeaders() 'Debug.Print "Response Body =" & oHttp.responseBody ' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode) 'Debug.Print "Response Text =" & oHttp.responseText 'Parse response text string here or send to file strFileNameH = "c:\Accesshtmlstealer\Amazon" strFileNameH = strFileNameH & Format(Now, "yyyymmddhhmmss") & ".htm" WriteFile strFileNameH, oHttp.responseText ' HypeLinkFile strFileNameH strFileNameT = "c:\Accesshtmlstealer\Amazon" strFileNameT = strFileNameT & Format(Now, "yyyymmddhhmmss") & ".txt" WriteFile strFileNameT, oHttp.responseText ' FindMovie = strFileNameH Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & Err.Number ' Resume Next End Function Public Sub WriteFile(ByVal sFileName As String, ByVal sContents As String) ' Dump XML String to File for debugging Dim fhFile As Integer fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Output As #fhFile Print #fhFile, sContents; Close #fhFile Debug.Print "Out File" & sFileName End Sub Public Sub ReadFile(ByVal sFileName As String, ByRef sContents As String) ' Dump XML String to File for debugging Dim strLine As String Dim intLine As Long Dim fhFile As Integer intLine = 0 sContents = "" fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Input As #fhFile Do While Not EOF(1) ' Loop until end of file. Input #1, strLine ' Read data intLine = intLine + 1 sContents = sContents & strLine 'Debug.Print sContents ' Print data to Debug window. Loop Close #fhFile ' Close file. Debug.Print "Input File" & sFileName & " lines=" & intLine End Sub Perry Harold wrote: >Drew > >Do you perhaps have a sample of going the other way - Retrieving from a >web page? I regularly access a site to retrieve data for one of my >databases. Go to main page - select by an id number and then clip some >of the data. Would like to automate if possible. > >Perry Harold > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of >DWUTKA at marlow.com >Sent: Tuesday, April 26, 2005 10:36 AM >To: dba-vb at databaseadvisors.com >Subject: RE: [dba-VB] Pushing data to a web page > > >Just sent you an example offlist. > >Drew > >-----Original Message----- >From: John W. Colby [mailto:jwcolby at colbyconsulting.com] >Sent: Tuesday, April 26, 2005 9:11 AM >To: 'Access Developers discussion and problem solving'; VBA >Subject: [dba-VB] Pushing data to a web page > > >Does anyone know how to manipulate a web page from VB/VB.net? I need >to place values in text boxes, click radio buttons, click command >buttons etc. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Apr 26 09:10:51 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Tue, 26 Apr 2005 10:10:51 -0400 Subject: [dba-VB] Pushing data to a web page Message-ID: <001201c54a69$c4cfc760$6c7aa8c0@ColbyM6805> Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From DWUTKA at marlow.com Tue Apr 26 09:36:14 2005 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Tue, 26 Apr 2005 09:36:14 -0500 Subject: [dba-VB] Pushing data to a web page Message-ID: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From pharold at proftesting.com Wed Apr 27 11:51:14 2005 From: pharold at proftesting.com (Perry Harold) Date: Wed, 27 Apr 2005 12:51:14 -0400 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Message-ID: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> Drew Do you perhaps have a sample of going the other way - Retrieving from a web page? I regularly access a site to retrieve data for one of my databases. Go to main page - select by an id number and then clip some of the data. Would like to automate if possible. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, April 26, 2005 10:36 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From stuart at lexacorp.com.pg Wed Apr 27 12:50:48 2005 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 28 Apr 2005 03:50:48 +1000 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> References: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Message-ID: <42705D98.13804.107CF3E7@stuart.lexacorp.com.pg> On 27 Apr 2005 at 12:51, Perry Harold wrote: > Drew > > Do you perhaps have a sample of going the other way - Retrieving from a web > page? I regularly access a site to retrieve data for one of my databases. > Go to main page - select by an id number and then clip some of the data. > Would like to automate if possible. > For automating writing to or reading from webpages or any other application, IMHO the best solution is to use a tool designed specifically for that type of operation rather than trying to cobble something together in VB or whatever. Take a look at AutoIt http://www.autoitscript.com/autoit3/ The latest version includes a DLL/COM control so that you can add AutoIt features to your VB applications -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. From DWUTKA at marlow.com Wed Apr 27 12:58:37 2005 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Wed, 27 Apr 2005 12:58:37 -0500 Subject: [dba-VB] Pushing data to a web page Message-ID: <123701F54509D9119A4F00D0B747349016D3D6@main2.marlow.com> Sure, my example could work both ways. It's actually pretty easy. To pull data off, you have two options, though. Option 1 is to pull it from a browser. This is handy if the data is already segmented out the way you want. To pull it from a browser, just create a browser object, and navigate to the site you want data from. Then loop through the browser's document object, to grab the data within the document's objects. That's pretty easy. Just open the source of the page, and use the various control names to get the values. Option 2 is faster, and easier to code, but a little more difficult to 'sort out' the data. You can use API calls to directly download the web page, then with a little string manipulation, you can pull the data out. Drew -----Original Message----- From: Perry Harold [mailto:pharold at proftesting.com] Sent: Wednesday, April 27, 2005 11:51 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Drew Do you perhaps have a sample of going the other way - Retrieving from a web page? I regularly access a site to retrieve data for one of my databases. Go to main page - select by an id number and then clip some of the data. Would like to automate if possible. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, April 26, 2005 10:36 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From martyconnelly at shaw.ca Wed Apr 27 14:57:29 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Wed, 27 Apr 2005 12:57:29 -0700 Subject: [dba-VB] Pushing data to a web page References: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> Message-ID: <426FEEA9.4020103@shaw.ca> You can do this with xmlhttp and web scraping, you just have to know how the web post form works just find the submission button name and textbox name from the html source From this movie web form the select button is named "select" and the text box "for" Then add to Send in xml call All this code below is equivalent to the url http://www.imdb.com/Find?select=All&for="Sahara" Then run code below to dump to an html file or string which can be parsed. This won't work if the html changes or the site obfuscates the form to stop this with page redirects. partial HTML source from "http://www.imdb.com/Find"
 
'FindMovie ("Sahara") Public Function FindMovie(strTitle As String) As String ' Dim oHttp As MSXML2.XMLHTTP Dim oHttp As Object Dim strFileNameH As String Dim strFileNameT As String Dim strSend As String Dim strSubmit As String Dim strStockName As String 'make use of the XMLHTTPRequest object contained in msxml.dll Set oHttp = CreateObject("Microsoft.XMLHTTP") ' Set oHttp = CreateObject("MSXML2.XMLHTTP") 'set according to form type 'oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'oHttp.setRequestHeader "Content-Type", "text/xml" 'oHttp.setRequestHeader "Content-Type", "multipart/form-data" oHttp.Open "POST", "http://www.imdb.com/Find", False oHttp.send "select=All&for=" & strTitle 'oHttp.send (strSend) ' oHttp.send Debug.Print "strSend=" & strSend 'check the feedback Debug.Print "Ready State =" & oHttp.readyState 'normal state =4 Debug.Print "Status =" & oHttp.status 'normal status = 200 ' Debug.Print "Status Text =" & oHttp.statusText Debug.Print oHttp.getAllResponseHeaders() 'Debug.Print "Response Body =" & oHttp.responseBody ' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode) 'Debug.Print "Response Text =" & oHttp.responseText 'Parse response text string here or send to file strFileNameH = "c:\Accesshtmlstealer\Amazon" strFileNameH = strFileNameH & Format(Now, "yyyymmddhhmmss") & ".htm" WriteFile strFileNameH, oHttp.responseText ' HypeLinkFile strFileNameH strFileNameT = "c:\Accesshtmlstealer\Amazon" strFileNameT = strFileNameT & Format(Now, "yyyymmddhhmmss") & ".txt" WriteFile strFileNameT, oHttp.responseText ' FindMovie = strFileNameH Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & Err.Number ' Resume Next End Function Public Sub WriteFile(ByVal sFileName As String, ByVal sContents As String) ' Dump XML String to File for debugging Dim fhFile As Integer fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Output As #fhFile Print #fhFile, sContents; Close #fhFile Debug.Print "Out File" & sFileName End Sub Public Sub ReadFile(ByVal sFileName As String, ByRef sContents As String) ' Dump XML String to File for debugging Dim strLine As String Dim intLine As Long Dim fhFile As Integer intLine = 0 sContents = "" fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Input As #fhFile Do While Not EOF(1) ' Loop until end of file. Input #1, strLine ' Read data intLine = intLine + 1 sContents = sContents & strLine 'Debug.Print sContents ' Print data to Debug window. Loop Close #fhFile ' Close file. Debug.Print "Input File" & sFileName & " lines=" & intLine End Sub Perry Harold wrote: >Drew > >Do you perhaps have a sample of going the other way - Retrieving from a web >page? I regularly access a site to retrieve data for one of my databases. >Go to main page - select by an id number and then clip some of the data. >Would like to automate if possible. > >Perry Harold > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com >Sent: Tuesday, April 26, 2005 10:36 AM >To: dba-vb at databaseadvisors.com >Subject: RE: [dba-VB] Pushing data to a web page > > >Just sent you an example offlist. > >Drew > >-----Original Message----- >From: John W. Colby [mailto:jwcolby at colbyconsulting.com] >Sent: Tuesday, April 26, 2005 9:11 AM >To: 'Access Developers discussion and problem solving'; VBA >Subject: [dba-VB] Pushing data to a web page > > >Does anyone know how to manipulate a web page from VB/VB.net? I need to >place values in text boxes, click radio buttons, click command buttons etc. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Thu Apr 28 11:05:01 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 28 Apr 2005 09:05:01 -0700 Subject: [dba-VB] VB.Net expert In-Reply-To: <426FEEA9.4020103@shaw.ca> Message-ID: <0IFN00728ZCAVV@l-daemon> Hi All: A fellow developer has got himself into a bit of a bind with having to just 'display' an existing project that was written in VB.Net. The references do not all work and I just could not help resolving the issues. There is a dead-line of Friday...Yeh Friday. He will pay at a negotiable rate. Anyone in the Victoria/Vancouver area preferred but a remote talent would be acceptable. TIA Jim From martyconnelly at shaw.ca Thu Apr 28 14:12:19 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 28 Apr 2005 12:12:19 -0700 Subject: [dba-VB] VB.Net expert References: <0IFN00728ZCAVV@l-daemon> Message-ID: <42713593.5090500@shaw.ca> Just some maybes It is possible he has copied something into his project with the same name, and end up with confusing situations (for instance, it is very logical to call a Dataset "customers" when that Dataset deals with customers, but then you'll be tempted to name it's helper class "customer" as well, because that class also deals with customers. I know it's annoying, but I'ld stick with "dsCustomers", "clsCustomers",. If you have duplicate names,somehow. When loading a project, the IDE cannot warn you nicely like it does when you compile/deploy a project : if it sees duplicate/ambiguous names, it has to handle them in any way it sees fit, and that often means removing one of the references. Remember that it can remove object/methods from your code, because as much as it can generate code, it can also remove it (that is what it does when you remove a control from the designer : it removes the corresponding lines of code from the code-behind). Also check if auto-generate has been ticked off , to fire when you press F5 sometimes it gets unchecked. Check if the project folder is read-only, remove the read-only attribute of project or bin folder. try to rename/delete the .pdb file also. see if it works . These debugging files can get out of sync. Jim Lawrence wrote: >Hi All: > >A fellow developer has got himself into a bit of a bind with having to just >'display' an existing project that was written in VB.Net. The references do >not all work and I just could not help resolving the issues. There is a >dead-line of Friday...Yeh Friday. > >He will pay at a negotiable rate. > >Anyone in the Victoria/Vancouver area preferred but a remote talent would be >acceptable. > >TIA >Jim > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Thu Apr 28 15:36:31 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 28 Apr 2005 13:36:31 -0700 Subject: [dba-VB] VB.Net expert In-Reply-To: <42713593.5090500@shaw.ca> Message-ID: <0IFO00KOIBWVWJ@l-daemon> Hi Marty: Thanks for the information and I have passed it along and hope that it helps. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Thursday, April 28, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] VB.Net expert Just some maybes It is possible he has copied something into his project with the same name, and end up with confusing situations (for instance, it is very logical to call a Dataset "customers" when that Dataset deals with customers, but then you'll be tempted to name it's helper class "customer" as well, because that class also deals with customers. I know it's annoying, but I'ld stick with "dsCustomers", "clsCustomers",. If you have duplicate names,somehow. When loading a project, the IDE cannot warn you nicely like it does when you compile/deploy a project : if it sees duplicate/ambiguous names, it has to handle them in any way it sees fit, and that often means removing one of the references. Remember that it can remove object/methods from your code, because as much as it can generate code, it can also remove it (that is what it does when you remove a control from the designer : it removes the corresponding lines of code from the code-behind). Also check if auto-generate has been ticked off , to fire when you press F5 sometimes it gets unchecked. Check if the project folder is read-only, remove the read-only attribute of project or bin folder. try to rename/delete the .pdb file also. see if it works . These debugging files can get out of sync. Jim Lawrence wrote: >Hi All: > >A fellow developer has got himself into a bit of a bind with having to just >'display' an existing project that was written in VB.Net. The references do >not all work and I just could not help resolving the issues. There is a >dead-line of Friday...Yeh Friday. > >He will pay at a negotiable rate. > >Anyone in the Victoria/Vancouver area preferred but a remote talent would be >acceptable. > >TIA >Jim > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From pharold at proftesting.com Fri Apr 29 13:48:12 2005 From: pharold at proftesting.com (Perry Harold) Date: Fri, 29 Apr 2005 14:48:12 -0400 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <426FEEA9.4020103@shaw.ca> Message-ID: <000601c54ceb$ff63c000$192da8c0@D58BT131Perry> Marty, Stuart, Drew Thanks for the help. Guess I have to find time to get it up and running now. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Wednesday, April 27, 2005 3:57 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Pushing data to a web page You can do this with xmlhttp and web scraping, you just have to know how the web post form works just find the submission button name and textbox name from the html source >From this movie web form the select button is named "select" and the text box "for" Then add to Send in xml call All this code below is equivalent to the url http://www.imdb.com/Find?select=All&for="Sahara" Then run code below to dump to an html file or string which can be parsed. This won't work if the html changes or the site obfuscates the form to stop this with page redirects. partial HTML source from "http://www.imdb.com/Find"
 
'FindMovie ("Sahara") Public Function FindMovie(strTitle As String) As String ' Dim oHttp As MSXML2.XMLHTTP Dim oHttp As Object Dim strFileNameH As String Dim strFileNameT As String Dim strSend As String Dim strSubmit As String Dim strStockName As String 'make use of the XMLHTTPRequest object contained in msxml.dll Set oHttp = CreateObject("Microsoft.XMLHTTP") ' Set oHttp = CreateObject("MSXML2.XMLHTTP") 'set according to form type 'oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'oHttp.setRequestHeader "Content-Type", "text/xml" 'oHttp.setRequestHeader "Content-Type", "multipart/form-data" oHttp.Open "POST", "http://www.imdb.com/Find", False oHttp.send "select=All&for=" & strTitle 'oHttp.send (strSend) ' oHttp.send Debug.Print "strSend=" & strSend 'check the feedback Debug.Print "Ready State =" & oHttp.readyState 'normal state =4 Debug.Print "Status =" & oHttp.status 'normal status = 200 ' Debug.Print "Status Text =" & oHttp.statusText Debug.Print oHttp.getAllResponseHeaders() 'Debug.Print "Response Body =" & oHttp.responseBody ' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode) 'Debug.Print "Response Text =" & oHttp.responseText 'Parse response text string here or send to file strFileNameH = "c:\Accesshtmlstealer\Amazon" strFileNameH = strFileNameH & Format(Now, "yyyymmddhhmmss") & ".htm" WriteFile strFileNameH, oHttp.responseText ' HypeLinkFile strFileNameH strFileNameT = "c:\Accesshtmlstealer\Amazon" strFileNameT = strFileNameT & Format(Now, "yyyymmddhhmmss") & ".txt" WriteFile strFileNameT, oHttp.responseText ' FindMovie = strFileNameH Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & Err.Number ' Resume Next End Function Public Sub WriteFile(ByVal sFileName As String, ByVal sContents As String) ' Dump XML String to File for debugging Dim fhFile As Integer fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Output As #fhFile Print #fhFile, sContents; Close #fhFile Debug.Print "Out File" & sFileName End Sub Public Sub ReadFile(ByVal sFileName As String, ByRef sContents As String) ' Dump XML String to File for debugging Dim strLine As String Dim intLine As Long Dim fhFile As Integer intLine = 0 sContents = "" fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Input As #fhFile Do While Not EOF(1) ' Loop until end of file. Input #1, strLine ' Read data intLine = intLine + 1 sContents = sContents & strLine 'Debug.Print sContents ' Print data to Debug window. Loop Close #fhFile ' Close file. Debug.Print "Input File" & sFileName & " lines=" & intLine End Sub Perry Harold wrote: >Drew > >Do you perhaps have a sample of going the other way - Retrieving from a >web page? I regularly access a site to retrieve data for one of my >databases. Go to main page - select by an id number and then clip some >of the data. Would like to automate if possible. > >Perry Harold > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of >DWUTKA at marlow.com >Sent: Tuesday, April 26, 2005 10:36 AM >To: dba-vb at databaseadvisors.com >Subject: RE: [dba-VB] Pushing data to a web page > > >Just sent you an example offlist. > >Drew > >-----Original Message----- >From: John W. Colby [mailto:jwcolby at colbyconsulting.com] >Sent: Tuesday, April 26, 2005 9:11 AM >To: 'Access Developers discussion and problem solving'; VBA >Subject: [dba-VB] Pushing data to a web page > > >Does anyone know how to manipulate a web page from VB/VB.net? I need >to place values in text boxes, click radio buttons, click command >buttons etc. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Tue Apr 26 09:10:51 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Tue, 26 Apr 2005 10:10:51 -0400 Subject: [dba-VB] Pushing data to a web page Message-ID: <001201c54a69$c4cfc760$6c7aa8c0@ColbyM6805> Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From DWUTKA at marlow.com Tue Apr 26 09:36:14 2005 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Tue, 26 Apr 2005 09:36:14 -0500 Subject: [dba-VB] Pushing data to a web page Message-ID: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From pharold at proftesting.com Wed Apr 27 11:51:14 2005 From: pharold at proftesting.com (Perry Harold) Date: Wed, 27 Apr 2005 12:51:14 -0400 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Message-ID: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> Drew Do you perhaps have a sample of going the other way - Retrieving from a web page? I regularly access a site to retrieve data for one of my databases. Go to main page - select by an id number and then clip some of the data. Would like to automate if possible. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, April 26, 2005 10:36 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From stuart at lexacorp.com.pg Wed Apr 27 12:50:48 2005 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 28 Apr 2005 03:50:48 +1000 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> References: <123701F54509D9119A4F00D0B747349016D3C5@main2.marlow.com> Message-ID: <42705D98.13804.107CF3E7@stuart.lexacorp.com.pg> On 27 Apr 2005 at 12:51, Perry Harold wrote: > Drew > > Do you perhaps have a sample of going the other way - Retrieving from a web > page? I regularly access a site to retrieve data for one of my databases. > Go to main page - select by an id number and then clip some of the data. > Would like to automate if possible. > For automating writing to or reading from webpages or any other application, IMHO the best solution is to use a tool designed specifically for that type of operation rather than trying to cobble something together in VB or whatever. Take a look at AutoIt http://www.autoitscript.com/autoit3/ The latest version includes a DLL/COM control so that you can add AutoIt features to your VB applications -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. From DWUTKA at marlow.com Wed Apr 27 12:58:37 2005 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Wed, 27 Apr 2005 12:58:37 -0500 Subject: [dba-VB] Pushing data to a web page Message-ID: <123701F54509D9119A4F00D0B747349016D3D6@main2.marlow.com> Sure, my example could work both ways. It's actually pretty easy. To pull data off, you have two options, though. Option 1 is to pull it from a browser. This is handy if the data is already segmented out the way you want. To pull it from a browser, just create a browser object, and navigate to the site you want data from. Then loop through the browser's document object, to grab the data within the document's objects. That's pretty easy. Just open the source of the page, and use the various control names to get the values. Option 2 is faster, and easier to code, but a little more difficult to 'sort out' the data. You can use API calls to directly download the web page, then with a little string manipulation, you can pull the data out. Drew -----Original Message----- From: Perry Harold [mailto:pharold at proftesting.com] Sent: Wednesday, April 27, 2005 11:51 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Drew Do you perhaps have a sample of going the other way - Retrieving from a web page? I regularly access a site to retrieve data for one of my databases. Go to main page - select by an id number and then clip some of the data. Would like to automate if possible. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, April 26, 2005 10:36 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Pushing data to a web page Just sent you an example offlist. Drew -----Original Message----- From: John W. Colby [mailto:jwcolby at colbyconsulting.com] Sent: Tuesday, April 26, 2005 9:11 AM To: 'Access Developers discussion and problem solving'; VBA Subject: [dba-VB] Pushing data to a web page Does anyone know how to manipulate a web page from VB/VB.net? I need to place values in text boxes, click radio buttons, click command buttons etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From martyconnelly at shaw.ca Wed Apr 27 14:57:29 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Wed, 27 Apr 2005 12:57:29 -0700 Subject: [dba-VB] Pushing data to a web page References: <001801c54b49$52efa4e0$192da8c0@D58BT131Perry> Message-ID: <426FEEA9.4020103@shaw.ca> You can do this with xmlhttp and web scraping, you just have to know how the web post form works just find the submission button name and textbox name from the html source From this movie web form the select button is named "select" and the text box "for" Then add to Send in xml call All this code below is equivalent to the url http://www.imdb.com/Find?select=All&for="Sahara" Then run code below to dump to an html file or string which can be parsed. This won't work if the html changes or the site obfuscates the form to stop this with page redirects. partial HTML source from "http://www.imdb.com/Find"
 
'FindMovie ("Sahara") Public Function FindMovie(strTitle As String) As String ' Dim oHttp As MSXML2.XMLHTTP Dim oHttp As Object Dim strFileNameH As String Dim strFileNameT As String Dim strSend As String Dim strSubmit As String Dim strStockName As String 'make use of the XMLHTTPRequest object contained in msxml.dll Set oHttp = CreateObject("Microsoft.XMLHTTP") ' Set oHttp = CreateObject("MSXML2.XMLHTTP") 'set according to form type 'oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'oHttp.setRequestHeader "Content-Type", "text/xml" 'oHttp.setRequestHeader "Content-Type", "multipart/form-data" oHttp.Open "POST", "http://www.imdb.com/Find", False oHttp.send "select=All&for=" & strTitle 'oHttp.send (strSend) ' oHttp.send Debug.Print "strSend=" & strSend 'check the feedback Debug.Print "Ready State =" & oHttp.readyState 'normal state =4 Debug.Print "Status =" & oHttp.status 'normal status = 200 ' Debug.Print "Status Text =" & oHttp.statusText Debug.Print oHttp.getAllResponseHeaders() 'Debug.Print "Response Body =" & oHttp.responseBody ' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode) 'Debug.Print "Response Text =" & oHttp.responseText 'Parse response text string here or send to file strFileNameH = "c:\Accesshtmlstealer\Amazon" strFileNameH = strFileNameH & Format(Now, "yyyymmddhhmmss") & ".htm" WriteFile strFileNameH, oHttp.responseText ' HypeLinkFile strFileNameH strFileNameT = "c:\Accesshtmlstealer\Amazon" strFileNameT = strFileNameT & Format(Now, "yyyymmddhhmmss") & ".txt" WriteFile strFileNameT, oHttp.responseText ' FindMovie = strFileNameH Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & Err.Number ' Resume Next End Function Public Sub WriteFile(ByVal sFileName As String, ByVal sContents As String) ' Dump XML String to File for debugging Dim fhFile As Integer fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Output As #fhFile Print #fhFile, sContents; Close #fhFile Debug.Print "Out File" & sFileName End Sub Public Sub ReadFile(ByVal sFileName As String, ByRef sContents As String) ' Dump XML String to File for debugging Dim strLine As String Dim intLine As Long Dim fhFile As Integer intLine = 0 sContents = "" fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Input As #fhFile Do While Not EOF(1) ' Loop until end of file. Input #1, strLine ' Read data intLine = intLine + 1 sContents = sContents & strLine 'Debug.Print sContents ' Print data to Debug window. Loop Close #fhFile ' Close file. Debug.Print "Input File" & sFileName & " lines=" & intLine End Sub Perry Harold wrote: >Drew > >Do you perhaps have a sample of going the other way - Retrieving from a web >page? I regularly access a site to retrieve data for one of my databases. >Go to main page - select by an id number and then clip some of the data. >Would like to automate if possible. > >Perry Harold > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com >Sent: Tuesday, April 26, 2005 10:36 AM >To: dba-vb at databaseadvisors.com >Subject: RE: [dba-VB] Pushing data to a web page > > >Just sent you an example offlist. > >Drew > >-----Original Message----- >From: John W. Colby [mailto:jwcolby at colbyconsulting.com] >Sent: Tuesday, April 26, 2005 9:11 AM >To: 'Access Developers discussion and problem solving'; VBA >Subject: [dba-VB] Pushing data to a web page > > >Does anyone know how to manipulate a web page from VB/VB.net? I need to >place values in text boxes, click radio buttons, click command buttons etc. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Thu Apr 28 11:05:01 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 28 Apr 2005 09:05:01 -0700 Subject: [dba-VB] VB.Net expert In-Reply-To: <426FEEA9.4020103@shaw.ca> Message-ID: <0IFN00728ZCAVV@l-daemon> Hi All: A fellow developer has got himself into a bit of a bind with having to just 'display' an existing project that was written in VB.Net. The references do not all work and I just could not help resolving the issues. There is a dead-line of Friday...Yeh Friday. He will pay at a negotiable rate. Anyone in the Victoria/Vancouver area preferred but a remote talent would be acceptable. TIA Jim From martyconnelly at shaw.ca Thu Apr 28 14:12:19 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 28 Apr 2005 12:12:19 -0700 Subject: [dba-VB] VB.Net expert References: <0IFN00728ZCAVV@l-daemon> Message-ID: <42713593.5090500@shaw.ca> Just some maybes It is possible he has copied something into his project with the same name, and end up with confusing situations (for instance, it is very logical to call a Dataset "customers" when that Dataset deals with customers, but then you'll be tempted to name it's helper class "customer" as well, because that class also deals with customers. I know it's annoying, but I'ld stick with "dsCustomers", "clsCustomers",. If you have duplicate names,somehow. When loading a project, the IDE cannot warn you nicely like it does when you compile/deploy a project : if it sees duplicate/ambiguous names, it has to handle them in any way it sees fit, and that often means removing one of the references. Remember that it can remove object/methods from your code, because as much as it can generate code, it can also remove it (that is what it does when you remove a control from the designer : it removes the corresponding lines of code from the code-behind). Also check if auto-generate has been ticked off , to fire when you press F5 sometimes it gets unchecked. Check if the project folder is read-only, remove the read-only attribute of project or bin folder. try to rename/delete the .pdb file also. see if it works . These debugging files can get out of sync. Jim Lawrence wrote: >Hi All: > >A fellow developer has got himself into a bit of a bind with having to just >'display' an existing project that was written in VB.Net. The references do >not all work and I just could not help resolving the issues. There is a >dead-line of Friday...Yeh Friday. > >He will pay at a negotiable rate. > >Anyone in the Victoria/Vancouver area preferred but a remote talent would be >acceptable. > >TIA >Jim > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Thu Apr 28 15:36:31 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 28 Apr 2005 13:36:31 -0700 Subject: [dba-VB] VB.Net expert In-Reply-To: <42713593.5090500@shaw.ca> Message-ID: <0IFO00KOIBWVWJ@l-daemon> Hi Marty: Thanks for the information and I have passed it along and hope that it helps. Jim -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Thursday, April 28, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] VB.Net expert Just some maybes It is possible he has copied something into his project with the same name, and end up with confusing situations (for instance, it is very logical to call a Dataset "customers" when that Dataset deals with customers, but then you'll be tempted to name it's helper class "customer" as well, because that class also deals with customers. I know it's annoying, but I'ld stick with "dsCustomers", "clsCustomers",. If you have duplicate names,somehow. When loading a project, the IDE cannot warn you nicely like it does when you compile/deploy a project : if it sees duplicate/ambiguous names, it has to handle them in any way it sees fit, and that often means removing one of the references. Remember that it can remove object/methods from your code, because as much as it can generate code, it can also remove it (that is what it does when you remove a control from the designer : it removes the corresponding lines of code from the code-behind). Also check if auto-generate has been ticked off , to fire when you press F5 sometimes it gets unchecked. Check if the project folder is read-only, remove the read-only attribute of project or bin folder. try to rename/delete the .pdb file also. see if it works . These debugging files can get out of sync. Jim Lawrence wrote: >Hi All: > >A fellow developer has got himself into a bit of a bind with having to just >'display' an existing project that was written in VB.Net. The references do >not all work and I just could not help resolving the issues. There is a >dead-line of Friday...Yeh Friday. > >He will pay at a negotiable rate. > >Anyone in the Victoria/Vancouver area preferred but a remote talent would be >acceptable. > >TIA >Jim > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From pharold at proftesting.com Fri Apr 29 13:48:12 2005 From: pharold at proftesting.com (Perry Harold) Date: Fri, 29 Apr 2005 14:48:12 -0400 Subject: [dba-VB] Pushing data to a web page In-Reply-To: <426FEEA9.4020103@shaw.ca> Message-ID: <000601c54ceb$ff63c000$192da8c0@D58BT131Perry> Marty, Stuart, Drew Thanks for the help. Guess I have to find time to get it up and running now. Perry Harold -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Wednesday, April 27, 2005 3:57 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Pushing data to a web page You can do this with xmlhttp and web scraping, you just have to know how the web post form works just find the submission button name and textbox name from the html source >From this movie web form the select button is named "select" and the text box "for" Then add to Send in xml call All this code below is equivalent to the url http://www.imdb.com/Find?select=All&for="Sahara" Then run code below to dump to an html file or string which can be parsed. This won't work if the html changes or the site obfuscates the form to stop this with page redirects. partial HTML source from "http://www.imdb.com/Find"
 
'FindMovie ("Sahara") Public Function FindMovie(strTitle As String) As String ' Dim oHttp As MSXML2.XMLHTTP Dim oHttp As Object Dim strFileNameH As String Dim strFileNameT As String Dim strSend As String Dim strSubmit As String Dim strStockName As String 'make use of the XMLHTTPRequest object contained in msxml.dll Set oHttp = CreateObject("Microsoft.XMLHTTP") ' Set oHttp = CreateObject("MSXML2.XMLHTTP") 'set according to form type 'oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 'oHttp.setRequestHeader "Content-Type", "text/xml" 'oHttp.setRequestHeader "Content-Type", "multipart/form-data" oHttp.Open "POST", "http://www.imdb.com/Find", False oHttp.send "select=All&for=" & strTitle 'oHttp.send (strSend) ' oHttp.send Debug.Print "strSend=" & strSend 'check the feedback Debug.Print "Ready State =" & oHttp.readyState 'normal state =4 Debug.Print "Status =" & oHttp.status 'normal status = 200 ' Debug.Print "Status Text =" & oHttp.statusText Debug.Print oHttp.getAllResponseHeaders() 'Debug.Print "Response Body =" & oHttp.responseBody ' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode) 'Debug.Print "Response Text =" & oHttp.responseText 'Parse response text string here or send to file strFileNameH = "c:\Accesshtmlstealer\Amazon" strFileNameH = strFileNameH & Format(Now, "yyyymmddhhmmss") & ".htm" WriteFile strFileNameH, oHttp.responseText ' HypeLinkFile strFileNameH strFileNameT = "c:\Accesshtmlstealer\Amazon" strFileNameT = strFileNameT & Format(Now, "yyyymmddhhmmss") & ".txt" WriteFile strFileNameT, oHttp.responseText ' FindMovie = strFileNameH Exit Function ErrorHandler: MsgBox Err.Description & vbCrLf & Err.Number ' Resume Next End Function Public Sub WriteFile(ByVal sFileName As String, ByVal sContents As String) ' Dump XML String to File for debugging Dim fhFile As Integer fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Output As #fhFile Print #fhFile, sContents; Close #fhFile Debug.Print "Out File" & sFileName End Sub Public Sub ReadFile(ByVal sFileName As String, ByRef sContents As String) ' Dump XML String to File for debugging Dim strLine As String Dim intLine As Long Dim fhFile As Integer intLine = 0 sContents = "" fhFile = FreeFile ' Debug.Print "Length of string=" & Len(sContents) Open sFileName For Input As #fhFile Do While Not EOF(1) ' Loop until end of file. Input #1, strLine ' Read data intLine = intLine + 1 sContents = sContents & strLine 'Debug.Print sContents ' Print data to Debug window. Loop Close #fhFile ' Close file. Debug.Print "Input File" & sFileName & " lines=" & intLine End Sub Perry Harold wrote: >Drew > >Do you perhaps have a sample of going the other way - Retrieving from a >web page? I regularly access a site to retrieve data for one of my >databases. Go to main page - select by an id number and then clip some >of the data. Would like to automate if possible. > >Perry Harold > >-----Original Message----- >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of >DWUTKA at marlow.com >Sent: Tuesday, April 26, 2005 10:36 AM >To: dba-vb at databaseadvisors.com >Subject: RE: [dba-VB] Pushing data to a web page > > >Just sent you an example offlist. > >Drew > >-----Original Message----- >From: John W. Colby [mailto:jwcolby at colbyconsulting.com] >Sent: Tuesday, April 26, 2005 9:11 AM >To: 'Access Developers discussion and problem solving'; VBA >Subject: [dba-VB] Pushing data to a web page > > >Does anyone know how to manipulate a web page from VB/VB.net? I need >to place values in text boxes, click radio buttons, click command >buttons etc. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com