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 20:49:23 +0000
On 5 Dec 2005, at 19:47, John R. wrote:
On Dec 5, 2005, at 1:50 PM, kai wrote:
Either of my earlier suggestions (scpt or app) work fine for me
(10.4.3):
What happened when you tried them?
Thank you, kai, for pointing me right to the earlier posting. I had
overlooked it. Works great. Appreciate the help. For example, a
useful little "Quote This" menu script as follows:
set appName to (info for (path to frontmost application))'s short name
tell application "System Events"
set process appName's frontmost to true
keystroke "c" using command down
set the clipboard to "\"" & (the clipboard) & "\""
keystroke "v" using command down
end tell
Right. For more accurate quoting in certain situations (if, for
example, the selected text is destined for an AppleScript 'display
dialog' command), you might want to consider something that treats
existing backslashes and quotation marks appropriately:
-----------------
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"
set process appName's frontmost to true
keystroke "c" using command down
set the clipboard to my quoted_text(the clipboard)
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