Context menu/menu/toolbar icon to launch external program

Ask for help and post your question on how to use XnView MP.

Moderators: helmut, XnTriq, xnview

emdx
Posts: 2
Joined: Tue Aug 05, 2014 8:27 pm

Context menu/menu/toolbar icon to launch external program

Post by emdx »

Is there a way of configuring XnView to launch an external program with the parameters of the currently selected files/directories?

Let’s say I want to run a specific, specialized program on several pictures. I would like to be able to select one or more files (and directories), and select a function (either via the menu, toolbar or context menu) which would be then passed via it’s command line the names of the files/directories selected.

Example: let’s say I want to run the program “C:\program files\fooBar.exe” on the files “1.jpeg”, “2.jpeg”, “8.jpeg”. I select the three files then I click on the custom “Foo Bar” function, and XnView would execute the command line “C:\program files\fooBar.exe 1.jpeg 2.jpeg 8.jpeg”.

This could be a versatile and easy way to customize XnView without having to deal with the hassle of compiling a DLL… (You could conceivably even link a batch file / bash script)…
User avatar
XnTriq
Moderator & Librarian
Posts: 6040
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Context menu/menu/toolbar icon to launch external progra

Post by XnTriq »

  1. Go to Tools » Options... » Toolbar » Buttons » Buttons displayed » Browser
  2. Click on Append.
  3. Enter the path to the program's EXE.
    • Command: [ C:\Progra~1\fooBar.exe ]
    • Icon file: [ C:\Progra~1\fooBar.exe ]
See also: How to "Batch" several commands via Icon in the Viewer?
emdx
Posts: 2
Joined: Tue Aug 05, 2014 8:27 pm

Re: Context menu/menu/toolbar icon to launch external progra

Post by emdx »

Oh cool! Thanks! Just what I need.

But on XnViewMP, you have to go to Tools → Settings → Interface → Toolbar, then add a “-- COMMAND --”, then click on the “Set Label…” button to set the label, click on the “Set command…” to set the command, and “Set Icon…” to set the icon.

The only thing is that it won’t work for a whole directory… :(
User avatar
XnTriq
Moderator & Librarian
Posts: 6040
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Context menu/menu/toolbar icon to launch external progra

Post by XnTriq »

<-- Moderator's note: This topic has been moved from “Contribution | Customization” to “XnView MP | MP - General Support”. -->
emdx wrote:The only thing is that it won’t work for a whole directory… :(
You can tell XnView's browser to Show all files (recursive) from the context menu of a directory in the folder tree.