Apple Script: move files which contain a date in the past

Hi everyone,
I try to use Hazel and Applescript to move files to an archive folder. I want to move all files which have a date in the past in its content. So in Hazel I can match patterns date and can inject it into the apple script via inputAttributes.
I am an Applescript noob and so I cannot find a way to compare that date to the current date and process the file if the date is in the past. I looked at some applescript forums for a script but could not find a solution. Does anyone of you know how I could accomplish that or what keywords I should look up to find a solution to that problem?

If I understand correctly what you are wanting to do, I think you can do this in Hazel directly (rather than using the Applescript).

You can add another condition to the Hazel rule using the custom token (it’s down the bottom). You can choose to only match the document if “[Date] is before Today” for example.

1 Like

THANK YOU! Yes I overlooked that in Hazel. Perfect. So I should have looked more closely into that amazing app instead of going through pages and pages of applescripts! :grin:

1 Like