Jump to content

How to send multiple files to my program with Windows Explorer Right-Click?


ioa747
 Share

Recommended Posts

This is my test program

;test11.au3

Local $iParams
$iParams = $CmdLine[0]

If Not $iParams Then
    MsgBox(0, "No $CmdLine[0]", "This means that you have run it without command line parameters")
    Exit
EndIf

Local $Str = ""

For $i = 1 To $CmdLine[0]
    $Str &= "$iParams[" & $i & "]=" & $CmdLine[$i] & @CRLF
Next

MsgBox(0, "files", $Str)

if I select, let's say, three files in File Explorer and I right-click and select  "Open With Test",  
instead of opening an instance of the program with the three files selected ,
three instances of the program are opened and each has one file selected

Whereas if I take all three file and Drag drop them onto the program icon,
all three will open normally in one instance .

as well as the "send to" works normally.

This is my registry entry:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Open_With_Test11]
@="Open With Test"
"icon"="D:\\i\\Pro\\.AutoIT\\_Test11\\test11.exe,0"

[HKEY_CLASSES_ROOT\*\shell\Open_With_Test11\command]
@="\"D:\\i\\Pro\\.AutoIT\\_Test11\\test11.exe\" \"%1\""

I also tried with
'"D:\i\Pro\.AutoIT\_Test11\test11.exe" "%1" %*'
Without any success

 

what is the correct way, so that all selected files are opened in one instance  of my program ?

Any help is appreciated
Thank you very much

I know that I know nothing

Link to comment
Share on other sites

Thanks for the response, and sorry for the delay.

I read the interesting article you post.

my question was born in this post 210945-how-to-get-the-path-of-selected-files-from-explorer-windows-11

Until that moment I hadn't identified the problem because I have the FileMenu Tools installed, which it seems to be using Shell Extension
so all selected files are opened in one instance  of my program, and I thought this is the normal behavior

Then looking for something alternative I found this https://github.com/zenden2k/context-menu-launcher
which does its job just fine without using Shell extension

and I figured the Autoit community would have come up with something similar or used some other way to accomplish this

 

 

I know that I know nothing

Link to comment
Share on other sites

2 hours ago, ioa747 said:

I figured the Autoit community would have come up with something similar

how about this?

(i've had that piece of code running for quite some time now, but it took a few days to wrap it up nicely as a UDF).

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...