一键统计所选内容字符数[Mac]

Mac OS X Hints分享了利用右键快捷按钮一键统计所选内容字符数的 Automator 脚本,内容如下:[下载安装版]

on run {input, parameters}
    try
        set MyText to input as string
        set NombreSignes to the number of characters of MyText
        set NombreMots to the number of words of MyText
        set NombrePara to the number of paragraphs of MyText
        set LeResultat to "The selected text contains :" & return & "- " & NombreSignes & " sign(s) ;" & return & "- " & NombreMots & " word(s) ;" & return & "- " & NombrePara & " paragraph(s)."
        display dialog LeResultat buttons {"OK"} default button 1 with icon note
    on error errmsg number errnum
        display dialog errmsg & " [" & errnum & "]" buttons {"OK"} default button 1 with icon stop

    end try
    return input
end run

此版本仅为法语显示,如果你想要英文版的,可以到这里参考一下方法

评论