How to Wait on Finder to Access Directory

I have written a macro that opens Finder and seeks to access three directories on three remote hard disk drives. The macro works fine after the volumes have been previously accessed, however when the volumes have not been accessed for some time and the drives have stopped spinning the macro doesn't function as desired. Is there a way to cause the macro to pause until each desired external directory has become available?

This is the portion of the macro that needs to wait differing amounts of time depending on awakening the external drive:


The complete macro:
Start Multi-Folder Finder.kmmacros (7.6 KB)

You could use a shell command to see if a known folder on the drives exist:

ServerTest Macro (v10.2)

ServerTest.kmmacros (2.9 KB)

Oops: Just noticed I used 'append results to variable.' You'd want to use 'save results to variable,' not append.

I haven't tested this for this particular use, but I use the if [ -d... construct all the time, and it works great. In this case, we run the shell command, pause for a second, then run it again, and repeat until the variable is set.

Repeat that block for the other two servers, and it should block execution until everything is mounted. Please test carefully before use if you're doing anything destructive!


I can't test my code directly, because I don't have multiple external hard drives, but have you considered this action for the "pause until all folders exist":

If you also want to open all three folders when the conditions are all true, I think you might need to open them after this in another statement(s).