システム環境設定の表示操作 [AppleScript辞書はつくれるか?]
アップルスクリプトで『システム環境設定』の特定ページを表示しよう!
と、また使い道のわからないシリーズができてしまいそうですが、
Applescript からシステム環境設定の操作ができないかと思い、調べてみました。
※セキュリティーの問題がありますのでこれ以上のことはできないと思いますが、そのページまで自動で促すことができるようになります。
(1)まずは、システム環境設定の最初の画面を起動し表示します。
|
tell application "System Preferences" set show all to true activate --これを使わないと前に出てこない場合がある end tell |
(2)表示したい項目(pane)を表示する(例は『セキュリティー』)
|
tell application "System Preferences" set current pane to pane id "com.apple.preference.security" end tell |
(3)Pane内の特定タグ等(アンカー)を直接表示する(例では『連絡先』)
|
tell application "System Preferences" reveal anchor "Privacy_Contacts" of pane id "com.apple.preference.security" end tell |
(4)PaneとかアンカーのIDがわからないから調べる
|
tell application "System Preferences" get anchor of the current pane end tell |
結果例:
{anchor "Privacy_Reminders" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_SystemServices" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_Calendars" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Firewall" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_Assistive" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_LocationServices" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_Contacts" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "General" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Advanced" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_Accessibility" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_Camera" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "FDE" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_AllFiles" of pane id "com.apple.preference.security" of application "System Preferences",
anchor "Privacy_Microphone" of pane id "com.apple.preference.security" of application "System Preferences"}
または、
|
tell application "System Preferences" get name of anchor of the current pane end tell |
結果例:
{"Privacy_Reminders", "Privacy_SystemServices", "Privacy_Calendars", "Firewall", "Privacy_Assistive", "Privacy_LocationServices", "Privacy_Contacts", "General", "Advanced", "Privacy_Accessibility", "Privacy_Camera", "FDE", "Privacy", "Privacy_AllFiles", "Privacy_Microphone"}
という操作ができます。
他の項目でも操作できるが、特定のアンカーではびっくりさせられることもある。
表示できるアンカーや見たことないアンカーまであるのが気になる。
システム環境設定のライブラリー詳細はこちら
applicationn [see also Standard Suite] : システム環境設定の最上位スクリプトオブジェクト
elements
contains panes.
properties
current pane (pane) : 現在選択されているペイン
preferences window (window, r/o) : メイン設定ウィンドウ
show all (boolean) : SystemPrefsがすべて表示されていますか? (falseに設定しても何も起こりません)
panen [inh. item] : 設定ペイン
elements
anchors を含む; application に含まれています。
properties
id (text, r/o) : 設定ペインのロケールに依存しない名前。 式を使用してペインを参照できます: pane id "<name>"
localized name (text, r/o) : 設定ペインのローカライズされた名前
name (text, r/o) : タイトルバーに表示される設定ペインの名前。 式を使用してペインを参照できます: pane "<name>"
responds to
reveal, authorize.
anchorn [inh. item] : 設定ペイン内のアンカー
elements
panes に含まれる。
properties
name (text, r/o) : 設定ペイン内のアンカーの名前
responds to
reveal.
revealv : 設定ペイン内のアンカーまたは設定ペインを表示します。
reveal pane or anchor
pane or anchor
authorizev : 指定された設定ペインのプロンプト認証
authorize pane
pane
コメント 0