Action - Pause Until folder has a new file added?

Can we pause a macro until a file is added to a specific folder? if so, how?

Please note I am not trying to trigger a macro when a file is added to a folder. (‘Action’ not ‘Trigger’)

There are two possible techniques for this:

  • Set a variable to 0, Pause Until the variable becomes 1, and have another macro triggered by the condition that sets the variable to 1.
  • Remember the state, and use a script condition to test when the state changes, and Pause Until that.

The first is pretty easy to implement.

The second is dependent on the exact nature of the problem. Can files be removed from the folder? If not, then pausing until the count of files in the folder changes would be sufficient (see elsewhere on the forum for how to count the number of files in a folder). If files can be removed, then you would really have to check that there now exists a file that didn’t previously exist, and that would require some sort of diff of the file listing. Perhaps save the file listing to a file, get a new file listing, and literally use the diff command to look for any new lines.

Is it possible to pause until a new file is added/exists in a particular folder?

Make a macro that triggers when a new file is added to the folder (Folder trigger). Have it set a variable to true.

In your macro, set the variable to false, then Pause Until the variable is true.

If you expect that will take some time, either consider using the trigger macro to actually do the remainder of the work instead, or use a While loop with a timed pause to reduce the workload.