Before using AppleScript, there are keyboard maestro, the previous time with mechanical keyboard, with open-source Karabiner reset mechanical keyboard keys.
Today because online copy of the key F4 want to change to launchpad, so on the Internet search data search, the results found that the goods set shortcut keys, compared to the above two goods more convenient no need to write anything workflow
Directly on the code:
<?XML version= "1.0"?><Root> <Devicevendordef> <VendorName>Cherry_keybord</VendorName> <VendorID>0x046a</VendorID> </Devicevendordef> <Deviceproductdef> <ProductName>Pc_keyboard</ProductName> <ProductID>0x0011</ProductID> </Deviceproductdef> <!--file path - <Vkopenurldef> <name>Keycode::vk_open_url_app_calculator</name> <URLtype= "File">/applications/calculator.app</URL> </Vkopenurldef> <Item> <name>CHERRY g80-3000 KEYBOARD</name> <identifier>Private.deviceproductdef</identifier> <device_only>Devicevendor::cherry_keybord, deviceproduct::P c_keyboard</device_only> <identifier>Private.remap.pc_to_mac</identifier> <Autogen>__keytokey__ keycode::P c_application, KEYCODE::FN</Autogen> <Autogen>__keytokey__ keycode::command_l, keycode::option_l</Autogen> <Autogen>__keytokey__ Keycode::command_r, Keycode::option_r</Autogen> <Autogen>__keytokey__ keycode::option_l, keycode::command_l</Autogen> <Autogen>__keytokey__ Keycode::option_r, Keycode::command_r</Autogen> <Autogen>__keytokey__ Keycode::f1, Consumerkeycode::brightness_down</Autogen> <Autogen>__keytokey__ Keycode::f2, Consumerkeycode::brightness_up</Autogen> <Autogen>__keytokey__ Keycode::f3, Keycode::expose_all</Autogen> <Autogen>__keytokey__ Keycode::f4, Keycode::launchpad</Autogen> <!--autogen>__keytokey__ keycode::f4, keycode::D ashboard</autogen - <Autogen>__keytokey__ Keycode::f7, Consumerkeycode::music_prev</Autogen> <Autogen>__keytokey__ Keycode::f8, Consumerkeycode::music_play</Autogen> <Autogen>__keytokey__ Keycode::f9, Consumerkeycode::music_next</Autogen> <Autogen>__keytokey__ Keycode::f10, Consumerkeycode::volume_mute</Autogen> <Autogen>__keytokey__ Keycode::f11, Consumerkeycode::volume_down</Autogen> <Autogen>__keytokey__ Keycode::f12, Consumerkeycode::volume_up</Autogen> <Autogen>__keytokey__ keycode::keypad_clear, KeyCode::D elete, modifierflag::command_l</Autogen> <Autogen>__keytokey__ keycode::P c_printscreen, Consumerkeycode::eject</Autogen> </Item> <Item> <name>Change Right-command + C to launch calculator</name> <identifier>Private.right_command_c</identifier> <Autogen>__keytokey__ keycode::c, Modifierflag::command_r, Keycode::vk_open_url_app_calculator,</Autogen> </Item></Root>
The code above changed F4 to Launchpad, turning Commandr+c into a startup calculator. Is it refreshing to start the app?
Also found a Mac shortcut key artifact