Run Python script with path as argument from total commander

1.6k Views Asked by At

I've got a script that accepts a path as an external argument and I would like to attach it to Total Commander.
So I need a script/plugin for TC that would pass a path of opened directory as an argument and run a Python script which is located for example at C:/Temp

How can I achieve this?

Best Regards, Marek

2

There are 2 best solutions below

0
On BEST ANSWER

Ok, I managed to do it. You don't quite have to pass a path as an argument.
You just need to add a quick button at the top of the TC.
enter image description here

As a Query just place python and location to Python script.
You can either pass any argument if you want (but in this case you don't need this).
As an initial path you set cm_AddPathToCmdline which returns a path to currently opened directory.
And that's it. :)

import os
os.makedirs("TEST")

enter image description here

1
On

You can add a new button to the button bar.

  1. Right-click on an existing Icon and copy the icon by choosing "copy" from drop-down menu.
  2. Paste it into the button bar by right-clicking on it, choosing "paste" from the menu.
  3. Right-click on this copied icon and choose "modify" (or similar). This opens a window that allows you the choose a program and a parameter.

Note: My version is set to a different language so the names of the menu items might be a bit different.