|
ヘルプ: アップルスクリプトTextExpander
アップルスクリプトを使って、TextExpanderの環境設定を変更したり、スニペットとグループを追加したり削除したりできます。
書き込み可能な環境設定
AppleScriptでアクセスしたり変更したりできる環境設定には、TextExpanderの環境設定ウィンドウで見れるいくつかの設定と、付随するコントロールを持たないいくつかの設定が含まれています。
- expansion enabled
- ブーリアンフラグが拡張可能か(大文字校正)を管理します。
(環境設定の拡張参照)
- include HTML
- ブーリアンフラグがフォーマット化されたスニペットコンテントを挿入する時にHTMLデーターが含まれているかどうか管理する。
(環境設定の拡張参照)
- restore pasteboard
- ブーリアンフラグが前のペーストボードコンテントがスニペットコンテントを貼付けた後で復元されたかどうか管理します。
(環境設定の拡張参照)
- capitalize new sentences
- ブーリアンフラグが大文字校正機能が新文章の最初の単語を自動的に大文字化したかどうか管理します。
(環境設定オプション参照)
- suppress double capitals
- 列挙コントロールが、大文字化校正機能が単語の始めの2大文字を一つに校正したかどうか管理します。
(環境設定オプション)
- restore clipboard regardless
ブーリアンフラグが、スニペットを拡張するために設定されたスニペットコンテントに適合しないクリップボードを復元するかどうか管理します。アプリケーションやユーテイリテイーがペーストボードのコンテントを変更する時に便利です。
例えば、TextMate 1.5.10 はテキストが作成されると同時にペーストボードを変更し、その結果TextExpanderは、前のクリップボードコンテントを復元しません。
- tap key up events
TextExpanderはスニペット略語をタイプすると自動的に検索のためにタップしますが、ブーリアンフラグはTextExpander
がkey-upイベントとkey-downイベントをタップするかどうか管理します。
この機能のおかげで、TextExpanderがNuance's Dragon
productsやMicrosoft IntelliPoint mouse
driverのように人工キーストロークを作成するアプリケーションやハードウェアードライブとより効率的に仕事をします。
- avoid querying keyboard layout
ブーリンフラッグはTextExpanderがキーボードレイアウト情報のためのアクテイブ入力方法を問い合わせるのを回避するかどうか管理します。
Sugou IM等の入力方法での遅延なタイプを防ぐのに役立ちます。しかし、これによりTextExpanderが例えばDvorakキーボードレイアウトを使う時に(スニペット拡張でVコマンドをペーストに送るために)正しいVキーを探せなくなります。
- always pause before Pasting
ブーリンフラッグは、TextExpanderがスニペットの拡張時に使われているアプリケーションの種類に関わらず、ペーストの前に短い休止をするかどうか管理します。
TextExpander
はスニペット拡張をクリップボード上に設置し、すぐにコマンドVをペーストに送ります。
いくつかのアプリケーションでは、新しいクリップボードコンテントが登録され、拡張が期待通りに行われるように短い遅れが生じます。ペーストの前の短い休
止によって、スニペット拡張の代わりに生じるペーストボードコンテントの問題を解決することが出来ます。いくつかのクリップボードユーテイリテイはペース
トボードの変更を変えたり緩めたりするからでしょう。
デフォルトの際には、TextExpanderはペーストの前に休止します: Pages, Numbers, Keynote, Mail,
Spotlight, Fantastical, XcodeとほとんどのMicrosoftアプリケーション
- pause before Pasting bundles
- ペーストする前に休止する追加のアプリケーションのIDバンドル(例
com.apple.Safari )を伴うテキスト記号列(デフォルトアプリケーションは下記にリストアップされています。)
- pause before Pasting time
- ペーストの前にTextExpander が休止する時間(秒)の管理。デフォルト値は0.2秒です。
- pause after Pasting bundles
ペーストした後で休止する追加のアプリケーションのIDバンドル(例 com.apple.Safari )を伴うテキスト記号列。
TextExpander
が、スニペットコンテントのペーストにCommand-Vを送信した後に、追加のキーストロークがすぐ送られることがあります。区切り記号で拡張するか、
スニペットにタブやリターン等が含まれる時には、キーストロークか矢印キーが要求され、スニペット内のどこかに挿入カーソルを配置します。いくつかのアプ
リケーションでは、連続するキーストロークを受け取る前のペーストを実行するために短時間の遅延が生じるようです。スニペットの部分が間違った順序や間
違った位置に表示されたときは、そのアプリケーションこのリストに追加して下さい。
デフォルトの際には、TextExpanderは以下のアプリケーションにペーストした後で休止します: Pages, Numbers,
Keynote, Microsoft Word, Microsoft Powerpoint, Safari, Google Chrome,
Firefox, Camino, SeaMonkey.
- pause after Pasting time
- ペーストの後にTextExpander が休止する時間(秒)の管理。デフォルト値は0.2秒です。
- avoid expansion bundle prefixes
拡張か大文字化の校正を防止するアプリケーションのIDバンドル(または、部分的接頭辞、例えば com.mozilla は com.mozilla.firefox
とcom.mozilla.camino 等をカバーします)を伴うテキスト記号列。 デフォルトの際には、TextExpanderはIDバンドルがcom.parallelsか com.vmwareで始まるアプリケーションに拡張されるのを防ぎます。
この機能により、TextExpanderが、拡張環境設定にリストアップされている「・・以外の全てのアプリケーション」上に表示されないアプリケーションやJava appletsと連動するのを防いでくれます。(Java appletsでの拡張を防ぐために、このリストにcom.apple.javajdk16.cmdを追加して下さい (JDKの異なるバージョンのために適当に変化させる)。)
- allowed computation time
- Seconds before snippet content computation times out. By default, TextExpander allows script snippets 5 seconds to compute. This value can be adjusted up to 28 seconds if some of your script snippets take a long time to execute.
- unibar bundle_role_identifier triplets
A list of strings in triplets:
- Bundle ID - application bundle identifier such as
com.google.Chrome (used in a case-insensitive comparison)
- AXRole - the Accessibility Role of a focused text item, such as
AXTextField
- AXIdentifier - the Accessibility Identifier of a focused text item, such as
WEB_BROWSER_ADDRESS_AND_SEARCH_FIELD
These triplets define text areas within applications where Shift-Left-Arrow keystrokes will be used to remove/replace the snippet abbreviation instead of the usual Backspace. (Browser "unibars" respond better to Shift-Left-Arrow keystrokes.)
- ignore clicks in bundles
ログのタイプをリセットしなくてもマウスクリックが出来るアプリケーションのバンドルIDを伴うテキスト記号列のリスト(例 virtual keyboards)。
すなわち、マウスをクリックするとタイピングログを明確にします。略語の一部をタイプし、マウスをクリックして略語を仕上げると、TextExpanderはスニペットを拡張しません。
デフォルトの際には、TextExpanderはクリックを無視します: システムの KeyboardViewer,
KeyStrokes (AssistiveWare製), VirtualKeyboard (Corallo
Software製).
- expand with repeated keys
- ブーリアンフラグが、文字を反復するためにキーが押されたままの時にTextExpanderがスニペットを拡張するかどうか管理します。 デフォルトの際には、反復されたキーが拡張や大文字化校正を引き起こすことはありません。
- non expanding language codes
拡張が実施されない入力方法の2文字言語コードを伴うテキスト記号列のリスト。
デフォルトの際には、TextExpanderは、以下の言語コードと同一視される入力方法を使用する時には拡張しません: "ja", "zh", "sa",
"ar", "hi" (日本語、中国語、サンスクリット語、アラビア語、ヒンズー語)
- additional contraction characters
- 大文字化校正で文字として取り扱われるべきアポストロフィーとシングル引用符に加えて句読点を含むテキスト記号列。(例 "i'm"を"I'm"に訂正)
- adjust linebreaks after empty optional parts
- A boolean flag controlling whether TextExpander will try to remove what will seem like an extra blank line if an optional section
of a fill-in snippet is not included. That is, if an optional section which starts on a new line is not checked, and there is a line break just afterwards, that linebreak will not be expanded in the snippet. TextExpander defaults to performing this adjustment.
- adjust linebreaks after linebreak keystrokes
- A boolean flag controlling whether TextExpander will avoid expanding what may be an extra blank line if a
%key:return% or %enter% is followed by a line break. TextExpander defaults to performing this adjustment.
- include paragraphs in HTML
A boolean flag controlling whether TextExpander will include <P> tags and associated styles with HTML data. <P> tags are only included if the snippet contains linebreaks.
TextExpander defaults to including paragraph tags for multi-line snippets.
グループとスニペットのスクリプト化
アップルスクリプトを使って、名前でスニペットグループにアクセスできます。また、全てのグループを数え上げることも出来ます。グールプにアクセス
されると、含まれるスニペットが列挙されます。フループとスニペットの属性を編集することが出来ます。グループかスニペットを作成したり削除したりできま
す。
以下は、スニペットグループ内のフォーマット化されたテキストスニペットをプレーンテキストスニペットに変更するスクリプト例です:
tell application "TextExpander"
set theGroup to group "My Snippets"
set theSnippets to snippets of theGroup
repeat with theSnip in theSnippets
if ((content type of theSnip) = rich_text) then
set the content type of theSnip to plain_text
end if
end repeat
end tell
Expanding Snippets
You can use TextExpander's expand command to expand a snippet into the currently active application. You can either
specify a snippet reference (expand snippet aSnippet),
or you can provide a snippet abbreviation (expand abbreviation "abbreviation").
Here is a sample script that creates a reply to the currently selected message in Mail and inserts a snippet as the reply text:
-- create a reply to the currently selected Mail message with a snippet
tell application "Mail"
activate
set current_messages to selected messages of message viewer 1
set theMessage to last item of current_messages
set new_message to reply theMessage with opening window and reply to all
tell application "TextExpander"
expand abbreviation ";fbreply"
end tell
end tell
|
|