I have a script that appends the text of a text edit document. This achieves the desired result so far.
script example:
tell application "TextEdit"
set paraCount to count of paragraphs of document 1
set theCB to (the clipboard)
set cbClass to class of (the clipboard)
if cbClass is Unicode text then
try
tell document 1
set paragraph (paraCount) to (paragraph (paraCount) & return & return & theCB)
end tell
end try
end if
close document 1
end tell
However, the close document will produce a save dialog for the modified file. I do not want to save the document changes.
Anyone know how to bypass this dialog in AS?
dee
close document 1 without saving
So now that this part works, here’s another one…
tell application “TextEdit”
set paraCount to count of paragraphs of document 1
set theCB to (the clipboard)
set cbClass to class of (the clipboard)
if cbClass is Unicode text then
try
tell document 1
set paragraph (paraCount) to (paragraph (paraCount) & return & return & theCB)
end tell
end try
end if
close document 1 without saving
end tell
This places the contents of the clipboard into the current TextEdit document but only if it is text. I would also like to be able to do other forms of clipboard data. I had tried adding the returns to the end of the document and the using system events to paste in the clipboard but this didn’t work
Any ideas?
Dee
Is your document 1 an rtf file? If it’s .txt it won’t accept anything but text.