Control mouse click with Python

5.42K viewsCSS Questionspython
0

Hi Remotify forum members,

I see that Remotify has a user.py script that can run methods (a python class), can I run python code here that I currently run in terminal?

I have a python script (that I run manually) that listen for a specific midi command (sent from a midi controller when a button is pressed), when this command is received it clicks the ‘Type’ area (see attached picture) in Ableton’s browser to activate it so that I can copy in clip packs from a folder to tracks (Deck A and B). I do this as I have no other way of Activating Ableton’s browser.

I’m a bit of a new beginner in scripting and with Ableton so I would like to know if it is possible before I spend to much time on it, is this something that can be done with Remotify and python?

These are my imports in my python script;

import argparse
import os
import signal
import sys
import time
import rtmidi
from pynput.mouse import Button, Controller as MouseController
from pynput.keyboard import Key, Controller as KeyboardController

Joachim Answered question
0

Hi Glenn,

I have looked at Control Surface Studio and I can achieve simple things with Reactions in CSS, e.g. I can select the Browser in Ableton (I get the black border around the Browser) when I press a button on the midi controller and I can navigate up and down between the folders when I have first manually selected the top level/folder (‘Good DJ set’) with the mouse (having focus on Browser is not enough in order to navigate with keys up, down and right).

My understanding of the API is very limited but I can’t see how and if this can be done.

I’ll describe what I would like to be able to do and what I have achieve with python;

  1. Click on ‘Type’ in the Browser area to select it
  2. Navigate down (up and down) by sending key ‘up’ and ‘down’ and I dive into a folder by sending key ‘right’
  3. when I have the right song selected (a clip pack, the .als file) I copy it by sending Command + C
  4. Send key ‘1’ (track 1 is key mapped to 1) to select track 1 and paste by sending Command + V

Do you think that this can be done with a Control Surface script? If yes I would appreciate a few pointers if you have the time.

Joachim

Edit, added my simple attempt of a script

Joachim Unselected an answer
You are viewing 1 out of 9 answers, click here to view all answers.