Page 1 of 1

Run a Python command automatically

PostPosted: Tue Jan 21, 2020 6:31 am
by nitin
Hi,

I use a python script to split a pdf file. The script is "python3 split_pdf.py -i file_name.pdf".
Can I make hazel run the script automatically when it sees a pdf file ending with "_label" in the downloads folder?

Thank you

Re: Run a Python command automatically

PostPosted: Tue Jan 21, 2020 11:10 am
by Mr_Noodle
That should be doable. You can use the "Run shellscript" action to run the script. If you run into any problems, post back here.

Re: Run a Python command automatically

PostPosted: Fri Jan 24, 2020 11:41 am
by nitin
I can make hazel run the command if I hav the file name.
But I don't know how to make it happen if I don't input the file name.

Re: Run a Python command automatically

PostPosted: Mon Jan 27, 2020 11:01 am
by Mr_Noodle
The script is passed in as the first argument, which in python, I believe is $1.