Run command on Python?

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
sanferno
Silver Member
Silver Member
Posts: 288
Joined: 2013 Nov 30, 18:40

Run command on Python?

Post by sanferno »

Hi everyone!

I will like to know if its possible to run scripts throught "User Commands" and, if I can do it, how should I do it?

Thanks :)
longfellow
Silver Member
Silver Member
Posts: 244
Joined: 2004 Jun 16, 15:09

Re: Run command on Python?

Post by longfellow »

Sure. You can find full details in the User Manual beginning on page 239 (version 2.1.0-1), or under "User Commands" in the Quick Start Guide.

Basically, you want to set up a user command something like this:

Code: Select all

$$ "C:\Path\To\Directory\script.py" "$N"
$N is a token representing the filename you've selected in the active window. (There's a handy info button in the User commands properties dialog that lists all the tokens.) The quotes around the path and file names ensure that any spaces in the names are parsed correctly. If your script takes arguments, you can add the $? token, and x2 will pop up a dialog where you can enter the arguments before the script is run.

Code: Select all

$$ "C:\Path\To\Directory\script.py" $? "$N"
sanferno
Silver Member
Silver Member
Posts: 288
Joined: 2013 Nov 30, 18:40

Re: Run command on Python?

Post by sanferno »

Thank you, you have give me the key!

But, for me Works like this:

Code: Select all

> "C:\temp\helloworld.py"
Thank you again.
Post Reply