• 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: replacing selected text in a document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: replacing selected text in a document


  • Subject: Re: replacing selected text in a document
  • From: David Rice <email@hidden>
  • Date: Tue, 15 May 2007 20:43:21 -0400

Thanks, Nigel.

That worked. But, if I may, why does this not work?
on process(_str)
	tell application "System Events"
		set _appname to name of first process whose frontmost is true
	end tell
	tell application _appname
		set _str to "[" & _str & "]"
		keystroke _str
	end tell
end process

And is there a way to paste into the front app. The clipboard is set to the appropriate string because after running the script I originally posted, doing a Command V pasted in the desired info.

Thanks, again

David



On 15-May-07, at 8:29 PM, Nigel Garvey wrote:

 on process(_str)
    set _str to "[" & _str & "]"

    -- Assuming that TextEdit is frontmost with
    -- a selection in its front document...
    tell application "System Events"
      keystroke _str
    end tell
  end process

_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: replacing selected text in a document
      • From: "Nigel Garvey" <email@hidden>
References: 
 >Re: replacing selected text in a document (From: "Nigel Garvey" <email@hidden>)

  • Prev by Date: Re: replacing selected text in a document
  • Next by Date: Re: Appending text?
  • Previous by thread: Re: replacing selected text in a document
  • Next by thread: Re: replacing selected text in a document
  • Index(es):
    • Date
    • Thread