How to pause until the copying finishes?

I need a macro to be paused until the file copy completed. I can't figure out how to do it.

Thanks

6 Likes

I am sorry for the confusion. I mean Copy/ Paste operation. Until it ends.

The macro at the moment looks like:

It copies the file from one finder window to another

You might try approaching the problem from a different direction, and use Keyboard Maestro's built-in Copy action:

The advantage of doing it this way is that the macro won't proceed until the copy is done, as explained by Peter in another thread:

If you absolutely can't do it that way, then you'll need to use a Pause Until after your Command-V and check the file size repeatedly in Terminal until it's not changing. You can see an example of how I did that in my AppWatcher set of macros (specifically, it's in AppWatchAdd):

This works by repeatedly measuring the size of the file being copied and stopping when the size stops changing. Obviously it would have to be customized for your needs, but this worked for me (when I needed to know if an application was done installing).

-rob.

2 Likes

Come out of your shell, Rob, and use this instead for the file size :smile:

image

1 Like

I think all those things do not work for the multiple selection?

The problem I ran into, at least with application bundles, is that the file isn't really "there" until it's done copying, at least as far as KM knows. As a test, I added a variable to get the size (I assume that's what you meant, not the date?) to a variable during the loop while I'm waiting for an application to finish copying. Here's what I got:

So yea, that's not very useful in my case :).

-rob.

For multiple selections, wrap everything in a loop:

Handle each file, one at a time, and you can do whatever checks you want, because the macro is working on one file at a time.

-rob.

2 Likes

:person_facepalming: doh!