Page 1 of 1

Button to run python script with file selected

Posted: 15 Jun 2018 18:59
by dennydraco
Hello,

I am trying to setup a button script to pass the path of the currently selected file to a python script for it to be processed.
Python script is at: C:\Users\user_name\PythonScripts\RightClick\RunCompsClean.py
I'm using the sys.argv[1] to get the path on the script side.
my script works when I run it from the cmd prompt.

itempath (currently selected file) = C:\Users\user_name\comps.csv

I've tried using:
run ' "C:\Users\user_name\PythonScripts\RightClick\RunCompsClean.py" "<curitem>" ';

I know this syntax is wrong. What is the correct syntax? Thanks in advance :beer:

Re: Button to run python script with file selected

Posted: 15 Jun 2018 21:37
by admin
Try this:

Code: Select all

run quote("C:\Users\user_name\PythonScripts\RightClick\RunCompsClean.py") . ' ' . quote("<curitem>");