「キーボード」の「システム環境設定」画面でこのオプションのオンとオフを切り替えることができることは知っていますが、いつものようにショートカットを使用してこのオプションを実行できるかどうかを知りたいです。
以下を機能させるには、支援機器へのアクセスを有効にする inシステム環境設定"ユニバーサルアクセスを行う必要があります。
Automatorを開き、Serviceを選択し、サービスが受け取ることを選択します入力なし(上部近く)。
ライブラリのUtilitiesカテゴリでRun AppleScriptをダブルクリックします。新しく作成されたアクションのデフォルトのコードスニペットを次のように置き換えます。
tell application "System Preferences"
set current pane to pane id "com.Apple.preference.keyboard"
tell application "System Events"
tell process "System Preferences"
click checkbox "Use all F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
end tell
end tell
quit
end tell
システム環境設定は起動しますが、表示されず、設定を切り替えた直後に終了します。
押す Command-S
保存するには、名前を付けます。例: Fnを切り替えます。結果:
システム環境設定"キーボード"キーボードショートカット"サービスに移動して、このサービスのキーボードショートカットを割り当てます。
私はこの投稿が古いことを知っていますが、MountinanLionで上記を実行することができませんでした。同様のスニペットを見つけましたが、不要な部分をいくつか削除しました。
tell application "System Preferences"
set current pane to pane "com.Apple.preference.keyboard"
end tell
tell application "System Events"
-- If we don't have UI Elements enabled, then nothing is really going to work.
if UI elements enabled then
tell application process "System Preferences"
get properties
click radio button "Keyboard" of tab group 1 of window "Keyboard"
click checkbox "Use all F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
end tell
tell application "System Preferences" to quit
else
-- GUI scripting not enabled. Display an alert
tell application "System Preferences"
activate
set current pane to pane "com.Apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Please activate \"Enable access for assistive devices\""
end tell
end if
end tell
お役に立てれば
KeyRemap4MacBookで次のように private.xml を使用することもできます。
<?xml version="1.0"?>
<root>
<item>
<name>test</name>
<identifier>test</identifier>
<autogen>__KeyToKey__ KeyCode::F1, VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_CONFIG_TOGGLE_fn</autogen>
<autogen>__KeyToKey__ KeyCode::BRIGHTNESS_DOWN, VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_CONFIG_TOGGLE_fn</autogen>
</item>
<item>
<name>fn</name>
<identifier vk_config="true">fn</identifier>
<autogen>__KeyToKey__ KeyCode::BRIGHTNESS_DOWN, KeyCode::F1</autogen>
<autogen>__KeyToKey__ KeyCode::BRIGHTNESS_UP, KeyCode::F2</autogen>
<autogen>__KeyToKey__ KeyCode::EXPOSE_ALL, KeyCode::F3</autogen>
<autogen>__KeyToKey__ KeyCode::LAUNCHPAD, KeyCode::F4</autogen>
<autogen>__ConsumerToKey__ ConsumerKeyCode::KEYBOARDLIGHT_LOW, KeyCode::F5</autogen>
<autogen>__ConsumerToKey__ ConsumerKeyCode::KEYBOARDLIGHT_HIGH, KeyCode::F6</autogen>
<autogen>__ConsumerToKey__ ConsumerKeyCode::MUSIC_PREV, KeyCode::F7</autogen>
<autogen>__ConsumerToKey__ ConsumerKeyCode::MUSIC_PLAY, KeyCode::F8</autogen>
<autogen>__ConsumerToKey__ ConsumerKeyCode::MUSIC_NEXT, KeyCode::F9</autogen>
<autogen>__ConsumerToKey__ ConsumerKeyCode::VOLUME_MUTE, KeyCode::F10</autogen>
<autogen>__ConsumerToKey__ ConsumerKeyCode::VOLUME_DOWN, KeyCode::F11</autogen>
<autogen>__ConsumerToKey__ ConsumerKeyCode::VOLUME_UP, KeyCode::F12</autogen>
<autogen>__KeyToKey__ KeyCode::F1, KeyCode::BRIGHTNESS_DOWN</autogen>
<autogen>__KeyToKey__ KeyCode::F2, KeyCode::BRIGHTNESS_UP</autogen>
<autogen>__KeyToKey__ KeyCode::F3, KeyCode::EXPOSE_ALL</autogen>
<autogen>__KeyToKey__ KeyCode::F4, KeyCode::LAUNCHPAD</autogen>
<autogen>__ConsumerToKey__ KeyCode::F5, ConsumerKeyCode::KEYBOARDLIGHT_LOW</autogen>
<autogen>__ConsumerToKey__ KeyCode::F6, ConsumerKeyCode::KEYBOARDLIGHT_HIGH</autogen>
<autogen>__ConsumerToKey__ KeyCode::F7, ConsumerKeyCode::MUSIC_PREV</autogen>
<autogen>__ConsumerToKey__ KeyCode::F8, ConsumerKeyCode::MUSIC_PLAY</autogen>
<autogen>__ConsumerToKey__ KeyCode::F9, ConsumerKeyCode::MUSIC_NEXT</autogen>
<autogen>__ConsumerToKey__ KeyCode::F10, ConsumerKeyCode::VOLUME_MUTE</autogen>
<autogen>__ConsumerToKey__ KeyCode::F11, ConsumerKeyCode::VOLUME_DOWN</autogen>
<autogen>__ConsumerToKey__ KeyCode::F12, ConsumerKeyCode::VOLUME_UP</autogen>
</item>
</root>