Midi Transpose macro's
Hey Guys,
happy new year!
I have a bunch of macro's that I used for transposing midi quickly but since pro tools changed the event operations window they havent worked. I was wondering if any would be able to modify one for me to work with the new window please? Then I could apply the new code to all my variations!
thanks so much in advance, code is below:
//
var velLow = '0'
var blank = '-1'
sf.ui.proTools.appActivateMainWindow();
sf.ui.proTools.menuClick({
menuPath: ["Event", "Event Operations", "Transpose..."],
});
sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.popupButtons [0].popupMenuSelect({
menuPath: ["Transpose"],
});
sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.textFields.allItems[0].elementSetTextFieldWithAreaValue({
value: velLow,
useMouseKeyboard: true,
});
sf.keyboard.press({
keys: "delete",
});
sf.keyboard.type({text: velLow});
sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.textFields.allItems[1].elementSetTextFieldWithAreaValue({
value: blank,
useMouseKeyboard: true,
});
sf.keyboard.press({
keys: "delete",
});
sf.keyboard.type({text: blank});
sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.buttons.whoseTitle.is("Apply").first.elementClick();
sf.ui.proTools.windows.whoseTitle.is("Event Operations").first.getElement("AXCloseButton").elementClick();
Sreejesh Nair @Sreejesh_NairThis should work:
var velLow = '0' var blank = '-1' sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ["Event", "Event Operations", "Transpose..."], }); sf.ui.proTools.windows.first.textFields.allItems[0].elementSetTextFieldWithAreaValue({ value: velLow, useMouseKeyboard: true, }); sf.keyboard.press({ keys: "delete", }); sf.keyboard.type({ text: velLow }); sf.ui.proTools.windows.first.textFields.allItems[1].elementSetTextFieldWithAreaValue({ value: blank, useMouseKeyboard: true, }); sf.keyboard.press({ keys: "delete", }); sf.keyboard.type({ text: blank }); sf.ui.proTools.windows.first.buttons.whoseTitle.is("Apply").first.elementClick(); sf.ui.proTools.windows.first.getElement("AXCloseButton").elementClick();Here is a more streamlined version of this code
var velLow = '0', blank = '-1'; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ["Event", "Event Operations", "Transpose..."] }); const setTextField = (value, index) => { sf.ui.proTools.windows.first.textFields.allItems[index].elementSetTextFieldWithAreaValue({ value: value, useMouseKeyboard: true }); sf.keyboard.press({ keys: "delete" }); sf.keyboard.type({ text: value }); }; setTextField(velLow, 0); setTextField(blank, 1); sf.ui.proTools.windows.first.buttons.whoseTitle.is("Apply").first.elementClick(); sf.ui.proTools.windows.first.getElement("AXCloseButton").elementClick();
Llion Robertson @Llion_RobertsonHi Sreejesh,
This is great. Is there any chance you could tweak it so it sets all selected midi notes to C1?
Many thanks
Llion
Sreejesh Nair @Sreejesh_NairThis will work.
var vTranspose = 'C1'; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ["Event", "Event Operations", "Transpose..."] }); const setTextField = (value, index) => { sf.ui.proTools.windows.first.textFields.allItems[index].elementSetTextFieldWithAreaValue({ value: value, useMouseKeyboard: true }); sf.keyboard.press({ keys: "delete" }); sf.keyboard.type({ text: value }); }; setTextField(vTranspose, 5); sf.ui.proTools.windows.first.buttons.whoseTitle.is("Apply").first.elementClick(); //sf.ui.proTools.windows.first.getElement("AXCloseButton").elementClick();
Llion Robertson @Llion_RobertsonThanks for looking into this for me. Unfortunately, it selects the 'Transpose in key' radio button in the Event Operations' box instead of 'transpose all notes to' when you run it so it sets the places the notes in an odd place. Any chance you could tweak?
Sreejesh Nair @Sreejesh_NairWhat version of PT are you on? It works on 2023.12 as intended. If you are on a different version it could be that the order of the textbox has changed. Can you try changing
setTextField(vTranspose, 5);to
setTextField(vTranspose, 4);and check?
Llion Robertson @Llion_RobertsonWorked perfectly! Thanks so much!
- In reply toSreejesh_Nair⬆:MMichael Ubinas @Michael_Ubinas
Hey Sreejesh! Thanks for this script. One question, whenever I run this script, it doesn't click the apply button. Everything is fully updated and It'll still run through the script like everything is normal (and I don't get any errors), but in the end it doesn't transpose. Seems like everything's working perfectly except for
sf.ui.proTools.windows.first.buttons.whoseTitle.is("Apply").first.elementClick();Could you help me with a solution / workaround? Thanks!
- JIn reply toJoe_Kearns⬆:Joe Kearns @Joe_Kearns
Thanks so much!! this works great.
Really appreciate the help!