Watch downloads folder for PDF’s and import into iBooks

Can someone point me in the right direction for this one pls?

The following code should work as far as I can tell but I must have made a mistake somewhere because it isn't clicking on Add. I think someone smarter than me should try to see what I did wrong.

I take advantage of the fact that you don't even have to pass the filename to the Books app, which will simply import all the files that are valid (eg, PDF) when the path contains any valid files. The first time you run this you may have to browse to the Downloads folder but after that it will remember that folder location.

The macro could easily be modified to work only overnight if you don't want it to interfere with your screen while you are working.

If you import the same book twice, it will warn you and ask you if you want to REPLACE the original files. Since that might delete something accidentally, I decided not to add that feature for now.

Thanks for this and sorry for the late reply, it’s been the weekend here in Aus. I’ll give this a go tomorrow and let you know if I get it working.

I'm afraid that even if @Sleepy's macro worked as intended, it would result in a lot of false positives since it would run every time any file is added to Downloads, regardless of whether it was a PDF or not. I would recommend trying something like this instead:

Watch Downloads Folder, Import PDFs into Apple Books.kmmacros (2.5 KB)

1 Like

Yes I knew that, but it still worked, because Books ignores anything other than PDFs. As a matter of fact, I even dropped an "IF not PDF then exit" statement around my code, almost identical to yours, because it didn't matter.

It may not matter in terms of what gets imported to Books, but it matters in that with your suggestion, any file added to Downloads would cause Books to be activated, brought to the forefront, and interrupt what the user was previously doing, even when the new file isn't an importable PDF. I can't see why any user would want that. I also don't see why it would be preferable to activate Books, pause for it to come to the front, and manipulate its GUI to add every PDF file in Downloads, whether or not it's new, when Open File used with the folder trigger only adds newly added files quickly, reliably, and automatically in a single action (which also avoids the issue of Books trying to re-import existing files).

You are right. I shouldn't have dropped the IF PDF statement. My fault. And your use of Open action is much wiser. I don't always give the best answer. Thanks for correcting me.


Thanks for this gentlemen. I haven't played around with it much yet. I'll have a go if I get a chance later today.

This thread might be of use, partially: