Re: Insert text and paste command
Re: Insert text and paste command
- Subject: Re: Insert text and paste command
- From: Andrew Oliver <email@hidden>
- Date: Tue, 12 Apr 2005 18:58:02 -0700
On 4/12/05 4:53 PM, "Andrea -XFox- Govoni" <email@hidden> wrote:
> I have to insert some text to the current cursor position, regardless
> which is the active application.
> Since I didn't find an "insert text" command I managed to copy the text
> to the clipboard with the "set the clipboard to" command of Standard
> Additions, but I didn't find the reverse paste command.
> I'm with Mac OS X 10.3.8 and AppleScript 1.9.3.
> Can someone help me?
> TIA and excuse me for the newbie question.
There is no global 'paste' command. You'd need to either target the
application specifically (which takes some trickery given that you don't
know in advance which app that may be), and hope it understands 'paste', or
use UI Scripting to select a menu item.
There's one alternative, though, which is somewhat preferable since it
doesn't involve the clipboard (you have no idea what valuable information
may have been on the clipboard before you destroyed it). You can use UI
scripting to blindly type any keys. If you don't specify an application the
current frontmost app gets them:
set myText to "Supercalifragilisticexpialidocious"
tell application "System Events"
keystroke myText
end tell
You'd just better hope (or, better still, make sure) the front app is
prepared for whatever you type.
Andrew
:)
_______________________________________________
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