Hi,
I need a SafetyNet that checks if any Clips are selected, if no clips selected abort/throw error.
All I tried faild :-(
Thanks for help!
- Kitch Membery @Kitch2020-11-23 11:02:47.248Z2020-11-23 11:11:32.747Z
Hi @ingo_luftrausch,
Did you try the script in this post by chance?
Ingo Pusswald @ingo_luftrausch
Hi Kitch,
which post? (no link)- In reply toKitch⬆:
Ingo Pusswald @ingo_luftrausch
I´m currently trying this one:
sf.ui.proTools.appActivateMainWindow(); const audioExists = sf.ui.proTools.getMenuItem('Clip', 'Edit Lock/Unlock').isEnabled; if(audioExists){ log('Audio Exists in the selection!') } else { log('Audio does not Exist in the selection') }
But my scripting skills are very bad :-(
- In reply toKitch⬆:
Ingo Pusswald @ingo_luftrausch
Yeah, that's the one.
But I'm unable to change behaviour if audio exist = continue, No audio = abort/throw errorKitch Membery @Kitch2020-11-23 11:20:29.868Z
Got it!
This should do the trick;
const audioExists = sf.ui.proTools.getMenuItem('Edit', 'Trim Clip', 'To Selection').isEnabled; if(!audioExists) throw `No audio exists`; //Add rest of script here.
Rock on!
Ingo Pusswald @ingo_luftrausch
Okok, superduper!
so far so good, THANKS!
I changed getMenuItem to "Clip, Edit Lock/Unlock" cause its active only when at least one full clip is selected.
Throw Error message is a bit confusing " Error running .... ck0i8..... line 5 .... NoAudioExsist".
Is it possible to reduce the message to only show "No Audio..."?thanks in advance!
Kitch Membery @Kitch2020-11-23 11:54:19.939Z
Awesome.
Regarding the error message, Will have to look into that one for you mate.
- In reply toingo_luftrausch⬆:
Dustin Harris @Dustin_Harris
Try:
const audioExists = sf.ui.proTools.getMenuItem('Edit', 'Trim Clip', 'To Selection').isEnabled; if(!audioExists) { log(‘No Audio Selected’); throw 0; } //Add rest of script here.
:)
Kitch Membery @Kitch2020-11-27 05:29:15.867Z
It must have been late hahahaa thanks Dustin.