Re: Frustrated novice wants to paste the clipboard
Re: Frustrated novice wants to paste the clipboard
- Subject: Re: Frustrated novice wants to paste the clipboard
- From: Walter Ian Kaye <email@hidden>
- Date: Thu, 20 Nov 2003 06:57:59 -0800
At 08:40a -0500 11/20/2003, David Hoerl didst inscribe upon an
electronic papyrus:
Sigh. What is more troubling than not being able to figure out how
to do something is that I cannot figure out the PROCESS of learning
how to do what seem to be simple things with AppleScript. I have the
O'Reilly book, and the Intro on AppleScript, and I've opened the
Standard Editions dictionary and the application dictionary.
I think the process is "osmosis" :)
What I am trying to accomplish is to paste the clipboard "as plain
text" into the foremost window of Eudora. This application does not
let you record actions so I cannot use the RECORD feature to help me
out here. [Guess I could try some other application to do this, but
its not knowing HOW to find this out which is most frustrating.]
However, my experience tells me this is one reason that so few
people use AppleScript - its just so d*mn hard to get the simplest
thing done without a lot of digging.
Well, sometimes the simplest thing was simply not implemented by the
particular application's developers. It's not AppleScript's fault. It
might be an evangelist's fault, but not the technology's.
So, I'm sure most of you can tell me in an instant what line of code
I need to make this work.
This is what I tried:
copy the (clipboard as type plain text) to window 1
The process I followed was to first open the Eudora dictionary and
look for some command that approximated "copy" or "paste". Not found.
They didn't implement it.
So I look in the Standard Additions dictionary. Nope.
Well, Panther has it in System Events. (Puppet the Edit menu...)
So I right click the mouse and see if anything there. Nope.
Majnun sifts through the sands to find Layli. Madness takes its toll...
So, would I like the command to accomplish this? Yes.
If you're on Panther, see above.
Otherwise you could use QuicKeys to do a paste.
If you can get by with inserting the text at the very top or very
bottom of the message, then you could script getting the body of the
message, prepending or appending text to it, and then setting the
body of the message to the result. And to unstyle the text
beforehand, you could use a fancy trick like this:
try
set {t} to text of (the clipboard as record)
on error
set t to the clipboard
end try
--do something with t, like prepend or append to existing message body
But what I'd REALLY like is to better understand HOW I can on my own
figure out how to accomplish tasks such as this.
I think you just need to understand who implements what.
For example, the menu command Edit:Paste is application specific. The
only thing systemwide about its function is conceptual. There are
developer frameworks for making it easier to implement, but it is
still implemented by the application developer.
And just because it's implemented in the UI doesn't mean it's
implemented in scripting. Fortunately there are sometimes workarounds!
-Walter
sounding entirely too much like a programmer
(i'm not one! i swear! it's that osmosis thing again.)
_______________________________________________
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.