Running NOOBSCMDR's .vbs files with LuaMacros

How can be this controlled in that simulator? Can HIDmacros be used with this application?
Post Reply
cheddargt
Posts: 3
Joined: 23 Jun 2021, 16:49

Running NOOBSCMDR's .vbs files with LuaMacros

Post by cheddargt » 08 Jul 2021, 12:50

A very cool dude made a video teaching how to use LuaMacros with a simple script that turns key inputs into OBS multiple key inputs for changing scenes, etc. Here it is: https://www.youtube.com/watch?v=_cAJ0j3E5xs. You need to watch this first.

I, also a cool dude, made an adaptation to his script in order for it to run .vbs files, which NOOBSCMDR exports (a tool made yet by ANOTHER cool dude). Here's both of his videos: https://www.youtube.com/watch?v=jdI_IeP1K3o and https://www.youtube.com/watch?v=1x3QqZHr6IY

Here's the script:

IMPORTANT: you have to change the 2C202B8E part with your specific numeric keyboard's unique ID. He explains how to find it in the video.

Also, change the .vbs files location/names according to yours and button numbers according to your keyboard's. He explains it better in his video.

Code: Select all

-- Lua script by Asq Gaming
-- Youtube: https://www.youtube.com/channel/UCfyh0pz0CpaP-rX8lIPc5Hg
-- Twitter: https://twitter.com/asqgames
-- Twitch: https://www.twitch.tv/asqgaming

-- Additional notes by cheddargt:
-- The function lmc_spawn() receives two variables. The first is a program and the second is a file that opens with that program.
-- i.e. opening an image with paint.exe would look like this:
-- lmc_spawn('C:\\Windows\\System32\\mspaint.exe', 'C:\\Users\\Gustavo\\Desktop\\image.png') 
-- Avoid accentuation in your path (like having your user be 'C:\Users\João' or a file called 'CenaGenérica.vbs' ). Lua doesn't like that. Doesn't work.
-- The double minus signs (--) before some lines means it's a commentary. It's not read by the compiler (if it's code, it's like it isn't there).
-- Use this to make notes for yourself and remove/add conditions when you're not using some of your keys (but want to keep it there).

lmc_device_set_name('streamdeck','[b]2C202B8E[/b]')
lmc_print_devices()

lmc_set_handler('streamdeck', function(button,direction)
  if (direction == 1) then return end

  -- Numpad /
  if (button == 111) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\MusicMonOFF.vbs')

    -- Numpad *
    elseif (button == 106) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\MusicMonON.vbs')

    -- Numpad -
    --elseif (button == 109) then
    --lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','')

    -- Numpad 7
    elseif (button == 103) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\Sub.vbs')

    -- Numpad 8
    elseif (button == 104) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\DesktopAudioMonOFF.vbs')

    -- Numpad 9
    elseif (button == 105) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\DesktopAudioMonON.vbs')

    -- Numpad +
    elseif (button == 107) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\MicMute.vbs')

    -- Numpad 4
    elseif (button == 100) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\CaptureCard.vbs')

    -- Numpad 5
    elseif (button == 101) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\AimLab.vbs')

    -- Numpad 6
    --elseif (button == 102) then
    --lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','')

    -- Numpad BKSP
    --elseif (button == 8) then
    --lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','')

    -- Numpad 1
    elseif (button == 97) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\JustChatting.vbs')

    -- Numpad 2
    elseif (button == 98) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\VALORANT.vbs')

    -- Numpad 3
    elseif (button == 99) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\GenericFullscreenGame.vbs')

    -- Numpad ENTER
    elseif (button == 13) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\BRB_Mute_All.vbs')

    -- Numpad 0
    elseif (button == 96) then
    lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','D:\\Twitch\\STREAMDECK\\commands\\CloseUp.vbs')

    -- Numpad .
    --elseif (button == 190) then
    --lmc_spawn('C:\\Windows\\SysWOW64\\wscript.exe','')

  end
end
)
This was super useful to me because as a portuguese speaker, accentuation is a key part of communication and HID Macros kind of glitches them out and they come out like this: ´´ ~~ ``

Pretty useful to be able to use this without having that drawback :)

Post Reply