|
Post by stevepottz on Nov 7, 2020 22:27:02 GMT -5
Hoping someone might be able to help me with this. BRand new to python so hacking my way though this.
Aim of user action is to rename a macro dial of a device.
Here's my code:
def rename_macro(self, action_def, args):
device = action_def['device']
arg_split = args.split()
self.canonical_parent.log_message('rename_macro called for device=%s with args=%s' % (action_def['device'], args))
for i, p in enumerate(device.parameters):
self.canonical_parent.log_message('%s: %s range=%s - %s' % (i, p.name, p.min, p.max))
self.canonical_parent.log_message(arg_split[0], '++', arg_split[1])
device = action_def['device']
device.parameters[1].name = 'Hello'
I cannot get this to do the hardcode change of Macro 1 (or is parameters[1] actually Macro 2?). Once I get that working, the intention is to use arg_split[0] and arg_split[1] from the arguments to specify the change as in: device.parameters[arg_split[0]].name = arg_split[1] X-Clip would look like this: [] 1/USER_DEV(1) CHGLAB 1 Hello
Any ideas where I am going wrong with the syntax on the hardcoded version and then also a view on the argument form.
Thanks in advance.
|
|