Run a Python command automatically

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Run a Python command automatically 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
nitin
 
Posts: 2
Joined: Tue Jan 21, 2020 6:24 am

Re: Run a Python command automatically 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.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Run a Python command automatically 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.
nitin
 
Posts: 2
Joined: Tue Jan 21, 2020 6:24 am

Re: Run a Python command automatically 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.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support