• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: theSIMS -- Applescript copy paste from Explorer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: theSIMS -- Applescript copy paste from Explorer


  • Subject: Re: theSIMS -- Applescript copy paste from Explorer
  • From: Lars DeRuntz <email@hidden>
  • Date: Fri, 15 Mar 2002 17:26:11 -0800

Not that its perfect or anything, but using the "GetSource" feature of IE on the MAc, and
AppleScript's text item delimiters, I have been able to extract the text of a web page.
Currently, it also extracts sections that are commented out too, but I will fix that if I
ever need to

here is the code you might be interested in:

tell application "Internet Explorer"
set alphaSource to GetSource
end tell

set AppleScript's text item delimiters to the return
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the ""
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the ASCII character 10
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the ""
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the ASCII character 9
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the ""
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "<BR>"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the (return)
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "<br>"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the (return)
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "<P>"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the (return)
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "<p>"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the (return)
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "</TR>"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the (return)
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "</tr>"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the (return)
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "</TD>"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the " " --(ASCII character 9)
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "</td>"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the " " --(ASCII character 9)
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "&#8212;"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the "--"
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the "&nbsp;"
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the " "
set alphaSource to the item_list as string

set AppleScript's text item delimiters to the " "
set the item_list to every text item of alphaSource
set AppleScript's text item delimiters to the " "
set alphaSource to the item_list as string

set AppleScript's text item delimiters to ">"
set SourceList to every text item of alphaSource

repeat with i from 1 to the count of the SourceList
set AppleScript's text item delimiters to "<"
set this_item to item i of the SourceList
set the item_list to every text item of this_item
set AppleScript's text item delimiters to the ""
if (count of item_list) is equal to 2 then
--display dialog item 1 of item_list
set item i of the SourceList to the item 1 of item_list as string
end if
end repeat

set AppleScript's text item delimiters to the " "
set SourceList to the SourceList as string

-->Result is text of web page(with perhaps some javascript code, and other things that were commented out)

-Lars DeRuntz
iLogistix
Fremont, CA

Cortland Haws wrote:

> It looks like all there is in IE is a selected object. I recommend that you
> try opening your HTML document in OmniWeb
> (www.google.com/search?btnI=&q=OmniWeb) and script it instead. (You should
> be able to call and get the source.) As a last resort, have it open the HTML
> in TextEdit as plain text and get it from there.
> On 3/15/02 2:21 PM, "Xandra Lee" <email@hidden> wrote:
>
> > Has anyone found an applescript only way to copy text from an Explorer
> > window.
> >
> > An explanation:
> > Not that I don't have a life, but I wrote a Filemaker database to track
> > my progress in the Sims.
> >
> > To get the data into FMP I wrote an Applescript which parses (copied)
> > text from (a redesigned) Web Page output by the SIMs. Oddly, the only
> > glitch has been copying text from the Explorer window. I can't even seem
> > to get Sigmas Addition to do this, and have had to resort to using
> > Quickeys.
> >
> > xandra
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: theSIMS -- Applescript copy paste from Explorer (From: Cortland Haws <email@hidden>)

  • Prev by Date: Re: Have files, want one script for each; how to automate creation of these scripts?
  • Next by Date: Entourage close main window
  • Previous by thread: Re: theSIMS -- Applescript copy paste from Explorer
  • Next by thread: Entourage close main window
  • Index(es):
    • Date
    • Thread