2013-07-28 3 views
1

그래서 도움이 될만한 사람을 위해 빠른 질문을드립니다. 일반 텍스트 편집기에서 프로그래밍 할 때, 종종 나는 여러 줄의 코드를 복사하고, 즉시 연결 한 다음, 보통 Command + c/Command + v와 같이 내용을 붙여 넣기를 원합니다.AppleScript에서 명령을 복사하여 복사하십시오.

저는 이것이 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" 

나를 달성하거나 올바른 방향으로 나를 도와 줄 사람이 있습니까? 미리 감사드립니다.

답변

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 
관련 문제