Re: Copy text to the clipboard
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