Folder trigger to Automator Action

Hi everyone. I am trying to trigger an automator image action when a new image file hits a directory. But unsure on how to pass the TriggerValue to the automator action, is this possible?

The Execute an Automator Workflow action does not have any option to pass data to the workflow.

So to pass information into the Workflow you need to set a variable in Keyboard Maestro, and then you need to read that variable in the Workflow. Unfortunately, the Workflow does not have access to the KMINSTANCE so you need to use a global variable. To avoid problems with multiple files being added to the directory at the same time, use a Semaphore Lock action. So you end up with something like this:

And a workflow like this:

Where the script is:

on run {input, parameters}
	tell application "Keyboard Maestro Engine"
		set v to getvariable "Path"
	end tell
	return v
end run