Skip to main content
replaced http://superuser.com/ with https://superuser.com/
Source Link

You can also assign shortcuts to scriptsassign shortcuts to scripts like this:

tell application "System Events" to tell process "Dock"
    click UI element 1 of list 1
end tell

Or just use KeyRemap4MacBook to assign shortcuts to applications directly:

<?xml version="1.0"?>
<root>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_FINDER</name>
    <url>file:///System/Library/CoreServices/Finder.app</url>
  </vkopenurldef>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_ITUNES</name>
    <url>file:///Applications/iTunes.app</url>
  </vkopenurldef>
  <item>
    <name>custom</name>
    <identifer>custom</identifier>
    <autogen>__KeyToKey__ KeyCode::KEY_1, ModifierFlag::COMMAND_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_FINDER</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_2, ModifierFlag::COMMAND_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_ITUNES</autogen>
  </item>
</root>

You can also assign shortcuts to scripts like this:

tell application "System Events" to tell process "Dock"
    click UI element 1 of list 1
end tell

Or just use KeyRemap4MacBook to assign shortcuts to applications directly:

<?xml version="1.0"?>
<root>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_FINDER</name>
    <url>file:///System/Library/CoreServices/Finder.app</url>
  </vkopenurldef>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_ITUNES</name>
    <url>file:///Applications/iTunes.app</url>
  </vkopenurldef>
  <item>
    <name>custom</name>
    <identifer>custom</identifier>
    <autogen>__KeyToKey__ KeyCode::KEY_1, ModifierFlag::COMMAND_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_FINDER</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_2, ModifierFlag::COMMAND_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_ITUNES</autogen>
  </item>
</root>

You can also assign shortcuts to scripts like this:

tell application "System Events" to tell process "Dock"
    click UI element 1 of list 1
end tell

Or just use KeyRemap4MacBook to assign shortcuts to applications directly:

<?xml version="1.0"?>
<root>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_FINDER</name>
    <url>file:///System/Library/CoreServices/Finder.app</url>
  </vkopenurldef>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_ITUNES</name>
    <url>file:///Applications/iTunes.app</url>
  </vkopenurldef>
  <item>
    <name>custom</name>
    <identifer>custom</identifier>
    <autogen>__KeyToKey__ KeyCode::KEY_1, ModifierFlag::COMMAND_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_FINDER</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_2, ModifierFlag::COMMAND_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_ITUNES</autogen>
  </item>
</root>
Source Link
Lri
  • 106.4k
  • 19
  • 230
  • 283

You can also assign shortcuts to scripts like this:

tell application "System Events" to tell process "Dock"
    click UI element 1 of list 1
end tell

Or just use KeyRemap4MacBook to assign shortcuts to applications directly:

<?xml version="1.0"?>
<root>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_FINDER</name>
    <url>file:///System/Library/CoreServices/Finder.app</url>
  </vkopenurldef>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_ITUNES</name>
    <url>file:///Applications/iTunes.app</url>
  </vkopenurldef>
  <item>
    <name>custom</name>
    <identifer>custom</identifier>
    <autogen>__KeyToKey__ KeyCode::KEY_1, ModifierFlag::COMMAND_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_FINDER</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_2, ModifierFlag::COMMAND_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_ITUNES</autogen>
  </item>
</root>