Delete Selected Track doesn't always work
Hey Guys.
Is there a way I can make my "Delete Selected Track" macro work in Pro Tools no matter what type of track or tracks are selected? I've noticed that if you've selected an Audio Track the "delete" in the track menu says "Delete..." whereas any other tracktype or group of tracks says "Delete" with no dots at the end. Is there a smart way around this so I can have one "Delete Selected Tracks" macro? Thanks in advance!
- samuel henriques @samuel_henriques
Hello Bergatron,
This should do it,
sf.ui.proTools.appActivateMainWindow(); if (sf.ui.proTools.getMenuItem('Track', 'Delete...').exists) { sf.ui.proTools.getMenuItem('Track', 'Delete...').elementClick(); sf.ui.proTools.confirmationDialog.invalidate().elementWaitFor(); sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is('Delete').first.elementClick(); } else if (sf.ui.proTools.getMenuItem('Track', 'Delete').exists) { sf.ui.proTools.getMenuItem('Track', 'Delete').elementClick(); }
Bergatron Music @Bergatron_Music
Thank you.
- In reply toBergatron_Music⬆:Ryan DeRemer @Ryan_DeRemer
sf.ui.proTools.trackDelete();
will also accomplish this, minus clicking through the confirmation. The code below achieves the same thing a slightly different way. I've found this way of dismissing the confirmation to be a bit quicker and more stable:sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ['Track', 'Delete'], looseMatch: true }); sf.ui.proTools.confirmationDialog.elementWaitFor({ timeout: 300, pollingInterval: 10, onError: 'Continue' }); if (sf.ui.proTools.confirmationDialog.exists) { sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is('Delete').first.elementClick(); sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: 'Disappear' }); }
Bergatron Music @Bergatron_Music
Thank you.
- In reply toBergatron_Music⬆:Chris Shaw @Chris_Shaw2022-07-06 20:47:52.259Z
Here's another approach which asks for confirmation before deleting:
sf.interaction.displayDialog({ title: "!!!! D e l e t e T r a c k s !!!!", prompt: "Delete Selected Tracks? \n\n (THIS CAN'T BE UNDONE!!)", buttons: ["Cancel", "OK"], defaultButton: "OK", onCancel: "Abort" }) sf.ui.proTools.trackDelete();
Bergatron Music @Bergatron_Music
Thank you!