The attached macro should import audio and video files into Nuendo.
It works correctly if there are audio and video files exist in the selected folder.
But it doesn't work if there is no audio and only video in the folder.
Please help me to figure out why.
Thanks!
Either use the Debugger (available from the KM menu bar icon) to step through your macro to find the error -- instructions on how to use it are here: Macro Debugger -- or liberally add "Display text" actions to your macro to find out where it is going wrong.
But if I had to take a guess based on your description -- if there's no audio files you aren't importing any audio tracks. So Nuendo won't be in the expected state when the "Set Time-Code from audio" group runs. You need to change your "If" test because the "last action result" is "OK" even when there's no audio to import. Maybe test for the presence of a menu item instead, or set a "Local_hasAudio" variable if a track is imported.
Yes, you are right. If I exclude the timecode group, it works. But I am not sure why as in the timecode group I have "otherwise" action if the audio import fails.
Actually it would be easier to set the condition If "wav file exists in the specified folder". But I couldn't figure out how to do that except the For Each action.
Ah, but you don't. You're checking the "last action result" -- was the last action executed without an error -- rather than something being true or false.
It doesn't matter if the "If..." is true or false, the dialog is still "OK". When true it's because the "Set Variable..." action completed without error. When false it's because the "If..." action completed without error (because there's no action in the "otherwise" section).
You could do it by:
Setting a variable Local_wavFile to falsebefore the "Import Audio" block
Including a "Set Local_wavFile to true" in the "execute if true section of each of the "Import..." blocks
Testing Local_wavFile in your "Time-Code" block
But the easiest way is to test directly, with a shell script, if the directory you are importing from contains any files ending with .wav. I think this will do it, but do check I've used the right variable:
I am not well versed enough in shell scripting to really see why, but I am not able to make this script return a success here either, and I am still on Ventura.
I might be missing what you are trying to do here now, but if it is to check if a file selected in finder is in fact an existing .wav file it could also be done, for instance like this:
But as the %FinderSelection% token only wors with single selection (returning empty if more than one file is selected) this method will only work with a single finder selection, (the %FinderSelections% token, returning a line separated list of all paths in selection, would not here work directly within a Split Path either.) The way I've set it up above, with Faliure Abort Macro and Notify On Failure both turned off in the Split Path cogwheel menu, it will return 'not' of multiple files are selected, but this is probably not what you want, IF at all want to select multiple files, that is.
If you are interested in selecting multiple files, checking to see if all of them are .wav.files it could be set up like this, in a for each:
Since the paths are all coming from a finder selection I believe it should not really be necessary to check if at the path, something exists, but this way it is at least thoroughly tested.
The shell script does not return success for me if selecting a folder with .wav files ether.
For checking a folders content you'd need to set the for each up like this, for method 2 to work with checking that all fles in that folder are .wav files:
Do you actually have a folder containing WAVs selected in that window? %FinderSelection% requires an actual selection, not just an open window -- for that, use %FinderInsertionLocation%.