/streamdeck-supermacro

Create sophisticated macros easily and run them through your Stream Deck

Primary LanguageC#

SuperMacro - Advanced keystroke macros triggered by the Elgato Stream Deck

Author's website and contact information: https://barraider.com

New in v1.8

  • 🆕 FUNCTIONS Support!
    • RANDOM function allows choosing a random number in a customized range
    • ADD/SUB/MUL/DIV allow to Add, Subtract, Multiply and Divide numbers
    • CONCAT function allows to concatenate multiple strings/variables into one
  • Comments support: Type {{//}} and everything after it will be ignored, until the end of the line.
  • New {{SetKeyTitle}} command to dynamically change the title of the Stream Deck button. See {{SETKEYTITLE}} command below.
  • New {{OutputToFile}} command to store contents of a variable to file. See {{OUTPUTTOFILE}} command below.
  • New {{VarSetFromClipboard}} command to set a variable with the clipboard contents. See {{VARSETFROMCLIPBOARD}} command below.
  • New Mouse Location action shows you the current mouse coordinates, to be used with the MouseXY command.
  • SuperMacro Toggle can now be set to remember the toggle state even when switching profiles or restarting the Stream Deck :pogchamp:
  • SuperMacro PTT action now supports sending a specific keystroke when key is released
  • SuperMacro PTT and StickyKeypress action now support a customizable delay (pause) between every execution.
  • {{INPUT}} Command now remembers the previous value and autofills it in the popup window

New in v1.7

  • 🆕 Loops Support!
    • Sticky SuperMacro and Sticky Keystroke both support loops! Use the Auto Stop After N Rounds to create loops which will run a customizable amount of times.
  • New Variable Commands!
    • {{VarSet}} - Use {{VARSET:VarName:Value}} to set the value Value into VarName. You can then use {{OUTPUT:VarName}} to display it
    • {{VarSetFromFile}} - Use {{VARSETFROMFILE:VarName:c:\myfile.txt}} to read myfile.txt and store its contents into VarName. You can then use {{OUTPUT:VarName}} to display it
    • {{VarUnset}} - Use {{VARUNSET:VarName}} to clear VarName
    • {{VarUnsetAll}} - Clears all variables. Usage: {{VARUNSETALL}}
  • Full support for Numpad buttons! Added a bunch of new commands to differentiate between Numpad buttons and their non-Numpad variation (Arrows, Home, End, ...). See full list below
  • Storing/Restore mouse position. Use {{MSAVEPOS}} to store the current mouse position. Later use {{MLOADPOS}} to move the mouse back to that position
  • Mouse Double-Clicks:
    • Left Double Click now uses the {{MLEFTDBLCLICK}} command.
    • Right Double Click now uses the {{MRIGHTDBLCLICK}} command.
  • MouseXY command which is superseding the MousePos command. Use it to move the mouse cursor to a specific place on your desktop. Use together with the new Mouse Location action to quickly determine the coordinates you want.
  • Support for mouse Button 4 and Button 5 - Use {{XBUTTON1}} for Button 4 click. Use {{XBUTTON2}} for Button 5 click.
  • New Let macro complete on stop option available for Sticky SuperMacro. Will ensure the macro completes fully when the button is pressed

Current functionality

5 Plugins built into one:

Super Macro

This is the basic implementation. Create a macro and run it on keypress. Examples can be seen in the Usage Examples section below.

Super Macro Toggle

Toggle between two different macros.

Sticky Super Macro

Click once to enable, the macro will run again and again until the button is pressed again

Keystroke PTT

This action limits the action to either one command (such as {{ctrl}{c}}) or one character. The command will be run again and again as long as you continue to press the key.

Sticky Keystroke

This action limits the action to either one command (such as {{ctrl}{c}}) or one character. The command will be run again and again until the button is pressed again.

How do I get started using it?

SuperMacro knows to deal with both Commands and normal text. A command is either one special key (like F5 or Winkey) or a keystroke (like Ctrl-C). A command is always enclosed in {} and each individual key in the command is also inclosed in {} so you should always see two {{ at the beginning and two }} at the end. For instance: {{f5}} or {{ctrl}{c}}

Usage Examples

  1. Open Windows Explorer and got to C:\Program Files
    Note: Delay should be ~20 ms
{{win}{e}}{{pause:400}}{{alt}{d}}c:\Program Files\{{enter}}
  1. Open notepad and play with the settings
    Note: Delay should be ~20 ms
    Note2: This will not work correctly if your Windows (and notepad) are not in English
{{win}{r}}{{pause:500}}notepad.exe{{enter}}{{pause:1000}}Ok... Let's see what this plugin can do...{{alt}{f}}{{right}}{{PAUSE:400}}{{right}}{{PAUSE:400}}f{{pause:400}}times{{down}}{{PAUSE:400}}{{tab}}{{PAUSE:400}}{{down}}{{PAUSE:400}}{{down}}{{PAUSE:400}}{{ENTER}}{{ENTER}}For more information visit: https://barider.g1thubio{{ctrl}{shift}{left}}{{PAUSE:400}}https://barraider.github.io{{ENTER}}{{alt}{o}}f{{PAUSE:100}}Lucida Console{{tab}}Regular{{Tab}}12{{ENTER}}
  1. Calculate something
    Note: Delay should be ~20 ms
{{win}{r}}{{pause:300}}calc{{enter}}{{pause:1000}}1*2*3*4*5=
  1. Move the mouse to a certain position on the screen, then press Double-Click left mouse button.
    Note: To find the correct position you can use the Mouse Location action.
{{MOUSEXY:1000,15}}{{MLEFTDBLCLICK}}
  1. Move the mouse by 10 pixels left and 20 pixels down on every press
{{MOUSEMOVE:-10,20}}
  1. Variables: Get input from user and then use it later on.
{{INPUT:Name}}Hello {{OUTPUT:Name}}, Nice to meet you!
  1. Variables: Read text from file into MyVar variable
{{VarSetFromFile:MyVar:C:\filename.txt}}
  1. Functions: Choose a random number between 1 (inclusive) to 10 (exclusive) and store it in MyVar:
{{FUNC:RANDOM:MyVar:1:10}}
  1. Functions: Input 2 numbers from the user. Choose a random number between firstNum variable (inclusive) to secondNum variable (exclusive) and store it in MyVar:
{{INPUT:firstNum}}
{{INPUT:secondNum}}
{{FUNC:RANDOM:MyVar:$firstNum:$secondNum}}
  1. Functions: Select a number from the user and multiply it by 10. Then save it to a file named c:\temp\result.txt:
{{INPUT:myNumber}}
{{FUNC:MUL:MyResult:$myNumber:10}}
{{OUTPUTTOFILE:MyResult:c:\temp\result.txt}}
  1. Add comments in the code using {{//}} command
{{INPUT:myNumber}} {{//}} Input a number from the user
{{FUNC:MUL:MyResult:$myNumber:10}} {{//}} Multiply number by 10
{{OUTPUTTOFILE:MyResult:c:\temp\result.txt}} {{//}} Save result in file
  1. Read text from a file and show it on the Stream Deck Key:
{{VARSETFROMFILE:MyVar:c:\counter.txt}}
{{SETKEYTITLE:$MyVar}}
  1. Read text from a clipboard and show it on the Stream Deck Key:
{{VARSETFROMCLIPBOARD:MyVar}}
{{SETKEYTITLE:$MyVar}}

*** More commands below ***

Download

I found a bug, who do I contact?

For support please contact the developer. Contact information is available at https://barraider.com

I have a feature request, who do I contact?

Please contact the developer. Contact information is available at https://barraider.com

Dependencies

  • Uses StreamDeck-Tools by BarRaider: NuGet
  • Uses Easy-PI by BarRaider - Provides seamless integration with the Stream Deck PI (Property Inspector)

List of supported keystroke commands

Keyboard Key Macro Command
Letters A-Z {VK_XXXX} (XXXX = the letter - e.g. VK_A / VK_B ...)
Numbers 0-9 {VK_XXXX} (XXXX = the number - e.g. VK_0 / VK_1 ...)
These characters:
;/`[\]':?~{|}"
Exact command changes between keyboard layouts:
Try the following macros to figure out the correct command:
{{oem_1}}{{oem_2}}{{oem_3}}{{oem_4}}{{oem_5}} {{oem_6}}{{oem_7}}{{oem_8}} {{shift}{oem_1}}{{shift}{oem_2}}{{shift}{oem_3}} {{shift}{oem_4}}{{shift}{oem_5}} {{shift}{oem_6}}{{shift}{oem_7}}{{shift}{oem_8}}
Numpad 0 {NUMPAD0}
Numpad 1 {NUMPAD1}
Numpad 2 {NUMPAD2}
Numpad 3 {NUMPAD3}
Numpad 4 {NUMPAD4}
Numpad 5 {NUMPAD5}
Numpad 6 {NUMPAD6}
Numpad 7 {NUMPAD7}
Numpad 8 {NUMPAD8}
Numpad 9 {NUMPAD9}
Numpad * {MULTIPLY}
Numpad + {ADD}
Numpad - {SUBTRACT}
Numpad . {DECIMAL}
Numpad / {DIVIDE}
BACKSPACE {BACK}
TAB {TAB}
CLEAR {CLEAR}
ENTER {RETURN} or {ENTER}
SHIFT {SHIFT}
Left SHIFT {LSHIFT}
Right SHIFT {RSHIFT}
CTRL {CONTROL} or {CTRL}
Left CONTROL {LCONTROL} or {LCTRL}
Right CONTROL {RCONTROL} or {RCTRL}
ALT {ALT} or {MENU}
Left ALT {LALT} or {LMENU}
Right ALT {RALT} or {RMENU}
PAUSE/BREAK {BREAK}
CAPS LOCK {CAPITAL}
ESC {ESCAPE}
SPACEBAR {SPACE}
PAGE UP {PAGEUP} or {PGUP} or {PRIOR}
Numpad PAGE UP {NUMPAD_PAGEUP}
PAGE DOWN {PAGEDOWN} or {PGDN} or {NEXT}
Numpad PAGE DOWN {NUMPAD_PAGEDOWN}
HOME {HOME}
Numpad HOME {NUMPAD_HOME}
END {END}
Numpad END {NUMPAD_END}
UP ARROW {UP}
Numpad UP ARROW {NUMPAD_UP}
LEFT ARROW {LEFT}
Numpad LEFT ARROW {NUMPAD_LEFT}
RIGHT ARROW {RIGHT}
Numpad RIGHT ARROW {NUMPAD_RIGHT}
DOWN ARROW {DOWN}
Numpad DOWN ARROW {NUMPAD_DOWN}
SELECT {SELECT}
PRINT SCREEN {SNAPSHOT}
PRINT {PRINT}
EXECUTE {EXECUTE}
INS {INSERT}
Numpad INS {NUMPAD_INSERT}
DEL {DELETE}
Numpad DEL {NUMPAD_DEL}
HELP {HELP}
Left Windows {LWIN} or {WIN} or {WINDOWS}
Right Windows {RWIN}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
F17 {F17}
F18 {F18}
F19 {F19}
F20 {F20}
F21 {F21}
F22 {F22}
F23 {F23}
F24 {F24}
Plus: += {OEM_PLUS} / {{SHIFT}{OEM_PLUS}}
Minus: -_ {OEM_MINUS} / {{SHIFT}{OEM_MINUS}}
Period: .> {OEM_PERIOD} / {{SHIFT}{OEM_PERIOD}}
Comma: ,< {OEM_COMMA} / {{SHIFT}{OEM_COMMA}}
NUM LOCK {NUMLOCK}
SCROLL LOCK {SCROLL}

Advanced Commands

Note: Use a : between the command name and the arguments

{{//}} Comments Support: Anything after the {{//}} sign will be ignored until end of line.
PAUSE {PAUSE:XXXX} (XXXX = length in miliseconds)
KeyDown {KeyDown:XXXX} (XXXX = name of key, example {{KeyDown:F1}})
KeyUp {KeyUp:XXXX} (XXXX = name of key, example {{KeyUp:SHIFT}})
Input {Input:VarName} Get input from the user and store it in 'VarName'.
Output {Output:MyVar} Output the input previously gathered into 'MyVar'.
VarSet {VarSet:MyVar:MyValue} set the value `MyValue` into `MyVar`.
OutputToFile {OutputToFile:MyVar:C:\filename.txt} write the contents of the `MyVar` variable into `c:\filename.txt` file.
VarSetFromFile {VarSetFromFile:MyVar:C:\filename.txt} read the contents of the file specified and store into `MyVar`.
VarSetFromClipboard {VarSetFromClipboard:MyVar} read the contents of the clipboard and store into `MyVar`.
VarUnset {VarUnset:MyVar} clears `MyVar`.
VarUnsetAll {VARUNSETALL} clears all variables.
MSavePos {MSAVEPOS} stores the current mouse cursor position.
MLoadPos {MLOADPOS} moves the mouse to the previous set position (when `{MSAVEPOS}` was called).
SetKeyTitle {SetKeyTitle:$MyVar} Sets the text on the Stream Deck key to the contents of `MyVar`.

Functions

Syntax:

{{FUNC:NameOfFunction:OutputVariable:InputParam1:InputParam2:InputParam3...}}

Where 'InputParamX' can either be text (10) or another variable ($MyVar)
Function Name Number of Input variables Example Comments
ADD 2 {{FUNC:ADD:MyVar:10:20}} (10+20 and store in MyVar)
{{FUNC:ADD:Var1:10:$Var2}} (Add 10 to Var2 and store in Var1)
{{FUNC:ADD:Result:$Var1:$Var2}} (Sum Var1 and Var2 and store in Result)
SUB 2 {{FUNC:ADD:MyVar:20:10}} (20-10 and store in MyVar) (Additional examples similar to ADD above)
MUL 2 {{FUNC:MUL:MyVar:10:20}} (10*20 and store in MyVar) (Additional examples similar to ADD above)
DIV 2 {{FUNC:DIV:MyVar:100:50}} (100/50 and store in MyVar). (Additional examples similar to ADD above)
RANDOM 2 {{FUNC:RANDOM:MyVar:1:20}} (Find a random number between 1 (inclusive) and 20 (exclusive) and store in MyVar.
{{FUNC:RANDOM:MyVar:$FirstVal:$SecondVal}} (Find a random number between FirstVal variable (inclusive) and SecondVal variable (exclusive) and store in MyVar.
Note: First value must be LOWER than Second value.
CONCAT Unlimited {{FUNC:CONCAT:MyVar:Hello:World:$Var1:Hi:$Var2}}
MyVar will have the string: HelloWorldXXXXHiYYYY Where XXXX is the contents of Var1 and YYYY is the contents of Var2

Mouse Commands

Mouse Key Macro Command
Mouse Left-Click {LBUTTON}
Mouse Left Double-Click {MLEFTDBLCLICK}
Mouse Left Button Down {MLEFTDOWN}
Mouse Left Button Up {MLEFTUP}
Mouse Right-Click {RBUTTON}
Mouse Right Double-Click {MRIGHTDBLCLICK}
Mouse Right Button Down {MRIGHTDOWN}
Mouse Right Button Up {MRIGHTUP}
Mouse Middle Click {MBUTTON}
Mouse Middle Button Down {MMIDDLEDOWN}
Mouse Middle Button Up {MMIDDLEUP}
Mouse Button 4 Click {XBUTTON1}
Mouse Button 5 Click {XBUTTON2}
Mouse Scroll Wheel Up {MSCROLLUP}
Mouse Scroll Wheel Down {MSCROLLDOWN}
Mouse Horizontal Scroll Left {MSCROLLLEFT}
Mouse Horizontal Scroll Right {MSCROLLRIGHT}
Mouse Move based on CURRENT position {MOUSEMOVE:X,Y} (Move the cursor by X,Y from current position)
Mouse Move based on multi-screen resolutions {MOUSEXY:X,Y} (Move the cursor to the X,Y position on the screen. 0,0 is the [top-left] of your primary monitor. Supports both positiv�e and negative values. Use along with the Mouse Location action to easily find the right coordinates on your PC
(DEPRICATED) Mouse Move based on ABSOLUTE position (DEPRICATED) {MOUSEPOS:X,Y} (Move the cursor to the X,Y position on the screen. Values from 0,0 [top-left] to 65535,65535 [bottom-right])