
デザイン・レイアウト作業やテキストエディタでの執筆のとき,「□□□□□□□□□■□□□□□□□□□■」のようなダミー文字を使うことがあります。10文字(または5文字)ごとに見た目が変わるため,文章がどのくらいのスペースを占有するか,指定された文字数はどの程度の長さかを大雑把に測るのに役に立ちます。
かつてはダミーくんというアプリケーションで生成していたそうですが,対応機種がMac PPCとあり今やロストテクノロジーです。
そこで今回はダイアログで文字数を指定してダミーテキストを生成し,クリップボードにコピーするAutomatorサービス(クイックアクション)を紹介します。
こちらのAutomatorサービス(クイックアクション)をダウンロードし,Finderで開くなどしてインストールしてください。
使いかた
アプリケーションメニューから サービス:ダミーテキストを生成する を選んでください。ダイアログが出るので,そこに必要な文字数を入力します。
ダイアログでは四則演算できるため,例えば 20 * 3 と入力すれば20文字×3行=60文字分のテキストが取得できます。
OKすると指定した長さのダミーテキスト+文字数の値がクリップボードにコピーされます。12文字を指定した場合「□□□□□□□□□■□□12」となります。あとはInDesignなりテキストエディタなり,お好きなアプリにペーストして加工してください。
これでまた少し仕事が速くなりました。今日もさっさと仕事を切り上げて好きなことをしましょう!
コードはこちら
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
on run tell current application set dummy_text to "□□□□□□□□□■" as text set retval to display dialog "文字数(または式)" default answer "100" set formula to text returned of retval set com to ("echo " & quoted form of formula & " | bc") as text set num to (do shell script com) as integer if (num is less than or equal to 0) then display notification "0" with title "文字数" return end if set arr to {} set char_count to (count (every character of dummy_text)) set len_units to num div char_count repeat with i from 1 to len_units set end of arr to dummy_text end repeat set text_1 to character 1 of dummy_text as text set len_1 to num mod char_count repeat with i from 1 to len_1 set end of arr to text_1 end repeat set res to (arr & num) as text set the clipboard to res display notification res with title "コピー済" end tell end run |
このサイトで配布しているスクリプトやその他のファイルを,無断で転載・配布・販売することを禁じます。
それらの使用により生じたあらゆる損害について,私どもは責任を負いません。
スクリプトやファイルのダウンロードを行った時点で,上記の規定に同意したとみなします。