Moving files added to Desktop to Downloads Error

Why do I get this error:

Screenshot 2023-10-25 at 10.31.35 PM

For Each.kmactions (1.0 KB)

Keyboard Maestro Export

I'm not sure what the rest of your macro is doing, or how you ended up using the %TriggerValue% token, but if I understand your goal correctly you should instead be using %File% (the name you chose for the "For each" portion).

The fact that the file in your error has a leading dot is curious, and I wonder if that's the true path of the file.

If changing to %File% doesn't work for you, please post the full macro so we can investigate.

3 Likes

To expound on what @avtraino said, the for each action is assigning the variable file to each file in the ~/Desktop location, and the nested move file action is attempting to act on the file assigned to that variable (obviously not all at the same time, but one at a time in alphabetical order). But you have used the %TriggerValue% token in the first field, which may or may not be the file you are attempting to move. So replace %TriggerValue% with %Variable%File% and it should start working for you. Let us know if it doesn’t.

@avtraino I was using %TriggerValue% based on recommendation from @jmichaeltx and @peternlewis here: Move Downloads Folder Content to Desktop Macro - #2 by kcwhat

@cdthomer changing the variable to %Variable%File% still does not work

You need to show us the whole macro - not just a few actions from it. Can you post that up here please?

1 Like

Move ALL files from Desktop to Downloads.kmmacros (2.4 KB)

Here is the whole macro - it monitors for files added to Desktop and moves them to Download folder - similar to the macro in the reference I provided above.

OK - so this is what'll work for you:

Download Macro(s): Move ALL files from Desktop to Downloads.kmmacros (2.1 KB)

Macro-Image

Keyboard Maestro Export

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 10.15.7
  • Keyboard Maestro v11.0

The semaphore ensures files added to the Desktop are processed and moved one at a time - if you're adding more than one file at a time that is. Works fine for single files too.

2 Likes

Take a look at this post from @jmichaeltx in the thread you linked.

You're using the Folder trigger, which provides the path of the triggering file as %TriggerValue%, then you're redundantly looping through every file in the source folder. Instead, you should act on the %TriggerValue% directly, without a loop.

Edit: @tiffle beat me by a hair :slight_smile:
The solution was alluded to in that thread but never posted. Try this:
Move ALL files from Desktop to Downloads.kmmacros (1.7 KB)

2 Likes

Hey Vito - mine's different to yours so no need to get crossed out :smile:

1 Like

Thank you for your help!

@avtraino - your macro works well, no issues

@tiffle - your macro gives this error prior to moving each file:

The macro I provided doesn't have and checkpoint actions in so I suggest you are running some other macro.

I did run the macro with checkpoints disabled.
Deleting them completely fixed the problem and the macro is now working.

In which case you didn’t run the macro I posted in this thread!

@tiffle - you macro works well - I made a mistake and didn't trigger it correctly.

1 Like