Ways to get text from browser?

Jim Ault JimAultWins at yahoo.com
Thu Jan 11 14:24:36 EST 2007


On 1/11/07 10:55 AM, "RGould8 at aol.com" <RGould8 at aol.com> wrote:

>>> Can anyone tell me the Applescript call to make in Revolution to 
>>> retrieve the
>>> text that's presently in the browser window (either Safari or IE - 
>>> - - I
>>> understand that Firefox is not Applescriptable yet)

You may not need this, but the applescript for Safari is a very useful
technique to know.
Some web sites require a login or other security and this is handled by
Safari and the KeyChain.  Also, there are certificates and other limiting
factors that are difficult to do with simple Rev calls, or even AltBrowser.
I have built a program that uses AltBrowser everyday and it has been working
great  for about 1.5 years.

(1)  simple rev call to revGoUrl
  revgourl "http://www.runrev.com/" --will open the browser
If you are navigating using Rev, then you already know what you need in
order to do the next step without Safari or AltBrowser.

(2) putting source text directly into a Rev variable
put url (" http://www.runrev.com/") into sourceText

(3) If you use Safari and are displaying the page you want as the frontmost
window, then use
tell app "Safari" method as a one-liner

put "tell app "&quote&"Safari"&quote& \
   " to return(the source of document 1)" into cmd
do cmd as applescript
put the result into sourceText

put "tell app "&quote&"Safari"&quote& \
   " to return(the url of document 1)" into cmd
do cmd as applescript
put the result into urlToSave

Hope this helps you.

Jim Ault
Las Vegas







More information about the use-livecode mailing list