[dba-Tech] Google API's

MartyConnelly martyconnelly at shaw.ca
Mon Mar 21 13:20:34 CST 2005


I have been footling around with some of Google's api's.
I have been trying to search text inside PDF's on desktop or network share

Below is some VBA code to call Google Web Search api's from Office 2003 VBA
if you want to play around with them.

You have to create web service classes first though.
 I have done this for older VBA by creating Soap calls against wsdl file
using Simon Fell's PocketSoap libraries. Since there are problems with MS
Soap libraries and complex soap types creating classes on lower versions 
of Access.

What I still want to get at is the Google Desktop Search Engine api's
and then use ScanSoft's Google plugin to text search, non OCR scanned
pdf's that contain invoices or faxes.

Once the desktop Search Engine is installed, "well now there is a 12 hour
run", you can easily query pdf's even without the api, by a call to IE 
or code
msxml2.httprequest to a url like so that will return xml

'http://127.0.0.1:4664/search&s=1ftR7c_hVZKYvuYS-RWnFHk91Z0?
q=Google+myoddtext&format=xml

see for search terms on desktop search engine
http://desktop.google.com/developerguide.html#requesting

Option Compare Database
Option Explicit
' Call Google Web Search API's
'get license key via email and wsdl from here first
'      http://www.google.com/apis/api_faq.html
'wsdl at http://api.google.com/GoogleSearch.wsdl
'to auto create web service classes from wsdl and set required references
'open VBA module Tools-->Web Services Reference
'enter web service url pointing to wsdl click search
' in tree that appears check top level box to select all methods
' You can test but wont work without key being passed and it uses a get 
rather than post
' then select ADD to create classes for all methods selected.
' to use the Google Desktop Search engine after install you could use just
msxml2.httprequest method
' or I think you can enter below url in IE
'http://127.0.0.1:4664/search&s=1ftR7c_hVZKYvuYS-RWnFHk91Z0?
q=Google+searchstringtext&format=xml
'see http://desktop.google.com/developerguide.html#requesting

Const cLicensekey As String = "xxxxXXXXXxxXX" '<--your license key here

Sub testgoogle()
'typical google search string
'Debug.Print GoogleSearch("array variable vba site:www.microsoft.com")
Debug.Print GoogleSearch("google webapi")
End Sub
Function GoogleSearch(strSearch As String) As String
    Dim clsGoogle As clsws_GoogleSearchService
    Dim r As struct_GoogleSearchResult
    Dim re As struct_ResultElement
    Dim i As Long
    Dim s As String
    Set clsGoogle = New clsws_GoogleSearchService
    ' it may return more results but only 10 at a time
    ' so change next call in a loop 0,10, to 10,20 etc. see api site for
params
    Set r = clsGoogle.wsm_doGoogleSearch(cLicensekey, strSearch, 0, 10,
False, "", False, "", "", "")
    Debug.Print "count search results ="; r.estimatedTotalResultsCount
    For i = 0 To UBound(r.resultElements)
        Set re = r.resultElements(i)
        With re
            s = s & UCase(.title) & vbCrLf
            s = s & .snippet & vbCrLf
            s = s & .URL & vbCrLf & vbCrLf
        End With
    Next
    GoogleSearch = s
End Function

Rocky Smolin - Beach Access Software wrote:

