Advertisement
farizafaf

whats wrong with my 2 kboard .lua?

Feb 6th, 2018
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --BASE
  2. clear()
  3. lmc_print_devices()
  4.  
  5. --  // Define Photoshop //
  6. lmc_device_set_name('PHOTOSHOP', '14D342ED')
  7. sendToAHK = function (key)
  8.       local file = io.open("D:\\..2nd keyboard\\keypressed.txt", "w")
  9.       file:write(key)
  10.       file:flush()
  11.       file:close()
  12.       lmc_send_keys('{F23}')
  13. end
  14.  
  15. local config = {
  16.     [45]  = "insert2",
  17.     [36]  = "home2",
  18.     [33]  = "pageup2",
  19.     [46]  = "delete2",
  20.     [35]  = "end2",
  21.     [34]  = "pagedown2",
  22.     [27]  = "escape2",
  23.     [112] = "2F1",
  24.     [113] = "2F2",
  25.     [114] = "2F3",
  26.     [115] = "2F4",
  27.     [116] = "2F5",
  28.     [117] = "2F6",
  29.     [118] = "2F7",
  30.     [119] = "2F8",
  31.     [120] = "2F9",
  32.     [121] = "2F10",
  33.     [122] = "2F11",
  34.     [123] = "2F12",
  35.     [8]   = "2backspace",
  36.     [220] = "2backslash",
  37.     [13]  = "2enter",
  38.     [16]  = "2rShift",
  39.     [17]  = "2rCtrl",
  40.     [38]  = "2up",
  41.     [37]  = "2left",
  42.     [40]  = "2down",
  43.     [39]  = "2right",
  44.     [32]  = "2space",
  45.     [186] = "2semicolon",
  46.     [222] = "2singlequote",
  47.     [190] = "2period",
  48.     [191] = "2slash",
  49.     [188] = "2comma",
  50.     [219] = "2leftbracket",
  51.     [221] = "2rightbracket",
  52.     [189] = "2minus",
  53.     [187] = "2equals",
  54.     [96]  = "2num0",
  55.     [97]  = "2num1",
  56.     [98]  = "2num2",
  57.     [99]  = "2num3",
  58.     [100] = "2num4",
  59.     [101] = "2num5",
  60.     [102] = "2num6",
  61.     [103] = "2num7",
  62.     [104] = "2num8",
  63.     [105] = "2num9",
  64.  
  65.     [106] = "2numMult",
  66.     [107] = "2numDelete",
  67.     [109] = "2numMult",
  68.     [110] = "2numDelete",
  69.     [111] = "2numDiv",
  70.     [144] = "2numLock",
  71.  
  72.     [192] = "2`",
  73.     [9]   = "2tab",
  74.     [20]  = "2capslock",
  75.     [18]  = "2alt",
  76.  
  77.  
  78.     [string.byte('Q')] = "2q",
  79.     [string.byte('W')] = "2w",
  80.     [string.byte('E')] = "2e",
  81.     [string.byte('R')] = "2r",
  82.     [string.byte('T')] = "2t",
  83.     [string.byte('Y')] = "2y",
  84.     [string.byte('U')] = "2u",
  85.     [string.byte('I')] = "2i",
  86.     [string.byte('O')] = "2o",
  87.     [string.byte('P')] = "2p",
  88.     [string.byte('A')] = "2a",
  89.     [string.byte('S')] = "2s",
  90.     [string.byte('D')] = "2d",
  91.     [string.byte('F')] = "2f",
  92.     [string.byte('G')] = "2g",
  93.     [string.byte('H')] = "2h",
  94.     [string.byte('J')] = "2j",
  95.     [string.byte('K')] = "2k",
  96.     [string.byte('L')] = "2l",
  97.     [string.byte('Z')] = "2z",
  98.     [string.byte('X')] = "2x",
  99.     [string.byte('C')] = "2c",
  100.     [string.byte('V')] = "2v",
  101.     [string.byte('B')] = "2b",
  102.     [string.byte('N')] = "2n",
  103.     [string.byte('M')] = "2m",
  104.  
  105.     [string.byte('0')] = "0a",
  106.     [string.byte('1')] = "1a",
  107.     [string.byte('2')] = "2a",
  108.     [string.byte('3')] = "3a",
  109.     [string.byte('4')] = "4a",
  110.     [string.byte('5')] = "5a",
  111.     [string.byte('6')] = "6a",
  112.     [string.byte('7')] = "7a",
  113.     [string.byte('8')] = "8a",
  114.     [string.byte('9')] = "9a",
  115.  
  116.     --[255] = "printscreen" --these keys do not work
  117. }
  118.  
  119. lmc_set_handler('PHOTOSHOP', function(button, direction)
  120.     if (direction == 1) then return end  
  121.  
  122.     if type(config[button]) == "string" then
  123.                 print(' ')
  124.                 print('2Your key ID number is:   ' .. button)
  125.                 print('2It was assigned string:    ' .. config[button])
  126.                 sendToAHK(config[button])
  127.     else
  128.                 print(' ')
  129.                 print('2Not yet assigned: ' .. button)
  130.     end
  131. end)
  132.  
  133. --  // Define Premiere //
  134. lmc_device_set_name('PREMIERE', '8AB8035')
  135. sendToAHK = function (key)
  136.       local file = io.open("D:\\..2nd keyboard\\keypressed2.txt", "w")
  137.       file:write(key)
  138.       file:flush()
  139.       file:close()
  140.       lmc_send_keys('{F24}')
  141. end
  142.  
  143. local config = {
  144.     [45]  = "insert",
  145.     [36]  = "home",
  146.     [33]  = "pageup",
  147.     [46]  = "delete",
  148.     [35]  = "end",
  149.     [34]  = "pagedown",
  150.     [27]  = "escape",
  151.     [112] = "F1",
  152.     [113] = "F2",
  153.     [114] = "F3",
  154.     [115] = "F4",
  155.     [116] = "F5",
  156.     [117] = "F6",
  157.     [118] = "F7",
  158.     [119] = "F8",
  159.     [120] = "F9",
  160.     [121] = "F10",
  161.     [122] = "F11",
  162.     [123] = "F12",
  163.     [8]   = "backspace",
  164.     [220] = "backslash",
  165.     [13]  = "enter",
  166.     [16]  = "rShift",
  167.     [17]  = "rCtrl",
  168.     [38]  = "up",
  169.     [37]  = "left",
  170.     [40]  = "down",
  171.     [39]  = "right",
  172.     [32]  = "space",
  173.     [186] = "semicolon",
  174.     [222] = "singlequote",
  175.     [190] = "period",
  176.     [191] = "slash",
  177.     [188] = "comma",
  178.     [219] = "leftbracket",
  179.     [221] = "rightbracket",
  180.     [189] = "minus",
  181.     [187] = "equals",
  182.     [96]  = "num0",
  183.     [97]  = "num1",
  184.     [98]  = "num2",
  185.     [99]  = "num3",
  186.     [100] = "num4",
  187.     [101] = "num5",
  188.     [102] = "num6",
  189.     [103] = "num7",
  190.     [104] = "num8",
  191.     [105] = "num9",
  192.  
  193.     [106] = "numMult",
  194.     [107] = "numDelete",
  195.     [109] = "numMult",
  196.     [110] = "numDelete",
  197.     [111] = "numDiv",
  198.     [144] = "numLock",
  199.  
  200.     [192] = "`",  
  201.     [9]   = "tab",
  202.     [20]  = "capslock",
  203.     [18]  = "alt",
  204.  
  205.  
  206.     [string.byte('Q')] = "q",
  207.     [string.byte('W')] = "w",
  208.     [string.byte('E')] = "e",
  209.     [string.byte('R')] = "r",
  210.     [string.byte('T')] = "t",
  211.     [string.byte('Y')] = "y",
  212.     [string.byte('U')] = "u",
  213.     [string.byte('I')] = "i",
  214.     [string.byte('O')] = "o",
  215.     [string.byte('P')] = "p",
  216.     [string.byte('A')] = "a",
  217.     [string.byte('S')] = "s",
  218.     [string.byte('D')] = "d",
  219.     [string.byte('F')] = "f",
  220.     [string.byte('G')] = "g",
  221.     [string.byte('H')] = "h",
  222.     [string.byte('J')] = "j",
  223.     [string.byte('K')] = "k",
  224.     [string.byte('L')] = "l",
  225.     [string.byte('Z')] = "z",
  226.     [string.byte('X')] = "x",
  227.     [string.byte('C')] = "c",
  228.     [string.byte('V')] = "v",
  229.     [string.byte('B')] = "b",
  230.     [string.byte('N')] = "n",
  231.     [string.byte('M')] = "m",
  232.  
  233.     [string.byte('0')] = "0",
  234.     [string.byte('1')] = "1",
  235.     [string.byte('2')] = "2",
  236.     [string.byte('3')] = "3",
  237.     [string.byte('4')] = "4",
  238.     [string.byte('5')] = "5",
  239.     [string.byte('6')] = "6",
  240.     [string.byte('7')] = "7",
  241.     [string.byte('8')] = "8",
  242.     [string.byte('9')] = "9",
  243.  
  244.     --[255] = "printscreen" --these keys do not work
  245. }
  246.  
  247. lmc_set_handler('PREMIERE', function(button, direction)
  248.     if (direction == 1) then return end
  249.  
  250.     if type(config[button]) == "string" then
  251.                 print(' ')
  252.                 print('1Your key ID number is:   ' .. button)
  253.                 print('1It was assigned string:    ' .. config[button])
  254.                 sendToAHK(config[button])
  255.     else
  256.                 print(' ')
  257.                 print('1Not yet assigned: ' .. button)
  258.     end
  259. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement