Just Shift or Ctrl

How can be this controlled in that simulator? Can HIDmacros be used with this application?
duart3000
Posts: 3
Joined: 10 Apr 2018, 14:24

Re: Just Shift or Ctrl

Post by duart3000 » 10 Apr 2018, 14:52

Hello, I also have a need for this since I use photoshop and other drawing/editing programs, a problem for us artists is not knowing how to code. I just need an example code for a press and release key, after that I can write the rest.
Here's what I have, it just returns an error saying [LUA] ERROR: Cannot load buffer. [string "LuaMacros script"]:13: unexpected symbol near '):

Code: Select all

lmc_assign_keyboard('EDITER', '238B9097');
lmc_print_devices();

lmc_set_handler('EDITER', function(button,direction)

if (direction == 1) then return end
  if (button == 33) then lmc_send_input(32, 0, 0)
  if (button == 33) then lmc_send_input(32, 0, 2)

  end
end
)    
Can you help me with my code?
I'm sure there's something I'm doing wrong.

duart3000
Posts: 3
Joined: 10 Apr 2018, 14:24

Re: Just Shift or Ctrl

Post by duart3000 » 08 May 2018, 15:51

Anyone can help me with the code? I've spent hours on trying to learn and trying to program, I have no idea how to make a key behave like shift or ctrl or spacebar, where you can press and hold the key to keep something active and then release it to stop the action. I'm trying to use this for photoshop or other editing programs that have functions of holding the modifier keys.

Right now this code works as I press one button it makes it hold spacebar when I press the other it releases the key, I was hoping I could get it to work with just the downstroke and upstroke of the same key, down-hold / up-release.

Code: Select all

lmc_assign_keyboard('EDITER', '238B9097');
lmc_print_devices();

lmc_set_handler('EDITER', function(button,direction)

if (direction == 0) then return end
  if (button == 33) then lmc_send_input(32, 0, 0)
  elseif (button == 39) then lmc_send_input(32, 0, 2)

  end
end
)   

duart3000
Posts: 3
Joined: 10 Apr 2018, 14:24

Re: Just Shift or Ctrl

Post by duart3000 » 08 May 2018, 17:46

For those who are searching for this answer I just fixed it with this code:

Code: Select all

lmc_assign_keyboard('EDITER', '238B9097');
lmc_print_devices();

lmc_set_handler('EDITER', function(button,direction)

if (direction == 0) then return end
  if (button == 33) then lmc_send_input(32, 0, 0)

  end
end
)

lmc_set_handler('EDITER', function(button,direction)

if (direction == 1) then return end
  if (button == 33) then lmc_send_input(32, 0, 2)

  end
end
)              

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest