[dba-VB] Web page manipulation

jwcolby jwcolby at colbyconsulting.com
Mon Dec 13 09:33:44 CST 2010


The "clients" are tiny and completely non-technical.  One is a non-profit that assists people with 
disabilities to find service providers and other assistance.  They have about a half dozen people 
that work for them, meeting the people needing assistance, usually in that person's home.  The 
database will be a dozen or so tables and is basically just for hours worked kind of stuff.

The other "client" is a prison ministry which has lists of programs they provide in the prisons, 
volunteers, churches and pastors.  Again, as hand full of volunteers that need to get at this 
information and maintain it, again working out of their homes.

Both applications need to hit a database over the internet, and are pretty much simple data entry 
and some reporting.

Both are sure to grow but I need to just get the basics up and running, hopefully fairly rapidly.  I 
have no control over the web hosting.  Very likely I will need to use MySQL since that is almost 
universal for web hosting sites, so if they have a web site already, that will almost certainly be 
available.

Access just seems to be a bad fit for these, and I have zero knowledge even about how to set up the 
MySQL database, connect to it etc.

I have a web site that provides me with these services, already paid for and which I could use 
initially at least to get set up and running, and up to speed knowledge wise.  Eventually I will 
need to move the data out to their own web hosting if I can.

John W. Colby
www.ColbyConsulting.com

On 12/13/2010 4:48 AM, Mark Breen wrote:
> Hello John
>
> Another choice is to use Sillennium<http://seleniumhq.org/>
>
> It is built for this task and will allow you to easily change your library
> of routines when your website changes.
>
> Mark
>
>
>
>
> On 10 December 2010 22:33, Drew Wutka<DWUTKA at marlow.com>  wrote:
>
>> Now for a little more info for you.  Yes, you can certainly do this.
>> Technically, it's not much different than if someone handed you an .mde,
>> and asked you to automate tasks in the mde (so you couldn't tweak the
>> source code running the program itself, but you could open the mde with
>> VBA, and use the objects within it just like you'd use the objects in
>> your own application.)
>>
>> Trick #1:  Just like with an .mde, you have to have a reference to the
>> database itself, so with a browser, you need a reference to it.  You can
>> either programmatically open a browser window (so you'll both create the
>> object, and have a reference to it), or you can ask the user which
>> browser window they want you to use (so you can grab the browser window
>> through code).
>>
>> Here's an example of how to grab an existing browser window:
>>
>> Function GetExistingBrowser(strKey As String)
>> Dim SWs As New SHDocVw.ShellWindows
>> Dim IE As SHDocVw.InternetExplorer
>> Dim mdie As InternetExplorer
>> Dim Resp
>> For Each IE In SWs
>>     Resp = MsgBox("Do you want to select: "&  vbCrLf&  vbCrLf&
>> IE.LocationName&  vbCrLf&  vbCrLf&  IE.LocationURL, vbYesNo +
>> vbQuestion, "Select IE")
>>     If Resp = vbYes Then
>>         Set mdie = Nothing
>>         Set mdie = IE.Application
>>         NewSormDataEntry strKey, mdie
>>         Exit Function
>>     End If
>> Next
>> End Function
>>
>> The 'NewSormDataEntry' function is the function I am sending the mdie
>> object too (the referenced browser window).  In this function strKey is
>> the primary key of a record that will be used in that NewSormDataEntry
>> to submit data into a web site.
>>
>> Trick #2:  Just like when the development world got a wedgie when
>> Microsoft 'secured' Outlook from programs just using it to send email,
>> web security can be a real pain in doing something like this.  The
>> security is put in place to impede (note, I didn't say prevent) a hacker
>> from doing nasty stuff to the site.  So the 'impeding' garbage designed
>> to trip up hackers can get in the way of a legitimate developer trying
>> to create a helpful tool.  So before you COMMIT to being able to make
>> the tool, you'll need to look at the site itself, to see what all will
>> get in your way.
>>
>> Trick #3:  There are two ways to 'find' the objects you will need your
>> code to work with.  The first is to just look at the HTML of the page(s)
>> you are going to manipulate.  This is where some of those 'impediments'
>> come into play.  Some sites prevent you from right clicking on a page
>> and selecting 'View Source'.  Ironically, this is just removing a
>> 'shortcut' way to view the HTML source behind a page.  It doesn't
>> actually HIDE the source, because your browser is viewing the source, it
>> has too, otherwise it will have nothing to display.  So there are
>> multiple ways to 'download' the HTML you can view yourself.  Create your
>> own browser, and dump the HTML to a file. You can also use API calls to
>> just directly download the HTML, without a browser.  If the page is
>> derived from internal (on the website server) variables, you'll need to
>> use your own browser to get there and download the source.  The second
>> way to 'find' the objects you need to deal with are with the object
>> browser. Running your code in debug mode, you'll be able to see the
>> browser object, and all of it's child elements.
>>
>> Trick #4:  Events and properties.  Setting the value of a textbox, or
>> clicking a button, just requires that you know what the events and
>> properties of those objects are.  I use the MSDN that came with the
>> developer edition of Office 2000.  It's got a nice HTML guide with
>> common HTML form elements, their properties, methods, and events.  But
>> all that information is also plastered all over the web.
>>
>> Trick #5:  When a page loads, the browser object is there, but you may
>> not be able to capture 'download complete' events.  What I have done in
>> these cases, where my code puts in data on a page, clicks a button to go
>> to the next page, I put my code in a loop, that sits and waits for an
>> object from the next page to exist.
>>
>> Of course, if there are applets, or flash media elements, required for
>> interaction... can't help ya there, haven't tackled one of those.
>>
>> Drew
>>
>> -----Original Message-----
>> From: dba-vb-bounces at databaseadvisors.com
>> [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
>> Sent: Friday, December 10, 2010 3:30 PM
>> To: VBA
>> Subject: [dba-VB] Web page manipulation
>>
>> My client has to go through a process where he clicks about 20 - 30
>> things to manage to get a file
>> downloaded.  It sounded totally convoluted but the question is (and I
>> have asked this before without
>> a usable response) can I programmatically manipulate web pages to cause
>> specific pages to open,
>> click buttons, input data into controls etc.
>>
>> --
>> John W. Colby
>> www.ColbyConsulting.com
>> _______________________________________________
>> dba-VB mailing list
>> dba-VB at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/dba-vb
>> http://www.databaseadvisors.com
>>
>> The information contained in this transmission is intended only for the
>> person or entity
>> to which it is addressed and may contain II-VI Proprietary and/or II-VI
>> Business
>> Sensitive material. If you are not the intended recipient, please contact
>> the sender
>> immediately and destroy the material in its entirety, whether electronic or
>> hard copy.
>> You are notified that any review, retransmission, copying, disclosure,
>> dissemination,
>> or other use of, or taking of any action in reliance upon this information
>> by persons
>> or entities other than the intended recipient is prohibited.
>>
>>
>> _______________________________________________
>> 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
>
>



More information about the dba-VB mailing list