Run a Python script with filename arguments as a MacOS Folder action

1

I would like to run a Python script as a Folder Action in Mac OS. The Python script takes the name and full path of a file as an argument. Ideally, I would like to right-click on a file in Finder to launch the Folder Action, taking the name of the file as the first argument and the path as the second argument. But I can't figure out how to load the two variables in Automator.

This is the furthest that I have been able to get,

AutomatorScreenCap

where $1 should be the filename, and $2 should be the full path of the file.

Does anybody have any hints for how to do this?

Chris is the MC

Posted 2016-12-25T18:17:37.840

Reputation: 11

can you post your code? also it might help more to post this on Stackoverflow instead of SuperUser – xR34P3Rx – 2016-12-26T10:02:39.050

Answers

0

I was able to get it working for my use case, but I only used a filename.

~/anaconda3/bin/python <path to python script> "$1"

xfsrg

Posted 2016-12-25T18:17:37.840

Reputation: 1