Javascript Macro Action Requests

Discussion about: tracktion.com
kvruserr
KVRist
79 posts since 30 May, 2008

Post Thu Mar 10, 2016 6:10 am

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

Rock
KVRian
1218 posts since 11 Apr, 2002 from Nashville, TN

Re: Javascript Macro Action Requests

Post Sun Jul 02, 2017 6:25 pm

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.

Rock
KVRian
1218 posts since 11 Apr, 2002 from Nashville, TN

Re: Javascript Macro Action Requests

Post Mon Jul 03, 2017 9:39 am

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).

AGreen
KVRist
178 posts since 2 Feb, 2015

Re: Javascript Macro Action Requests

Post Mon Jul 03, 2017 10:36 am

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

Rock
KVRian
1218 posts since 11 Apr, 2002 from Nashville, TN

Re: Javascript Macro Action Requests

Post Mon Jul 03, 2017 12:56 pm

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.

AGreen
KVRist
178 posts since 2 Feb, 2015

Re: Javascript Macro Action Requests

Post Mon Jul 03, 2017 1:23 pm

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');

Rock
KVRian
1218 posts since 11 Apr, 2002 from Nashville, TN

Re: Javascript Macro Action Requests

Post Mon Jul 03, 2017 1:56 pm

That worked! Thanks!

Rock
KVRian
1218 posts since 11 Apr, 2002 from Nashville, TN

Re: Javascript Macro Action Requests

Post Tue Jul 11, 2017 9:05 am

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.

dRowAudio
KVRAF
1507 posts since 30 Dec, 2012

Re: Javascript Macro Action Requests

Post Wed Jul 12, 2017 3:25 am

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.

magicmusic
KVRian
1127 posts since 11 Nov, 2013

Re: Javascript Macro Action Requests

Post Sat Jul 15, 2017 9:14 am

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
For Bug report Purpose that developer see which system i use; win 10 64 1809 intel i5 8600K (6*3.6 GHZ) 16 GB Ram

jabe
KVRAF
1973 posts since 9 Oct, 2008 from UK

Re: Javascript Macro Action Requests

Post Sat Jul 15, 2017 12:07 pm

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, 32&64, Spike],[W7-32, T5/6/7/W8, Gina16] everything underused.

dRowAudio
KVRAF
1507 posts since 30 Dec, 2012

Re: Javascript Macro Action Requests

Post Mon Jul 17, 2017 3:27 am

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

dRowAudio
KVRAF
1507 posts since 30 Dec, 2012

Re: Javascript Macro Action Requests

Post Mon Jul 17, 2017 3:35 am

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?

strogon14
KVRist
69 posts since 29 Apr, 2011 from Cologne, Germany

Re: Javascript Macro Action Requests

Post Tue Jul 18, 2017 4:09 am

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)

lay it prodctions
KVRian
527 posts since 6 Jul, 2009 from Washington D.C

Re: Javascript Macro Action Requests

Post Wed Jul 26, 2017 11:33 am

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

Return to “Tracktion”