Javascript Macro Action Requests

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

Post

dRowAudio wrote:You're only renaming the first element of the clips array (clip[0]);
You need to iterate the array and call setName on each item:

Code: Select all

var clips = Tracktion.getSelectedEditElements ('clip');
for (var i = 0; i < clips.length; ++i)
    Tracktion.setName (clips[i], 'gt');
Thanks once again.... I will give it a try and ponder what you did :-)

Thanks

Post

Things I want to know how to do that would be game changers...

1) Set the color of a newly created marker:

This I have...

Code: Select all

var clip = Tracktion.insertClip ('barsBeatsMarker');
Tracktion.setName (clip, "Intro");
Tracktion.deselectAll();
Tracktion.addObjectsToSelection (clip);
But how do I set the color?

This would be so useful. If the Intro was always orange, and the first verse was always red, and the first chorus was always blue, I would grow used to the convention and eventually be able to navigate very quickly. In fact could we color tracks and clips with colors (with alphas) not in the color menu?

Tracktion.setColor(clip, "#E6ADADAD)

I would finally have grays and subtle colors for MIDI clips! :D

2) How do I jump to the start of a marker by name? I created my marker, "Intro." Now, I need a script to navigate the play position to it.

3) How can I open all of a track's plugin GUIs and have them pinned? (If I could have their gui window's nicely arranged that would be even more amazing, but I figure that's a lot to ask). I realize that plugins without their own gui would not display all at once, but this would still be awesome.

4) How do I close all plugins gui's at once even if pinned?

Just imagine selecting a track, press a key stroke and all of its plugins are visible and orderly. Press another key combo and they're all out of the way. Wow.

Post

Seems like the following would also be useful:

Tracktion.removeObjectsFromSelection ();

Tracktion.toggleObjectSelectDeselect ();

- I also second the need for a user input field (you could use the left panel's search field with loop, patch, and plugin set to false).

Post

You can set the colour with clip.setProperty ('colour', 'ff4cff88');

It's easy to select plugins on a track but at the moment I don't think there's a way to set the visibility to true or something similar.

You could jump to the marker by making use of something like :

var markerPosition = clip.getProperty ('start');
Tracktion.setPosition ('cursor', markerPosition);

You would have to iterate through all the clips in the edit using a for loop and testing for type "marker" and the marker "name" property. Use var clips = Tracktion.getEditElements ('clip'); to return all clips in the edit.

I don't know whether you've seen the macros I posted but they might give you some clues as to how to go about this. They can be found here : viewtopic.php?f=22&t=486975

Post

AGreen wrote:You can set the colour with clip.setProperty ('colour', 'ff4cff88');
Are you suggesting this or it currently works? If so how? Can you give an example, I got an error when I tried it.

Post

Rock wrote:
AGreen wrote:You can set the colour with clip.setProperty ('colour', 'ff4cff88');
Are you suggesting this or it currently works? If so how? Can you give an example, I got an error when I tried it.
Apologies, I forgot the array index in the statement. The following works:

var clip = Tracktion.getSelectedEditElements ('clip');
clip[0].setProperty ('colour','ff4cff88');

Post

That worked! Thanks!

Post

Does something like Tracktion.isArmed or Tracktion.isRecordEnabled exist? Is there another way of determining if a track is record enabled? If there is no way, please add.

Post

Rock wrote:Does something like Tracktion.isArmed or Tracktion.isRecordEnabled exist? Is there another way of determining if a track is record enabled? If there is no way, please add.
Currently no, and because these properties are stored in a different part of the Edit, not with the track node, there's no way to get them using the raw tree object.

I've added them to the list of scripts to add but we're finalising a new release at the moment so are unlike to get added in the next few weeks. Hopefully soon after that though.

Post

A action to do play all in browser. so its possible to do a script that start in sync the sequencer on I marker and play all in browser too to hear
win 10 64 22H2 intel i5 8600K (6*3.6 GHZ) 32 GB Ram

Post

Does the colour property accept the RGB thing as a number as well as a string? If so, one could add or multiply as you go through.
[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

magicmusic wrote:A action to do play all in browser. so its possible to do a script that start in sync the sequencer on I marker and play all in browser too to hear
Noted

Post

jabe wrote:Does the colour property accept the RGB thing as a number as well as a string? If so, one could add or multiply as you go through.
It has to be be a string I'm afraid.However, I don't think a pure integer would help much as you usually work with the component parts of a colour. With that, you could use the string::substring method and then you could use parseInt on that to get the A/R/G/B value.

Alternatively if you want the whole number you can just parseInt as long as you prefix it with "0x" to indicate it should be parsed as hex.

Does that help?

Post

A quick search in this topics seems to indicate this hasn't been mentioned yet:

- Set the pre-record count-in length to 0 .. n bars.

Currently it seems you can't bind this to a key.

(See this thread for reference: http://www.kvraudio.com/forum/viewtopic ... 2&t=487932)

Post

Is there a way to make a selected Clip mono with a macro?

Post Reply

Return to “Tracktion”