1

所以我有一个简短的问题想问任何愿意提供帮助的人。当我在常规文本编辑器中编程时,我经常发现自己想要复制多行代码,将它们即时连接起来,然后能够像通常使用 Command+c/Command+v 一样粘贴它们的内容。

我认为这将在 Applescript 中完成,然后使用 Quicksilver 分配一个自定义快捷方式,但我也不太熟悉。下面是一个示例来说明所需的行为。

Copy-Concatenate with Command+C+X  Paste with Command+V  Clear Clipboard when regular Command+C is used

so...
Command+C+X "First line" ... Command+C+x"Second line" ... Command+V pastes "First lineSecond line"
and Command+C"Third line"... Command+V pastes "Third line"

有人可以帮助我完成这项工作或让我走上正确的道路吗?先感谢您。

4

1 回答 1

1

在编辑器中选择文本并尝试以下操作:

tell application "System Events" to keystroke "x" using command down
set myText to the clipboard as «class utf8»
set {TID, text item delimiters} to {text item delimiters, {return, linefeed, character id 8233, character id 8232}}
set myText to text items of myText
set AppleScript's text item delimiters to space
set the clipboard to myText as text
set text item delimiters to TID
tell application "System Events" to keystroke "v" using command down
于 2013-07-28T13:17:02.483 回答