• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Insert text and paste command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Insert text and paste command
      • From: Joseph Weaks <email@hidden>
References: 
 >Re: Insert text and paste command (From: Andrea -XFox- Govoni <email@hidden>)

  • Prev by Date: RE: Display Dialog - resolved.
  • Next by Date: Re: Re: Selecting mail message by ID
  • Previous by thread: Re: Insert text and paste command
  • Next by thread: Re: Insert text and paste command
  • Index(es):
    • Date
    • Thread