Re: theSIMS -- Applescript copy paste from Explorer
Re: theSIMS -- Applescript copy paste from Explorer
- Subject: Re: theSIMS -- Applescript copy paste from Explorer
- From: Kai Edwards <email@hidden>
- Date: Sun, 17 Mar 2002 16:04:13 +0000
on 17/3/02 7:31 am, Applescript User Lewis at email@hidden
wrote:
>
At 06:00 +0000 17/03/02, Kai Edwards wrote:
>
> If you want a vanilla method for this, I've cobbled together a routine below
>
> which goes a reasonable way towards grabbing Explorer html code and
>
> converting it to plain(er) text.
>
>
This is very nice _IF_ the page is short. Otherwise, there is a stack
>
overflow
>
>
> set html to html's text items
>
>
there.
OMM, I'm afraid that just gives me a list of all text characters returned by
OE's 'GetSource' command - and it still includes all html tags and codes.
>
You can't set a start and end delimiter, can you?
AFAIR, the limit for a list is somewhere in the region of 4,000 items.
(FWIW, Apple's home page currently contains 13,593 characters.)
It's a bit academic for me but, if I really wanted to work with such a list,
I'd probably try something like this:
-------------------------
property chunkSize : 2000
tell application "Internet Explorer" to set html to GetSource
set htmlCount to count html's text items
set htmlChars to {}
repeat with n from 1 to htmlCount by chunkSize
set {theChunk, remainingItems} to {chunkSize - 1, htmlCount - n}
if remainingItems < chunkSize then set theChunk to remainingItems
set htmlChars to htmlChars & html's text items n thru (n + theChunk)
-- do something with htmlChars
end repeat
-------------------------
While the result could exceed Script Editor's 20,000 character display
limit, one should still be able to do something else with it - without
causing a major upset.
If you really are getting clean text returned instead of a list, the above
method could be modified to handle text instead.
Best wishes.
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************
_______________________________________________
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.