Created
June 23, 2024 22:59
-
-
Save nz-angel/b0e62841312e32147c59280902e1fa0b to your computer and use it in GitHub Desktop.
A LuaMacros script to use with Photoshop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Macros for Photoshop. Button codes belong to a Kolke KTN-101 numercial | |
-- keyboard. By changing the keys of the key_map array, they can be adapted | |
-- to your secondary keyboard. | |
-- clears output | |
clear() | |
-- minimizes to tray | |
lmc_minimize() | |
lmc.minimizeToTray = true; | |
-- To get the keyboard ID: | |
-- you will be prompted to press a key on keyboard MACROS. This is the secondary keyboard | |
-- lmc_assign_keyboard('MACROS'); | |
-- lists all connected devices | |
-- lmc_print_devices() | |
-- assign keyboard ID | |
local kbID = 'PID_0001'; | |
-- asigns name to the secondary keyboard | |
lmc_device_set_name('MACROS',kbID); | |
-- The key map : [button] = key | |
local key_map = { | |
[8] = '{ESC}', -- ESC | |
[13] = '^s', -- save (ctrl + s) | |
[45] = '{NUM0}', -- num keys (when NUMLOCK is OFF) to change opacity | |
[35] = '{NUM1}', | |
[40] = '{NUM2}', | |
[34] = '{NUM3}', | |
[37] = '{NUM4}', | |
[12] = '{NUM5}', | |
[39] = '{NUM6}', | |
[36] = '{NUM7}', | |
[38] = '{NUM8}', | |
[33] = '{NUM9}', | |
[97] = '+s', -- stamp tool | |
[98] = 'y', -- history brush tool | |
[99] = 'j', -- smudge tool | |
[100] = 'c', -- crop tool | |
[101] = '+g', -- gradient tool | |
[102] = 'v', -- move tool | |
[103] = '+l', -- lasso tool | |
[104] = '+m', -- marquee selection tool | |
[105] = '^d', -- deselect shortcut ( ctrl+d ) | |
[106] = 'x', -- switch foreground and background colors | |
[107] = '^t', -- free transform ( ctrl+t ) | |
[109] = '{F5}', -- brush settings | |
[110] = '^j', -- duplicate layer shortcut ( ctrl+j ) | |
[111] = 'd' -- default foreground and background colors | |
}; | |
lmc_set_handler('MACROS' ,function(button,direction) | |
if (direction == 1) then return end | |
lmc_send_keys(key_map[button]) | |
-- uncomment to print button code (useful if changing key_map) | |
-- print(button) | |
end); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment