Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
642
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. MY_DEFAULT_COLORS = 'M1 M2 M6 M10 M8 M12 M4 M3 M11';
  2.  
  3. print = gma.feedback;
  4. cmd = gma.cmd;
  5.  
  6. return function()
  7.  
  8.   -- Group number
  9.   local group = tonumber(gma.textinput('Group number?', 1));
  10.  
  11.   -- Preset offset
  12.   local offset = tonumber(gma.textinput('Preset offset?', 1));
  13.  
  14.   -- Gel colors
  15.   local manufacturers = {
  16.     R = 'Roscolux',
  17.     L = 'Lee',
  18.     M = 'MA colors'
  19.   };
  20.   local colors = gma.textinput('What colors do you want?', MY_DEFAULT_COLORS);
  21.   cmd('BlindEdit On');
  22.   cmd('ClearAll');
  23.   for m,c in colors:gmatch('([RrLlMm])(%d+)') do
  24.     if(m:upper() ~= 'M') then c = ("000" .. c):match('(...)$'); end; -- pad zeroes
  25.     if(m:upper() == 'R') then c = 'R' .. c; end -- rosco fix :-(
  26.     local gel = '"' .. manufacturers[m:upper()] .. '"."' .. c .. '"';
  27.     cmd('Delete Preset 4.' .. offset);
  28.     cmd('Group ' .. group .. ' At Gel ' .. gel);
  29.     cmd('Store Preset 4.' .. offset);
  30.     local preset = gma.show.getobj.handle('Preset 4.' .. offset);
  31.     local name = gma.show.getobj.name(preset);
  32.     print(name);
  33.     cmd('Label Preset 4.' .. offset .. ' "' .. name:match('(.+) [^ ]+ [^ ]+$') .. '"');
  34.     offset = offset + 1;
  35.   end;
  36.   cmd('ClearAll');
  37.   cmd('BlindEdit Off');
  38.  
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement