Re: UI script fails when run from Mail.app's script menu
Re: UI script fails when run from Mail.app's script menu
- Subject: Re: UI script fails when run from Mail.app's script menu
- From: Joseph Weaks <email@hidden>
- Date: Sat, 20 Mar 2004 14:50:10 -0600
On Mar 20, 2004, at 6:30 AM, Bill Cheeseman wrote:
on 2004-03-19 10:47 PM, Joseph Weaks at email@hidden wrote:
But, when I put a script with this run script line in mail.app's
script
menu, it fails. ...So, what is it I need to know about running
scripts from applications
that have their own script menu?
If you don't get an answer that works, how about posting the most
simplified
version of your script you can write that exhibits this problem...
Here is a simplified version of the function I want, removing the need
to run an outside script. The goal is to have a generic applescript to
be used in any application with a script menu, that will copy the
selected text using UI scripting. To test it, you must have some text
selected in the front window of Mail.app. The script runs fine from
Smile, but fails as a compiled script within Mail.app's script menu.
(*
tell application "System Events" to set theProcess to name of (first
process whose frontmost is true)
-- This works great from an application's script menu to grab the
current app's name, however, it won't work if run from Apple's script
menu (since "System Events" becomes the front app. Any workaround for
that?
--For testing purposes, we'll set the script to run in mail.app
*)
set theProcess to "mail"
set the clipboard to "If you're seeing this, you failed, you loser!"
tell application theProcess
activate
tell application "System Events"
tell application theProcess
keystroke "c" using command down
delay 1 --give it time to update
end tell
end tell
end tell
tell me to activate
display dialog "The clipboard: " & (the clipboard)
I was so excited about it's arrival, but generally speaking, I've been
underwhelmed with the usefulness of UI Scripting.
Thanks,
Joe Weaks
_______________________________________________
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.