Closing window after mounting network drive?

I have created a new macro that detects when my Mac is active on my home Wifi and then mounts a network connected drive. I wish to close the window that displays when the drive mounts. Currently I pause to wait for the drive to mount. Then I test to see if any window in Finder contains the title for the mounted drive window. I am attempting to close the window in Finder that contains the title. When I "try" the macro, it works except for closing the window. All tests show "True" when I step through the macro and when I try the last step of closing the window it works properly. When I run the whole macro, the window does not close. New to KM. Looking for help on this. Picture attached of macro.


First off, let me confirm that I think this should work also. You’re not crazy (or we both are).

Given that, this sounds like a timing issue to me.

Give it another trigger you can use anytime, and disable the “Open URL” action. Then open the Finder window manually, wait a second, and trigger the macro. That should work, unless you’ve got a spelling error somewhere.

Assuming that works, then I’ll bet you need a short Pause action after the “Pause Until” action.

Oh, and you shouldn’t need the “IF”, because the “Pause Until” should cover that condition.

Thanks very much for the quick response. I added a 5 second ‘pause’ after the ‘pause until’ and it works without issue. I had added in the ‘if’ statement after it was initially not working and to provide more state validation steps. i have removed it now as it is indeed not needed.


Awesome. I wouldn’t think you’d need as much as 5 seconds - I would have guessed a half second at most. Shows how much I know! :slight_smile:

If my post answered your question, please click the checkmark at the bottom of that post, so your topic shows as “Answered”. Thanks, and welcome to KM! Don’t be afraid to ask more questions!

Hey Andrew,

You're better off testing for a real condition than using an ambiguous pause.

You can set a timeout for the pause-until action by opening the gear-menu and selecting “Set Action Timeout...”



You could also mount the volume with AppleScript.
This does not open a window.