I'm writing application to view information from torrent files like torrentlister plugin for Total Commander.
Now at F3 key I have configured external Directory Opus viewer but at F3 key I want run may application.
I want do something lik this
if (extansion of selected file == "torrent")
{
torrentinfoviewer.exe full path of selected torrent file
}
else
{
Directory Opus external viewer
}
How to do this in vbscript or java script ?
yonder
September 2, 2016, 9:39pm
2
This is one way...
[code]function OnClick(data)
{
var cmd = data.func.command;
var tab = data.func.sourcetab;
var sel = tab.selected_files;
cmd.deselect = false;
if (tab.selstats.selfiles != 0)
{
if (sel(0).ext == ".torrent")
cmd.RunCommand('"C:\\path\\to\\program.exe" '+'"'+sel(0).realpath+'"');
else
cmd.RunCommand("Show");
}
}[/code]
This will only pass one file regardless of how many you have selected, will pass the first selected file in the lister.
Thanks soon I Will test it
yonder
September 2, 2016, 10:48pm
4
When I said one file will be passed it's only for the .torrent files, the external viewer will still get more than one passed to it.
Also had a few unnecessary characters in the one line can be changed to.
cmd.RunCommand('"C:\\path\\to\\program.exe" "' + sel(0).realpath + '"');
Do not work. After I pasted this script F3 key stoped work, external viewer also my application don't start
yonder
September 2, 2016, 11:10pm
6
Are you using Opus 11? If so you might have to add @script jscript at the beginning. And/or change the function type to script I can't recall exactly how it's setup in 11 I'm using 12. Also make sure you change the path to the program.exe along with the exe name itself.
Yes I use 11 version.
I pasted this script
[code]@script jscript
function OnClick(data)
{
var cmd = data.func.command;
var tab = data.func.sourcetab;
var sel = tab.selected_files;
cmd.deselect = false;
if (tab.selstats.selfiles != 0)
{
if (sel(0).ext == ".torrent")
cmd.RunCommand('"E:\Directory Opus\Torrentinfoviewer\TorrentInfoViewer.exe" "' + sel(0).realpath + '"');
else
cmd.RunCommand("Show");
}
}[/code]
after I psted script F3 key stoped working
Jon
September 2, 2016, 11:20pm
8
Make sure Function Type is set to Script Function.