What I want to do is right click an mkv file and via context menu open the corresponding imdb url.
I can do 2 things to have the imdb url.
1- I can add the imdb.url with mkvtoolnix as attachment to mkv.
2- I can have a separate imdb.url file in the same folder as the mkv.
Which method is easier to script DOpus to launch the .url file? And how to do it. Need general direction.
In the first method DOpus has to read the mkv attachments which I suppose is not possible.
In the second method, DOpus has to read the list of the files in the current folder and launch (double click) the .url file. This also has to work in the search result pane.
Thank you. That looks so much easier than what I was thinking. I have one problem.
This works
{sourcepath}imdb.url
But I have imdb files with the code in the name like .imdb.tt7280898.url
so I need a wildcard and this doesn't work
{sourcepath}imdb.*.url
The batch command works when I use it in a command prompt window outside of DOpus.
When I use it inside DOpus, a dos window shows and closes instantly like it is crashing and nothing happens. Even if I add a PAUSE as second line, I can't see what's happening.
Thank you. Now it works. However there is a problem.
It works when I'm in a normal view inside a folder. If I'm in a search results view with several mkvs, it opens multiple imdb pages. How to do, to open only the "right clicked" file imdb page in a search results view?
Also, the point of this, is to use it in a search results pane when you have multiple mkvs in one view. If I was in a normal view inside a folder, I could easily click on the .url file itself. I'm not that lazy.
I wrote this script that works also with multiple selections in a search results view. If you select several files, it goes into each folder of those files and opens all .url files inside.
However this works as a button and it does not work as a context menu script. I suppose because context menu has no OnClick function. How can I modify this to work in the context menu also? I have already spent 5-6 hours on this and my brain is not working anymore to find it myself!
function OnClick(clickData)
{
DOpus.ClearOutput();
// --------------------------------------------------------
var cmd = clickData.func.command;
cmd.deselect = false; // Prevent automatic deselection
// --------------------------------------------------------
if (clickData.func.sourcetab.selected.count == 0)
{
DOpus.Output(" (none)");
}
else
{
for (var eFile = new Enumerator(clickData.func.sourcetab.selected_files); !eFile.atEnd(); eFile.moveNext())
{
var sDir = eFile.item().Path;
var eSel = DOpus.FSUtil.ReadDir(sDir);
var eItem;
var file;
var fileext;
while (eSel.complete == false)
{
eItem = eSel.Next();
file = eItem.RealPath;
fileext = eItem.ext;
DOpus.Output(file);
if (fileext == ".url")
{
DOpus.Output("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
cmd.RunCommand(file);
}
}
DOpus.Output("-----------------------------------------------------------------------------------");
}
}
}
I think you have to move your script into a user command and insert this command as the action of your File Types context menu. You can reuse the user command in your regular button.
Zolder, please show a screenshot of the context menu definition. We should be able to see what is wrong from there. My guess is it is not set to the right script language.
That's how it used to work everywhere (and still does behind the scenes, if you look at the button data in a text editor). We just added the language drop-down in the button editor to make things easier in the place that 99% of scripts get written.