Using a Folder Trigger to Prompt Renaming and Moving New Screenshots

Hi!

I'm trying to create a macro that is triggered by a screenshot being added to the Desktop. When this happens, the macro is supposed to ask me for the new name of the file, rename it, move it to a new destination (always the same) and copy the new path of the file to the clipboard.

I did what you can see below and it doesn't fully work: the user prompt shows up twice when a new screenshot is added to the Desktop. The KM log shows that actually the whole macro is triggered twice at almost the same time. I therefore changed the option "ignore partial files" to "ignore partial or changing files". This solves the problem in that the macro is just triggered once, but it creates a new problem: it takes ages (about 8 seconds) until the macro is activated after the file is actually visible on the desktop. This is too long for me to wait in the situations in which I want to use the macro. Any idea how this problem can be solved?

Hi Vinho,

Perhaps a semaphore lock might help?

1 Like

Thanks for the suggestion, didn't know about semaphore locks before! I tried leaving "Ignore partial files" (because of the problem with the long timespan) and added a semaphore lock with a very short timeout. The result: The first macro activated remains the only one, so that's good. But: The screenshot file that activated this first macro is a changing file, so it has a "." at the beginning of its filename which is part of the variable TriggerValue that the macro uses. The macro can then later not find the screenshot file that is supposed to be renamed and moved, because in the meantime the changing file has disappeared from the Desktop and the file that is present doesn't have a "." at the beginning of its filename anymore.
What I had to do is change the macro to use a substring of TriggerValue that gets rid of the "." – it works now but doesn't feel very elegant.
A more elegant way would be to cancel the first macro that is activated by the screenshot being added to the Desktop (still changing file) instead of the second one. But I don't know if there's a way to do that...

what about:

3 Likes

I wasn't aware of the "Cancel This Macro" actions – that's a great idea! Needed to choose "contains /." as the If-condition, though, because TriggerValue is the whole file path which doesn't start with a dot.

Thanks a lot!

1 Like

Years it took me to read this correctly. Thanks.

2 Likes