How Can I Process the Added File in a Folder Trigger?

I am trying to create a folder action that when a new PDF is added it opens automatically in PDF Expert. This folder contains the MSWORD.docx files as well, and so I need to filter just for PDF's.

At the moment, this works BUT... when I add a new PDF - PDF Expert opens all 50 or more PDF files already in that folder.

What command will make KBM just open the latest added file and none of the others?

Hi, @sanshoo. I don't have much experience with the Folder Trigger, but it looks like you'd want to start with %TriggerValue%. Here's a simple example:

DOWNLOAD Macro File:
Folder Trigger Test.kmmacros (3.0 KB)
Note: This macro was uploaded in a DISABLED state. It must be ENABLED before it can be run. If it does not trigger, the macro group might also need to be ENABLED.

Macro-image

As @_jims notes, the Folder trigger sets the TriggerValue token to the path of the triggering file.

So you can use an If Then Else action with a Text condition to see what kinds of file was added and then behave appropriately.

Hi @_jims @peternlewis
Between the both of you, you have solved my problem. And in a strange way, you made me think and puzzle it out (Which took more than an hour) but that will prove to be better than just sharing a working macro with me. So, THANK YOU both.
Regards,
sanshoo (Russell)

2 Likes

There's an old expression, which applies here, but I've added some words to the expression.

Give a man a fish, you feed him for a day.
Teach a man to fish, you feed him for a lifetime.
Teach a man to teach others to fish, you feed a town for a lifetime.
Teach a man to teach others to teach others to fish, you feed a city for a lifetime.
Teach a man to teach others to teach others to teach others to fish, you feed a country for a lifetime.
Teach a man to write a book to teach others how to fish, you feed the world forever.
Write a book to teach others how to fish, you feed the world forever.
Fish, before you forget to feed yourself.
1 Like

Ha! Provided they're not vegetarian.
But I like your wise words. Cheers, Russell.