我做了一個在這裏,在Github上:
https://gist.github.com/1616556
電流源是:
on run {input, parameters}
tell application "System Events"
set _appname to name of first process whose frontmost is true
end tell
set word_count to count words of (input as string)
set character_count to count characters of (input as string)
tell application _appname
display alert "" & word_count & " words, " & character_count & " characters"
end tell
return input
end run
使用Automator.app創建一個新的服務,然後選擇運行AppleScript動作。將此代碼粘貼到文本框中,並保存爲Word和Character Count。現在切換到一個新的應用程序,選擇一些文本,並打開上下文菜單找到新的選項。
感謝您的答案 - 我有沒有使用字符串的問題,所以謝謝你澄清了。 – 2009-09-08 02:01:01