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’)
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:
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.