Author Topic: How to Drop&Run?  (Read 14843 times)

commander

  • Junior Member
  • **
  • Posts: 22
    • View Profile
How to Drop&Run?
« on: May 16, 2024, 02:42:08 »
Windows Explorer accepts dragging a file onto another executable, putting the file path in the argument and executing it. Can Multi Commander do this? I've tried Alt, Ctrl, Shift, but it doesn't work.

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 554
  • Old Skull
    • View Profile
Re: How to Drop&Run?
« Reply #1 on: May 16, 2024, 07:50:49 »
It is possible if you put that executable on the QuickLaunch bar or Button panel.

Example for QuickLaunch bar:
1. Drag'n'drop some executable on the QL bar
2. Customize it by right-clicking the icon and selecting "Customize..." (here you can choose how the dropped files shoud be handled)
3. Now you can drag'n'drop other files on that icon, and they will be opened in that program

Example for Button Panel:
1. Enable wizard mode (Menu Configuration > Toggle button panel wizard mode)
2. Drag'n'drop some executable on the desired button
3. In the settings window check "Accept dropped files..."
4. Disable wizard mode (Menu Configuration > Toggle button panel wizard mode)
5. Now you can drag'n'drop other files on that icon, and they will be opened in that program

commander

  • Junior Member
  • **
  • Posts: 22
    • View Profile
Re: How to Drop&Run?
« Reply #2 on: May 17, 2024, 01:00:19 »
When drop&run, Windows shell normal trasmit two parameters, the first one is the executable path, then the dragged file path. Multicommander just send the dragged file path as the only one parameter, which is not standard. (I choose Program supports more than 2 (paramaters))

Still hope I can drag any file to any executable, don't have to pre-create the shortcut.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: How to Drop&Run?
« Reply #3 on: May 17, 2024, 10:17:17 »
Drop to run in filelist conflict with the Copy and replace feature.. (Drag file to replace another)

commander

  • Junior Member
  • **
  • Posts: 22
    • View Profile
Re: How to Drop&Run?
« Reply #4 on: May 17, 2024, 12:41:49 »
I see. Is that possible to use Alt or Shift as the modifier key? They are not used, right?
Please consider to follow the parameter convention. Currently, my programs can not recognize the file path.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: How to Drop&Run?
« Reply #5 on: May 17, 2024, 14:04:57 »
I see. Is that possible to use Alt or Shift as the modifier key? They are not used, right?
Please consider to follow the parameter convention. Currently, my programs can not recognize the file path.
Not sure what you talking about parameter convention..  The dropped file are sent as a parameter to the file it is dropped on. just like you would call it on the command line.
App.exe <Path of dropped file>


commander

  • Junior Member
  • **
  • Posts: 22
    • View Profile
Re: How to Drop&Run?
« Reply #6 on: May 17, 2024, 19:05:23 »
When you drag a file onto an executable file (e.g., a .exe file) in Windows Explorer, Windows passes the full path of the dragged file as a parameter to the executable.

For example, if you have a file named example.txt located at C:\Users\User\Documents\example.txt and you drag this file onto an executable named processfile.exe, the executable will receive the file path as an argument.

When you drag example.txt onto processfile.exe and run it, the output will look something like this:

Argument 0: C:\Path\To\Executable\processfile.exe
Argument 1: C:\Users\User\Documents\example.txt

argv[0] is the path to the executable itself, and argv[1] is the path to the dragged file. If multiple files are dragged, they will be passed as additional arguments (argv[2], argv[3], etc.).

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: How to Drop&Run?
« Reply #7 on: May 17, 2024, 20:00:47 »
When you drag a file onto an executable file (e.g., a .exe file) in Windows Explorer, Windows passes the full path of the dragged file as a parameter to the executable.

For example, if you have a file named example.txt located at C:\Users\User\Documents\example.txt and you drag this file onto an executable named processfile.exe, the executable will receive the file path as an argument.

When you drag example.txt onto processfile.exe and run it, the output will look something like this:

Argument 0: C:\Path\To\Executable\processfile.exe
Argument 1: C:\Users\User\Documents\example.txt

argv[0] is the path to the executable itself, and argv[1] is the path to the dragged file. If multiple files are dragged, they will be passed as additional arguments (argv[2], argv[3], etc.).

yes Arg1 is the first parameter to the program. argv0 is always the exe of the program it self. it is not something any program sent to it.

commander

  • Junior Member
  • **
  • Posts: 22
    • View Profile
Re: How to Drop&Run?
« Reply #8 on: May 18, 2024, 07:53:12 »
I figure it out now, thank you. When I run python script.py, there is only one argv[0]. I need to run python3 script.py to get two arguments.

lh42

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: How to Drop&Run?
« Reply #9 on: October 11, 2024, 14:24:33 »
Drop to run in filelist conflict with the Copy and replace feature.. (Drag file to replace another)
I also would like to have the ability to just drop files on an executable or a batch file or else to launch it as a parameter. This would be much more useful to me than the replace option. It would be nice to be able to configure which behaviour should be used or to toggle it with an unused modifier key.
The workaround with Quick Launch Bar or Button panel is only useful when you only have few applications to use.
By now I have to temporarily switch to another explorer :( when I have to use this functionality although I use Multi Commander for all the other stuff.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: How to Drop&Run?
« Reply #10 on: October 12, 2024, 08:48:37 »
Drop to run in filelist conflict with the Copy and replace feature.. (Drag file to replace another)
I also would like to have the ability to just drop files on an executable or a batch file or else to launch it as a parameter. This would be much more useful to me than the replace option. It would be nice to be able to configure which behaviour should be used or to toggle it with an unused modifier key.
The workaround with Quick Launch Bar or Button panel is only useful when you only have few applications to use.
By now I have to temporarily switch to another explorer :( when I have to use this functionality although I use Multi Commander for all the other stuff.
If you drag and drop and hold CTRL+SHIFT while dropping on a .exe (so you get the Link overlay on the mouse icon) you get a popup menu whatr do to..  and there you have execute the exe with the dropped file as parameter

lh42

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: How to Drop&Run?
« Reply #11 on: October 29, 2024, 09:37:45 »
If you drag and drop and hold CTRL+SHIFT while dropping on a .exe (so you get the Link overlay on the mouse icon) you get a popup menu whatr do to..  and there you have execute the exe with the dropped file as parameter
Ah yes, nice one, thanks  :) That works fine for .exe files. Is there a possibility to get this also working for .bat, .ps1, .vbs, ...?
BTW: dropping multiple files on a quick launch bar item only sets the first file as parameter, the other files are ignored.

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 554
  • Old Skull
    • View Profile
Re: How to Drop&Run?
« Reply #12 on: October 29, 2024, 13:55:11 »
BTW: dropping multiple files on a quick launch bar item only sets the first file as parameter, the other files are ignored.

Some programs support multiple files as params, some do not. You can customize QL button and try different settings.

lh42

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: How to Drop&Run?
« Reply #13 on: November 05, 2024, 08:03:51 »
Yes, that works  :D
Thanks