09-29-2019, 02:22 PM | #1 |
Human being with feelings
Join Date: Nov 2009
Posts: 2,227
|
scripting a macro from the os?
not sure if this goes here or in the scripting forum but i'm on linux and these are linux tools so...
i'm trying to set up an extra keyboard to send macros to reaper. i have this python script as a test: Code:
#!/usr/bin/env python import os from evdev import InputDevice, categorize, ecodes dev = InputDevice('/dev/input/event12') dev.grab() for event in dev.read_loop(): if event.type == ecodes.EV_KEY: key = categorize(event) if key.keystate == key.key_down: if key.keycode == 'KEY_ESC': os.system('xdotool key v') edit: just tried it with Code:
xdotool search --class REAPER windowactivate --sync %1 key v windowactivate $(xdotool getactivewindow) Code:
xdotool key v thanks, babag Last edited by babag; 09-29-2019 at 02:48 PM. |
09-29-2019, 09:43 PM | #2 |
Human being with feelings
Join Date: Nov 2009
Posts: 2,227
|
well, seemingly inexplicably, it works now. using the first code posted. i do have another question about this, though.
once it started working, i wanted to tie it to starting reaper. for now, i want to use this second keyboard exclusively with reaper. therefore, i wanted to have the script start with reaper and close when reaper does. this simple bash script does that but, i'm guessing, the linux users here know a more elegant way to accomplish this. what i've done is to make a simple script that, first, starts the script, keeping it running in the background and, second, starts reaper. finally, when reaper is closed, it kills the script. is there a better way to do this? here's the script: Code:
#!/bin/sh cd /home/babag/opt/REAPER/ sudo ./keyboard_macro2.py & ./reaper sudo pkill -f keyboard_macro2.py thanks, babag |
Thread Tools | |
Display Modes | |
|
|