Hi Richard,
sorry for the late reply. Here’s a script I’m toying with the edit event macros of multiple selected events. I’ve set the height set to 500px and resize policy set to fixed but when I select more events that would fit it still grows instead of scrolling and I haven’t quite figured out how to setup alignment correctly.
Thanks in advance!
/**
* Function to launch the modal dialog from the console
*/
this.uiEventMacros = function() {
return execute()
}
/**
* Menu item entry
*/
studio.menu.addMenuItem({
name: "Bulk Edit\\Event Macros",
execute: execute,
isEnabled: function() {
return studio.window.browserSelection().length
}
})
var widgetHeader = [
{
widgetType: studio.ui.widgetType.Label,
column: 0,
row: 0,
text: "Event:",
alignment: studio.ui.alignment.AlignTop
},
{
widgetType: studio.ui.widgetType.Label,
column: 1,
row: 0,
text: "Priority:",
alignment: studio.ui.alignment.AlignTop
},
{
widgetType: studio.ui.widgetType.Label,
column: 2,
row: 0,
text: "Max Voices:",
alignment: studio.ui.alignment.AlignTop
},
{
widgetType: studio.ui.widgetType.Label,
column: 3,
row: 0,
text: "Stealing:",
alignment: studio.ui.alignment.AlignTop
}
]
/**
* Shows modal for setting macros of the selected events
* @returns {managedObject[]|[]} - array of selected events or empty array when called from console
*/
function execute() {
var objects = studio.window.browserSelection()
var out = []
var items = widgetHeader
if(objects.length > 0) {
var row = 1;
objects.forEach(function(object, index) {
if(object.isOfExactType("Event")) {
out.push(object)
row++;
items = items.concat([
{
widgetType: studio.ui.widgetType.Label,
alignment: studio.ui.alignment.AlignTop,
column: 0,
text: object.name,
row: row,
},
{
widgetType: studio.ui.widgetType.ComboBox,
alignment: studio.ui.alignment.AlignTop,
stretchFactor: 10,
column: 1,
row: row,
items: [
{ text: "Lowest" },
{ text: "Low" },
{ text: "Medium" },
{ text: "High" },
{ text: "Highest" }
],
currentIndex: object.automatableProperties.priority,
onCurrentIndexChanged: function() {
object.automatableProperties.priority = this.currentIndex()
}
},
{
widgetType: studio.ui.widgetType.SpinBox,
value: object.automatableProperties.maxVoices,
column: 2,
row: row,
range: { minium: 0, maxium: 65 },
onValueChanged: function() {
object.automatableProperties.maxVoices = this.value()
}
},
{
widgetType: studio.ui.widgetType.ComboBox,
alignment: studio.ui.alignment.AlignTop,
column: 3,
row: row,
items: [
{ text: "Oldest" },
{ text: "Quietest" },
{ text: "Virtualize" },
{ text: "None" },
{ text: "Furthest" }
],
currentIndex: object.automatableProperties.voiceStealing,
onCurrentIndexChanged: function() {
object.automatableProperties.voiceStealing = this.currentIndex()
}
}
])
}
})
if(items.length > 0) {
studio.ui.showModalDialog({
windowTitle: "Batch Edit Event Macros",
windowHeight: 500,
widgetType: studio.ui.widgetType.Layout,
layout: studio.ui.layoutType.GridLayout,
sizePolicy: studio.ui.sizePolicy.Fixed,
items: items,
})
} else {
console.error("Error: no events selected.")
alert("Error: no events selected.")
}
} else {
console.error("Error: browser selection empty.")
}
return out;
}