ClipMenu似乎忽略 「瞬時」 剪貼板,所以你還需要拷貝動作之間的延遲:
read POSIX file "/Users/username/Documents/test.txt" as «class utf8»
repeat with p in reverse of paragraphs of result
if contents of p is not "" then set the clipboard to contents of p
delay 1
end repeat
或者使用UI腳本:
個
delay 1
tell application "TextEdit"
activate
set n to number of paragraphs of document 1
end tell
tell application "System Events"
key code {125, 123} using command down
repeat n times
key code 124 using {shift down, command down}
keystroke "c" using command down
key code 126
delay 1
end repeat
end tell
關鍵碼列舉在Events.h。
然後第二個工作,但行的每個文本文件的數量而變化。我可以設置重複重複,直到它到達第一行嗎?謝謝。 – dusanvf
我編輯了答案。第一個腳本也適用於我,但是您是否正確指定路徑? – user495470
現在它可以工作,但它不會複製第一行。我該如何解決這個問題?謝謝。 – dusanvf