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: Arthur Knapp <email@hidden>
- Date: Thu, 20 Nov 2003 13:38:14 -0500
Date: Thu, 20 Nov 2003 08:40:05 -0500
From: David Hoerl <email@hidden>
Subject: Frustrated novice wants to paste the clipboard
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.
Right. Often, it's not intuative. Each application wants to do things
in its own way, etc.
What I am trying to accomplish is to paste the clipboard "as plain
text" into the foremost window of Eudora.
copy the (clipboard as type plain text) to window 1
I don't have Eudora, but I do have a few comments about figuring out
HOW to do things in AppleScript.
Some applications do indeed have their own "clipboard" command, but
many (most) do not, so it's a good idea to understand exactly how to
use "the clipboard" command provided by Standard Additions. Let's look
at its dictionary entry:
the clipboard: Return the contents of an applications clipboard. Use
in a tell block after activating the application (defined in:
StandardAdditions.osax)
the clipboard
[as type class] -- the type of data desired
Result: list of anything -- the data from its clipboard
One interesting thing you'll notice is that the full command name is
"the clipboard" and not just "clipboard." The example you pasted looks
like this:
copy the (clipboard...
Do you see how the parenthese has seperated "the" from "clipboard?"
If Eudora doesn't define its own clipboard command, then you're going
to be in trouble here.
When you use "the clipboard" from Standard Additions, you're
generally looking to extract its value to a variable and then use a
"set SOMETHING to EXTRACTED_TEXT" statement, rather than "copy and
pasting" the content.
Again, I don't have Eudora, but try something along these lines:
tell application "Eudora"
activate --> as stated in the dictionary entry for "the clipboard"
set str to (the clipboard as string)
-- I'm just guessing at command names for Eudora:
--
set selection of window 1 to str
-- or maybe:
set end of message 1 to str
-- etc...
So, would I like the command to accomplish this? Yes. 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.
Each application tends to be a whole different world of scripting
unto itself. There aren't many shortcuts to learning this language. Its
takes lots of practice in working with specific apps to understand the
best ways to do something.
{ Arthur J. Knapp;
<
mailto:email@hidden>;
Why do programmers confuse Halloween and Christmas?
Because Oct 31 == Dec 25.
}
_______________________________________________
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.