theSIMS -- Applescript copy paste from Explorer
theSIMS -- Applescript copy paste from Explorer
- Subject: theSIMS -- Applescript copy paste from Explorer
- From: email@hidden (Gerd)
- Date: Sun, 17 Mar 2002 21:00:20 +0100
Hallo Tim
do you really need to get the text through IE ?
In my opinion such things work better with 'Webminer'.
Example:
tell application "WebMiner"
set theDoc to open thedatabase
repeat while not complete of theDoc
end repeat
set thecontent to contents of paragraphs of theDoc as text
tell me to savetheresult()
close theDoc
end tell
You can download it:
www.brooklinesoftware.com
regards
Gerd
Message: 1
Date: Sun, 17 Mar 2002 17:22:38 +1100
Subject: Re: theSIMS -- Applescript copy paste from Explorer
From: Timothy Bates <email@hidden>
To: AppleScriptUsers List <email@hidden>
This is made much easier if you select the text in explorer then use its
Jscript object model to grab it for you
--first select the text you want in IE's front window
tell application "Internet Explorer"
set whatIwanted to do script "document.getSelection()"
end tell
On 17/3/02 5:00 PM, "Kai Edwards" <email@hidden> wrote:
on Fri, 15 Mar 2002 17:21:40 -0500, Xandra Lee
<email@hidden>
Has anyone found an applescript only way to copy text from an Explorer
window.
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.
----------------------------------------
property cleanCharList : { [opt-L]
{"“", ASCII character 210}, [opt-L]
{"”", ASCII character 211}, [opt-L]
{"—", ASCII character 208}, [opt-L]
{"’", ASCII character 213}, [opt-L]
{" ", ASCII character 32}, [opt-L]
{space & space, space}, [opt-L]
{tab & tab, tab}, [opt-L]
{return & space, return}, [opt-L]
{space & return, return}, [opt-L]
{return & tab, return}, [opt-L]
{tab & return, return}, [opt-L]
{return & return & return, return & return} [opt-L]
} -- modify list as required
on run
tell application "Internet Explorer" to set html to GetSource
set txt to stripTags(html)
set txt to cleanChars(txt) -- comment out for faster (dirtier) results
set txt to trimTxt(txt) -- ditto
set the clipboard to txt -- or do something else with it
end run
on stripTags(html)
set text item delimiters to "<"
set html to html's text items
set text item delimiters to ">"
set html to (html as string)'s text items
set text item delimiters to ""
set txt to ""
repeat with n from 1 to count html by 2
set txt to txt & item n of html
end repeat
txt
end stripTags
on cleanChars(txt)
repeat with oldNew in cleanCharList
set {oldChar, newChar} to {oldNew's item 1, oldNew's item 2}
repeat while oldChar is in txt
set text item delimiters to oldChar
set txt to txt's text items
set text item delimiters to newChar
set txt to (txt as string)
end repeat
end repeat
set text item delimiters to ""
txt
end cleanChars
on trimTxt(txt)
repeat while txt starts with return
set txt to txt's text 2 thru end
end repeat
repeat while txt ends with return
set txt to txt's text 1 thru -2
end repeat
txt
end trimTxt
----------------------------------------
Best wishes.
Kai
_______________________________________________
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.