Macro bug when assigned a shortcut

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

Post

I wrote a macro to split all clips according to the marked region. It works as intended when I run it from the "Run Script" menu. But it doesn't behave the same way if I run it from an assigned shortcut: it just make one split, where the mouse cursor is, and no splits at the marked region in and out.

Here is the script:

Code: Select all

Tracktion.showMessage("Split all clips in marked region");

Tracktion.deselectAll();

var clips = Tracktion.getEditElements ('clip');

Tracktion.jumpToMarkIn();
var m1 = Tracktion.getPosition ('transport');

Tracktion.jumpToMarkOut();
var m2 = Tracktion.getPosition ('transport');

for (var i = 0; i < clips.length; ++i)
{
	Tracktion.addObjectsToSelection(clips[i]);
}

Tracktion.setPosition ('cursor', m1);

Tracktion.splitClips(); 

Tracktion.setPosition ('cursor', m2);

Tracktion.splitClips();

Tracktion.deselectAll();

// debug
//Tracktion.showMessage("m1 : " + m1 + " m2 : " + m2 );
Any help would be much apreciated!

Post

This in in Waveform 10, btw. Linux Ubuntu.

Post

This is in Waveform 10, btw. Linux Ubuntu.

Post

You could try simplifying the macro as follows:

Code: Select all

Tracktion.showMessage("Split all clips in marked region");

Tracktion.deselectAll();

var clips = Tracktion.getEditElements ('clip');

for (var i = 0; i < clips.length; ++i)
{
	Tracktion.addObjectsToSelection(clips[i]);
}

Tracktion.jumpToMarkIn();
Tracktion.splitClips(); 
Tracktion.jumpToMarkOut();
Tracktion.splitClips();
Tracktion.deselectAll();

Post

Upon further testing there seems to be confusion between the edit cursor and the in/out markers. If you move your mouse off the screen so it isn't in the arrange area it will probably work. Could be something to do with the "Use the edit cursor position for editing operations" setting in the setting tab. I think the API needs modifications to distinguish between the cursor position, the in/out markers and the area selection.

Post

EDIT:

Deleted this macro as it has some problems.

Post Reply

Return to “Tracktion”