I'm trying to trigger a call to a program directly from Windows Explorer with the selected files as parameter, and this with a key push (on F12 or Ctrl+E for example). The same kind of action as when you select more than one file and press F2 to rename them all. I was looking in the registry but with no success.
For example, when I open my src
folder and select a few JS files I have to right-click on a file, select "Send To", and select the right shortcut to my "programme.exe" software (transcription from JS, import of a few environmental vars, etc.). It would be helpful if I could simply press Ctrl+E to transcript and edit those selected files.
An other similar thing I'm looking for is to press F12 and edit all my selected files (it's easier for me to use a keyboard than a mouse).
I'm on Windows 10 and don't think this is linked to desktop shortcuts or anything like that. I should have been more explicit; the external calls are done, but the link between the keyboard shortcut and these calls is the part I'm trying to deal with.
I've already created an AutoIt script that does this, but it should be possible within the Windows Explorer itself (and only when it's needed, not looping a script infinitely I mean), shouldn't it?
#include <Array.au3>
#include <WinAPI.au3>
; Init - stop
Global $stop = False
HotKeySet("{F4}", "stop")
Func stop()
If $stop Then Exit
$stop = True
EndFunc
; Init - trigger
Global $trigger = False
HotKeySet("^t", "trigger")
Func trigger()
$trigger = True
EndFunc
; Event loop
While Not $stop
Sleep(100)
If $trigger Then
action()
$trigger = False
EndIf
WEnd
Func action()
ConsoleWrite(@CRLF)
; Check active window (explorer only)
Local $handle = WinGetHandle("[ACTIVE]"), $class = _WinAPI_GetClassName($handle)
ConsoleWrite("- Window:"&$class&" ")
If $class <> "CabinetWClass" Then Return
; Get object linked to window
Local $shell = ObjCreate("Shell.Application"), $window = 0
For $object In $shell.Windows()
If $object.HWND() = $handle Then
$window = $object
ExitLoop
EndIf
Next
If $window = 0 Then Return
; Check active component (right filelist panel only)
Local $control = ControlGetFocus($handle)
If $control <> "DirectUIHWND3" Then Return
; Get selection (files selected in the right panel)
Local $selected[1] = [0]
For $element In $window.Document.SelectedItems()
If $element.IsFolder Or $element.IsLink Then ContinueLoop
Local $path = $element.Path
For $i = 1 To $selected[0]
If $path = $selected[$i] Then ContinueLoop 2
Next
$selected[0] = $selected[0]+1
ReDim $selected[$selected[0]+1]
$selected[$selected[0]] = $path
Next
; Action : ###############################
EndFunc