> Cool.  I just got an 80GB external HD but it's USB and my current 
> computer has USB1.0 which makes it slower than a stuck pig to write 
> gigabytes to.
>
> The new box from Dell just arrived and I'm thinking it will have USB 
> 2.0. So hopefully that will make fast enough to use as an archive drive.
>
> Rocky
>
> ----- Original Message ----- From: "Bobby Heid" <bheid at appdevgrp.com>
> To: "'Discussion of Hardware and Software issues'" 
> <dba-tech at databaseadvisors.com>
> Sent: Monday, March 21, 2005 10:29 AM
> Subject: RE: [dba-Tech] Drive Copying
>
>
>> Rocky,
>>
>> It does not image the unused space.  It allows you to have several 
>> (or none)
>> levels of compression.
>>
>> My C drive currently takes up about 9GB out of a 35GB partition.  My 
>> last
>> manual back up took about 5.7GB of disk space.
>>
>> Bobby
>>
>> -----Original Message-----
>> From: dba-tech-bounces at databaseadvisors.com
>> [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Rocky 
>> Smolin -
>> Beach Access Software
>> Sent: Monday, March 21, 2005 1:19 PM
>> To: Discussion of Hardware and Software issues
>> Subject: Re: [dba-Tech] Drive Copying
>>
>>
>> Bobby:
>>
>> Does Ghost create an image the size of the source disk or just the 
>> size of
>> the occupied space.  IOW, if I have 20MB of stuff on a 40MB disk will 
>> the
>> ghost image be 20 or 40MB?
>>
>> T&R
>>
>> Rocky
>>
>> ----- Original Message ----- From: "Bobby Heid" <bheid at appdevgrp.com>
>> To: "'Discussion of Hardware and Software issues'"
>> <dba-tech at databaseadvisors.com>
>> Sent: Monday, March 21, 2005 10:05 AM
>> Subject: RE: [dba-Tech] Drive Copying
>>
>>
>>> Andy,
>>>
>>> I used to use Acronis True Image until Ghost 9 came out.  They both do
>>> about
>>> the same thing, but Ghost will allow you to keep X number of 
>>> generations
>>> of
>>> backups and will then automatically delete the older generations as 
>>> that
>>> limit is met.
>>>
>>> What I do is to Ghost my C Drive Sunday morning, then I have it make
>>> incremental backups every morning other than Sunday.  I have it keep 2
>>> generations for that.  Every Wednesday evening, I make another full
>>> backup of my C: drive to a different HD from the above, but the
>>> difference is that every other week, I back that backup off to DVD.
>>> For the Wednesday backups,
>>> I keep 2 generations on the HD.  For my "download files" drive, I have
>>> Ghost
>>> back it up once a month to another HD with incremental backups twice a
>>> week.
>>> This I also let keep 2 generations (at least for now).  I back off this
>>> drive's backups about once every 2-3 months (10 or so DVDs).
>>>
>>> Another utility I use is Karen's Power Tools Replicator.  This allows
>>> you
>>> to
>>> keep a folder (including subs if you want) that stays in synch with
>>> another
>>> folder.  It can (and this is the way I have it set up) keep a daily 
>>> backup
>>> of a given folder for every day of the week.  At the beginning of 
>>> the next
>>> week, it starts over again.  It can mirror deletions.  I have 4-5 jobs
>>> running under this: source code, wife's business docs, family docs, 
>>> email,
>>> etc.  So at any time, I can easily get back to the prior 7 days 
>>> worth of
>>> data for these particular documents.
>>>
>>> As for problems with Ghost, I have not had any.  Been using it for
>>> about 4 months now.
>>>
>>> Bobby
>>>
>>> -----Original Message-----
>>> From: dba-tech-bounces at databaseadvisors.com
>>> [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
>>> Sent: Monday, March 21, 2005 10:29 AM
>>> To: Discussion of Hardware and Software issues
>>> Subject: [dba-Tech] Drive Copying
>>>
>>>
>>> Afternoon folks
>>>
>>> Ok so I decided to beef up my backup capability (been using Disk2Disk
>>> to backup essentials to CD), get a second HD, a USB 2.0 caddy for it
>>> and backup my entire disk to that. Was going to get Ghost 9 to do it
>>> but then read some
>>> horrendous reviews of the product which aside from many and various
>>> problems
>>> agreed on only one thing - if you need tech support forget it. So I
>>> thought
>>> I'd better canvas opinion among the best-informed set of people I 
>>> know -
>>> yes
>>> folks it's you. So who can recommend the greatest, most reliable, 
>>> easiest
>>> to
>>> setup, easiest to use disk imaging software? One requirement I'd have
>>> would
>>> be to schedule overnight backups and not to have to come out of 
>>> Windows to
>>> do it.
>>>
>>> Any thoughts?
>>>
>>> -- 
>>> Andy Lacey
>>> http://www.minstersystems.co.uk
>>>
>>> PS If we've had this before I apologise but I couldn't find anything
>>> in
>>> the
>>> archives.
>>>
>>> ________________________________________________
>>> Message sent using UebiMiau 2.7.2
>>>
>>> _______________________________________________
>>> dba-Tech mailing list
>>> dba-Tech at databaseadvisors.com
>>> http://databaseadvisors.com/mailman/listinfo/dba-tech
>>> Website: http://www.databaseadvisors.com
>>>
>>> _______________________________________________
>>> dba-Tech mailing list
>>> dba-Tech at databaseadvisors.com
>>> http://databaseadvisors.com/mailman/listinfo/dba-tech
>>> Website: http://www.databaseadvisors.com
>>>
>>
>> _______________________________________________
>> dba-Tech mailing list
>> dba-Tech at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/dba-tech
>> Website: http://www.databaseadvisors.com
>>
>> _______________________________________________
>> dba-Tech mailing list
>> dba-Tech at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/dba-tech
>> Website: http://www.databaseadvisors.com
>>
>
> _______________________________________________
> dba-Tech mailing list
> dba-Tech at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-tech
> Website: http://www.databaseadvisors.com
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the dba-Tech mailing list