Re: AppleScript - paste into message window



On 11/12/05 5:26 AM, in article BF9B4995.2096%me@xxxxxxxxxxx, "Charles
Howse" <me@xxxxxxxxxxx> wrote:

> On 11/12/05 6:46 AM, in article BF9B4049.1F64%me@xxxxxxxxxxx, "Charles
> Howse" <me@xxxxxxxxxxx> wrote:
>
>> Hi,
>> I have an AppleScript that copies a line of text to the clipboard, and I'm
>> looking for a way to paste that into a message.
>>
>> Looking at the Entourage Dictionary in AppleScript, it looks like Entourage
>> doesn't support 'paste'.
>>
>> Is there some workaround or hack so that I can run my script, and have it
>> paste the contents of the clipboard into the message?
>
> OK, sorry to reply to my own post, but I've solved this.
> Here's the script...
>
> do shell script "/Users/Charles/bin/sig.sh"
> tell application "Microsoft Entourage"
> tell application "System Events"
> tell process "Microsoft Entourage"
> click menu item "Paste" of menu "Edit" of menu bar item "Edit"
> of menu bar 1
> end tell
> end tell
> end tell
>

But this method doesn't involve "hacks" like GUI scripting. Check Standard
Additions dictionary for 'the clipboard':

do shell script "/Users/Charles/bin/sig.sh"
tell application "Microsoft Entourage"
activate
set selection to the clipboard
end tell


As with your script, it only works with a text window of some sort (new
message window, notes section of event, task, most fields of a contact
window, or a note) in the front, and should have some error trapping for
that condition.

This method is more reliable than GUI scripting.

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.

.



Relevant Pages

  • Re: Exporting list of projects?
    ... >> Script in the Entourage Script Menu Items folder to run whenever you want. ... but we can't do that since projects - in AppleScript - don't have tasks, ... doing a very tedious repeat loop through all objects in Entourage. ...
    (microsoft.public.mac.office.entourage)
  • Re: Auto loading applescripts?
    ... That's the biggest lack of AppleScript compared to VBA ... there is currently no mechanism of any type to embed a script inside a ... as there is in Entourage. ... Office macros enabled a whole plethora of viruses, ...
    (microsoft.public.mac.office.word)
  • Re: Select Items in Custom View with Applescript
    ... > Entourage does not support multithreading when it comes to Applescript ... then it's OK in a subroutine too. ... you need to use a script object in a subroutine - ask me ...
    (microsoft.public.mac.office.entourage)
  • Re: AppleScript question (slightly OT)
    ... >> If I run the script from the script editor it works, ... >> it from the AppleScript menu in Entourage. ... And the value in that preference key will be returned. ...
    (microsoft.public.mac.office.entourage)
  • Re: Searching for AppleScript references or object model
    ... AppleScript wanting to appear "user friendly", ... > sort of event handling provided by the Entourage object model. ... There are almost _no_ applications which have event handling in AppleScript ... I know only of a couple script editors which are attachable. ...
    (microsoft.public.mac.office.entourage)