Drag file onto button to open with selected program?

Hi all,

I decided to drag my Notepad2.exe file onto my DOpus toolbar so that I could have a button that would allow me to drag and drop a particular file onto the button and open it in Notepad2 (a quicker way than right-clicking and then selecting "open with" and then "notepad2").

However, when I drag a file onto the button, it only opens an untiled document in Notepad2, not the actual file I dragged onto it.

So I decided to make a shortcut in my quick launch bar for Notepad2 (windows xp), and dragging a file onto the button works perfectly to open that particular file. I'm wondering if I can get the same behavior in DOpus. Any ideas?

Edit the button and add %1 or {f} to the command line.

Hi Jon, thanks for the quick reply. I tried inputting those characters into the command line but can't seem to get it to work. I really don't know what I'm doing so I tried putting the characters in different positions in the command line. What I have now is:

cd "{f}"D:\Portable Apps\\Notepad2"" "D:\Portable Apps\Portable Program Files\Notepad2.exe"

I put the {f} character right at the beginning, inside the first quotation mark - everything else I left untouched. Am I putting the {f} characters in the wrong position?

Hi Jon, never mind, I finally got it to work. I just changed it to:

"D:\Portable Apps\Portable Program Files\Notepad2.exe" {f}

Works perfect! Thanks again :smiley:

You could have saved yourself a lot of trouble by just turning on the Application toolbar (which comes with Opus by default). It includes a Notepad button working exactly as you want.

Alternatively there are hundreds of threads here showing examples of buttons and usage of modifiers and arguments.

How to make this work for multi files selected instead of opening the same app for every file separately?

If you use {filepath$} in the command line, it will automatically run the program once for each file.

If you use {allfilepath$}, it will run the program once and pass all of the filenames, one after another, on a single command line.

Which one of those is best depends on the program. Some programs also have other ways to pass lots of files to them (e.g. via a temporary text file that lists all the paths) which can help when there are a lot of files and/or very long paths. (Windows has a limit to how long the command line can be, which cannot be bypassed.)

1 Like

You're not required to drag and drop. Select item(s), click on the program button and the items will open similarly to a drag and drop.

2 Likes