How do you select specific plugins with macros

Discussion about: tracktion.com
Post Reply New Topic
RELATED
PRODUCTS

Post

I'm trying to select Waveform text plugins by their individual names using a macro. I understand how to create an array of plugin elements using the following code:

var plugins = Tracktion.getEditElements ('plugin');

How do I select plugins of a certain type and name using this array. I know there's the getProperty method but can't seem to get it to work to retrieve a plugin name:

var property = object.getProperty ('propertyName');

Any ideas?

Post

I'm not an expert. You may need to use an index or subscript to refer to the array items. With an object, you ought to be able to refer to a property with object.propertyName. I've no idea how you'd find out what the properties are. Chapter 37 of the manual has some scripting information.
[W10-64, T5/6/7/W8/9/10/11/12/13, 32(to W8)&64 all, Spike],[W7-32, T5/6/7/W8, Gina16] everything underused.

Post

It appears that there is a way to find out what the properties of a Javascript object are; whether that applies to methods, I didn't find out. This (http://stackoverflow.com/questions/2080 ... ipt-object) has some possibilities, but I haven't tried them out. I did start working through a Javascript tutorial book a couple of years back but can't remember much of it, and the book is hiding from me.

The next problem is seeing what values are while the code runs, and the only way I can see to do that is to accumulate them in a string and then perhaps add a track and give it the name of whatever is in the string.
[W10-64, T5/6/7/W8/9/10/11/12/13, 32(to W8)&64 all, Spike],[W7-32, T5/6/7/W8, Gina16] everything underused.

Post

Ok, thanks for the information jabe. I've got so for with looping through the array with indices but I just can't seem to extract properties from the plugins so that I can use if statements to select specific plugins. I'll have to experiment some more.

Post

What is it exactly that you're trying to achieve?

Does this script help explain the structure a bit?
It gets the selected plugins, iterate them, checks to see if the type is a 'Text plugin' then check the "Name" field (called the 'title' property) and then if that matches a specific string ("Text Plugin Title" in this case) it prints the description (the 'body' property).

Code: Select all

var plugins = Tracktion.getSelectedEditElements ('plugin');

for (var i = 0; i < plugins.length; ++i)
{
	var plugin  = plugins[i];

	if (plugin.getProperty ('type') == 'text'
		&& plugin.getProperty ('title') == 'Text Plugin Title')
			Tracktion.showMessage (plugins[i].getProperty ('body'));
}
If you're dealing with advanced properties like this, your best bet is to look through the .tracktionedit files, they're XML so should help with identifying the relevant properties.

Post

Thanks dRowAudio that's exactly what I'm looking for. I'm just trying to create track grouping functionality using text plugins to identify the different groups.

Post

Ok cool. Let me know if you need any more help.
Bulking out the macro actions, improving the menu structure and providing some more detailed documentation is high on my wish list so the more people that use it, the stronger case I can make for spending time on it ;)

Post

Thanks for that from me too. I've looked at the .tracktionedit files before, so that'll help. I'll dig out my Javascript book and see if I can make interesting things happen.
[W10-64, T5/6/7/W8/9/10/11/12/13, 32(to W8)&64 all, Spike],[W7-32, T5/6/7/W8, Gina16] everything underused.

Post

dRowAudio wrote:providing some more detailed documentation
Please address this one first.
i9-10980HK. Windows 10 (21H2). Komplete Audio 6. Studio One 5.4.1.

Post Reply

Return to “Tracktion”