Author Topic: How to Drop&Run?  (Read 1585 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: 524
  • 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: 4325
    • 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: 4325
    • 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: 4325
    • 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.