しぐまっく

愛機MacBook Pro(Mid 2010)を研究やら趣味やらに使っている際のおぼえがき.homebrewとかlinuxとかwebサービスとかも.

mi.appにて単語カウントする方法

Mac用テキストエディタのmi (ミミカキエディット) にはデフォルトで文字カウント機能はある.しかしMS Wordのように,(英)単語数を数える機能が無いので,"ツール" に単語カウントする機能をつける方法を載せる.

方法

[Ref] MacWiki - mi
AppleScriptエディタにて

tell front document of application "mi"
	if not (exists it) then return
	set theText to content of selection object 1 -- 選択範囲
	if theText is "" then set theText to content -- 選択されてなければ書類全体
	display dialog "ワードカウント結果" & return & return & ¬
		"文字数:" & number of every character of theText & return & ¬
		"単語数:" & number of every word of theText & return & ¬
		"段落数:" & number of every paragraph of theText
end tell

という内容のAppleScriptファイルを作成する.
任意の名前で,/Users/ユーザ名/Library/ApplicationSupport/mi/mode/Normal/tool/ に保存.
mi.app のモード設定−ツールで,"フォルダから再構成" をクリック.