Need to search the web (was: An unsolicited message on my Rev address)

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Dec 5 22:39:25 EST 2005


Hi Kay,

I feel I *must* reply ;-)
You don't need to open your browser: make the query from Rev and  
parse the results by yourself...
Something like the following will do the trick:
(Take care of unwanted cr)

put StripTags(url "http://www.alltheweb.com/search? 
cat=web&cs=iso88591&q=Richard+Gaskin&rys=0&itag=crv&_sb_lang=pref")

Where "Richard Gaskin" is the query made to alltheweb
And the StripTags function returns the plain text of the web page:

function StripTags pHtml
   local tRegex,tPrevText
   constant kHtml =  
"é,à,ç,>,<,ecirc;,è,©,•,&#39 
;,·,&"
   constant kConvertedHtml = "é,à,ç,>,<,ê,è,©,•,',·,&"
   -----
   replace return with space in pHtml
   replace numtochar(13) with empty in pHtml
   replace tab with empty in pHtml
   -----
   put replacetext(pHtml,"(?Usi)<SCRIPT.*</SCRIPT>","") into pHtml
   put replacetext(pHtml,"(?Usi)<STYLE>.*</STYLE>","") into pHtml
   put replacetext(pHtml,"(?Usi)<\?.*\?>","") into pHtml
   -----
   replace " " with space in pHtml
   replace "<BR>" with return in pHtml
   replace "<p>" with return in pHtml
   -----
   put  "<[^><]*>" into tRegex
   put replacetext(pHtml,tRegex,"") into pHtml
   put replacetext(pHtml,tRegex,"") into pHtml
   -----
   repeat until tPrevText is pHtml
     put pHtml into tPrevText
     put replacetext(pHtml," +",space) into pHtml
     put replacetext(pHtml,"^ ","") into pHtml
   end repeat
   -----
   replace (space & return) with return in pHtml
   replace (return & space) with return in pHtml
   filter pHtml without empty
   -----
   replace """ with quote in pHtml
   repeat with i = 1 to the number of items of kHtml
     replace item i of kHtml with item i of kConvertedHtml in pHtml
   end repeat
   -----
   return pHtml
end StripTags

Hope you'll get started with that!

Best Regards from Paris,

Eric Chatonet.

Le 6 déc. 05 à 04:21, Kay C Lan a écrit :

> Eric Chatonet wrote:
>
>> I never had the idea to search for mail addresses on the web :-)
>>
>
> This is a well timed thread which might help me with a small  
> problem I am
> having.
>
> I recently wrote a stack that reads log files and places a portion  
> of the
> retreived info into ' the clipboard'. An answer dialog asks me what  
> I what
> to do with that info, ignore or keep. In most cases I know from the  
> info
> what I want to do, but sometimes I need to search the web to get more
> details; so I load a search URL, the page opens in my default  
> browser with
> the cursor in the search field, as the data is already in the  
> clipboard a
> simple 'paste + return' gets the search going. Here is a portion of  
> the
> code:
>
>   set the clipboardData["text"] to item 2 of line 1 of tMyLog --line 1
>   revGoURL "http://www.alltheweb.com/" --line 2
>   go to card 1 of stack "Log File Reader" --line 3
>   show stack "Log File Reader" --line 4
>   answer question "What should I do with:" & return & line 1 of  
> tMyLog &
> return & "For User: " & tMyUser with "Ignore" or "Keep" titled  
> "File " &
> pMyCurrentFileNumber & " of " & pMyTotalNumberOfFiles & ": Organize  
> " &
> tMyUser & " Entry" --line 5
>
> What I would like to happen is the web page, which basically takes  
> up the
> entire screen, load in the background whilst my stack, which is only
> 400x400, comes to the front and the answer dialog is front most. It  
> is then
> a simple case of clicking on the 'Ignore' or 'Keep' buttons or  
> click on the
> browser to make it active so I can 'paste + return'.
>
> Unfortunately what is happening is that no matter what I seem to  
> do, lines 3
> and 4, the browser is always front most and so it is quite a pain to
> reactivate Rev so I can see the answer dialog. I thought about using
> Applescript to 'activate' Rev, but I'd prefer something cross  
> platform.
>
> Any suggestions welcome.
>
> Thanks
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list