Button to run python script with file selected

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
dennydraco
Posts: 7
Joined: 25 Jul 2014 16:20

Button to run python script with file selected

Post 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:

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Button to run python script with file selected

Post by admin »

Try this:

Code: Select all

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

Post Reply