Re: Why won't it paste?
Re: Why won't it paste?
- Subject: Re: Why won't it paste?
- From: kai <email@hidden>
- Date: Wed, 17 Nov 2004 04:25:45 +0000
On Tue, 16 Nov 2004 20:45:19 -0500, Ken Brooks wrote:
Thanks, Bill, that was a winner!
Now, where should I have gone to learn that "to end of" syntax?
Probably here - as you did, Ken. ;-)
There are one or two examples of the syntax in the excellent sample
scripts supplied with Tex-Edit Plus. Of course, 'end of' is used a fair
bit around here - often in the context of list manipulation. The term
'beginning of' also works in a similar way. (Tex-Edit Plus actually
interprets these terms respectively as 'last insertion point of' and
'insertion point 1 of'.)
What other "copy target" syntax options might I want to know about?
Well, 'copy x to y' (as opposed to, say, copy [selection]) is really
another AppleScript form that allows a value to be copied from one
object to another. In this case, the 'set' command should also work -
as in the following variation:
----------------------------------
set text item delimiters to return
tell application "Tex-Edit Plus" to set document 2's end to (document
1's paragraphs where "fun" is in it) as string
set text item delimiters to {""}
----------------------------------
(Straying just ever-so-slightly OT, I've long thought Tex-Edit Plus to
be a fine example of a well-implemented, scriptable application. It's
also one of the few *recordable* apps around at the moment - and
therefore a handy way to experiment with some AppleScript basics, IMHO.)
http://www.tex-edit.com/
---
kai
At 10:49 PM -0500 11/15/04, Bill White wrote:
On 11/15/04 10:16 PM, Ken Brooks <email@hidden> wrote:
In the following script, the display dialog command shows me that
the clipboard was set as intended. However, no change ever takes
place in document 2 (and I've also tried designating that window by
name instead of by number). Am I seeing a bug in Tex-Edit Plus? Or
am I making a scripting error?
tell application "Tex-Edit Plus"
tell document 1
set numParagraphs to (count paragraphs )
set nto 1
repeat while n¾numParagraphs
if paragraph ncontains "fun" then
select paragraph n
get paragraph nas text
set the clipboard to result
display dialog (the clipboard )
tell document 2to paste
end if
set nto n+ 1
end repeat
end tell
end tell
Ken,
I think the following will do what you're trying to do, without
gooing it up with "paste":
tell application "Tex-Edit Plus "
tell document 1
repeat with nfrom 1to count paragraphs
if paragraph ncontains "fun "then
copy paragraph nof document 1&return to end of
document 2
end if
end repeat
end tell
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden