Command for: open prog.X &/or open selected file in prog.X

I have a button setup for open programme X & for open selected file in programme X

Left click being:
"Programme path"
Right click being:
"Programme path" "%1"

At some stage someone (nudel i think?) gave instructions for how to make one command that covered both options.
I did a search for this but got 866 results (tried to narrow it down a few times but still couldnt get the right one) ... so I'm starting a new thread.

can anyone help? thanks in advance, tom

You can use the right-click command for both. If no file is selected then the %1 stuff will be ignored.

I think %1 is the same as {filepath} except it also works in Explorer, unlike {filepath} which is an Opus-only thing.

{filepath} means "wants the first selected file."

{filepath$} means "needs the first selected file."

It at least one file is selected then both {filepath} and {filepath$} will will run the command against the first filename.

If no files are selected then {filepath} will run the command without any arguments but {filepath$} will prevent the command from running at all.

thanks nudel for the prompt reply.

true, they both work to open the programme if no file is selected:

"Programme path" "%1"
"Programme path" {filepath}

they both bring up a "could not find file" window but i can live with that :slight_smile:

They shouldn't bring up window... Is the window coming from Opus or from the program that's being launched? Can you paste the real command for us to have a look at?

your recommendation works perfectly (well, it works perfectly now!)
C:\Programme\Adobe\Photoshop 5.5\Photoshp.exe {filepath}

with this one:
"C:\Programme\Adobe\Photoshop 5.5\Photoshp.exe" "%1"
If no file is selected it (Photoshop) brings up a window - "could not open the document cause the file could not be found"
(same with or without inverted commas round path)

Testing before my previous post, I had a folder selected -
If a folder is selected when I use either command I get the same window as above but that's logical, innit !?!

so I'm happy now, thanks, apologies for the complications :slight_smile:

Cool, glad it's working.

I'm not sure how quotes are handled with %1 but if it's an Opus-only then this should be the perfect command:

"C:\Programme\Adobe\Photoshop 5.5\Photoshp.exe" {filepath}

The {filepath} part will be automatically quoted, if required, by Opus.