Re: Clippings to Simple Text
Re: Clippings to Simple Text
- Subject: Re: Clippings to Simple Text
- From: "Christopher C. Stone" <email@hidden>
- Date: Sun, 31 Dec 2000 17:44:44 -0600
At 12/31/00 12:32 +0100, Bernard Azancot wrought:
>
Is there a way to change Clippings to Simple Text using AS ?
___________________________________________________________________________
Hello Bernard,
Certainly there is, but you need to use a scripting addition (osax) to do so.
Tanaka's osax is one of the most useful:
http://mtlab.ecn.fpu.ac.jp/mySamples/Tanaka_osax_2.0.sit
--
set clp to alias "Minerva:Desktop Folder:Quote clipping"
set t to MT Read Clipping clp
--
This script will get the text of all clippings in the src folder and copy it to a new file on the desktop ("Clippings.ccs"):
set src to alias "Lao-Tzu:Holding Bin:Clip: Quotes:"
set dest to (path to desktop as string) & "Clippings.ccs"
tell application "Finder"
set cList to every clipping of src
set cNmList to name of every clipping of src
end tell
set cCnt to count of cList
set txt to ""
if cCnt is not 0 then
repeat with i from 1 to cCnt
set clp to item i of cList
set itmNm to item i of cNmList
set txt to txt & "==== " & itmNm & " ====" & return & return
set txt to txt & (MT Read Clipping clp) & return & return
end repeat
end if
try
set f to open for access dest with write permission
write txt to f
close access f
on error errText number errNum
close access f
beep
tell me to display dialog errText & return & return & "Error: " & errNum with icon 2
end try
tell application "SimpleText"
activate
open file dest
end tell
--
Note that SimpleText is only able to display a maximum of 32K of text. I would highly recommend that you download, use, and ultimately buy Tex-Edit Plus (if you like it).
http://www.nearside.com/trans-tex/index.html
It's a styled-text editor which is highly scriptable and has an excellent feature set. ($15.00 Shareware - not crippled in any way.)
--
There are other ways to do this of course. You can get the clipping data with other osaxen:
Akua Sweets
Resource Utilites
and others.
You can write the text data to the file in steps rather than all at once.
You get the idea.
--
This script is similar to the one above but uses Tex-Edit to receive the clipping text:
set src to alias "Lao-Tzu:Holding Bin:Clip: Quotes:"
set dest to (path to desktop as string) & "Clippings.ccs"
tell application "Finder"
set cList to every clipping of src
set cNmList to name of every clipping of src
end tell
set cCnt to count of cList
set txt to ""
if cCnt is not 0 then
tell application "Tex-Edit Plus"
set newDoc to make new document
repeat with i from 1 to cCnt
set clp to item i of cList
set itmNm to item i of cNmList
set end of newDoc to "==== " & itmNm & " ====" & return & return
set end of newDoc to (MT Read Clipping clp) & return & return
end repeat
end tell
end if
--