Re: Insert text and paste command
Re: Insert text and paste command
- Subject: Re: Insert text and paste command
- From: J Stewart <email@hidden>
- Date: Thu, 14 Apr 2005 17:03:05 -0400
On 04/14/05 at +0200 Andrea -XFox- Govoni said this
>Ok, thanks kai, this works in TextEdit but I need that it works in every
>application.
>So the following logical question is: is there a way to determine the
>name of the fronmost application?
>I'll search it by myself, but if anyone knows... :-)
Here's a handler I use that does just that and the syntax to call it. The handler determines for itself what the frontmost application is.
There is a catch to this when run from the Script Menu. Here's some info from the AppleScript v1.9.2 release notes -
Scripts that use the path to frontmost application command will now get the correct path when run from the Script Menu menu extra. Previously, the command would return the path to System Events. [3084984]
--> cut <--
Set thetext to "here's some text to type"
tell app "TextEdit" to activate
my typeText(theText) -- call the handler
on typeText(txt)
tell application "System Events"
set fm to item 1 of (every process whose frontmost is true)
tell fm to keystroke txt
end tell
end typeText
--> cut <--
JBS
--
Any government big enough to do things for you is big enough to do things to you.
_______________________________________________
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