• 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: Copy text to the clipboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy text to the clipboard


  • Subject: Re: Copy text to the clipboard
  • From: kai <email@hidden>
  • Date: Mon, 5 Dec 2005 21:19:52 +0000


On 5 Dec 2005, at 20:49, I wrote:

For more accurate quoting in certain situations...

Actually, the possibility of some clipboard sluggishness could result in a failure here. For a bit more reliability, it might be worth considering this somewhat lengthier approach:


-----------------

on quoted_text(t)
	set d to text item delimiters
	repeat with c in {"\\", "\""}
		set text item delimiters to c
		set t to t's text items
		set text item delimiters to "\\" & c
		tell t to set t to beginning & ({""} & rest)
	end repeat
	set text item delimiters to d
	"\"" & t & "\""
end quoted_text

set appName to (info for (path to frontmost application))'s short name
tell application "System Events" to tell process appName
	set frontmost to true
	set the clipboard to ""
	repeat until (the clipboard) is ""
		delay 0.1
	end repeat
	keystroke "c" using command down
	repeat while (the clipboard) is ""
		delay 0.1
	end repeat
	set c to the clipboard
	set the clipboard to my quoted_text(c)
	repeat while (the clipboard) is c
		delay 0.1
	end repeat
	keystroke "v" using command down
end tell

-----------------

---
kai


_______________________________________________ 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: Copy text to the clipboard
      • From: "Brett K." <email@hidden>
References: 
 >Re: Copy text to the clipboard (From: "John R." <email@hidden>)
 >Re: Copy text to the clipboard (From: kai <email@hidden>)
 >Re: Copy text to the clipboard (From: "John R." <email@hidden>)
 >Re: Copy text to the clipboard (From: kai <email@hidden>)

  • Prev by Date: Re: Copy text to the clipboard
  • Next by Date: Re: INDESIGN - Reference to all boxes in document
  • Previous by thread: Re: Copy text to the clipboard
  • Next by thread: Re: Copy text to the clipboard
  • Index(es):
    • Date
    • Thread