ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

"IDEA" : Key to Replace Context Menu R-Clik Program Start On Selected

<< < (4/4)

Nod5:
@4wd: I took MourningStar to want to apply the exact context menu verb on the selected files. That will sometimes be different from passing a textfile with filepaths to the target application. But if the applications they want to use this on have command line equivalents for each of the wanted verbs then your approach, if we add an extra step constructing the command line argument, is an alternative way to do it.

edit:
Doh! You already made my point. Or rather I repeated yours.
passed to the end program, (or intermediate cmd file if the program can't take text list input).
-4wd (April 23, 2019, 04:51 AM)
--- End quote ---
I suppose I'm standing on the shoulders of 4WD giants 8)

4wd:
I'll have to download AutoIt and have a play since I don't use it anymore but it should be a simple change - if someone wanted to, they could also integrate the hotkey assignation via a GUI rather than rely on an external program, (eg. Clavier+).

It's actually a bit strange that given PowerShell's ability to access most Windows APIs there still seems to be no way to collect selected files in explorer using it.

4wd:
OK, a mish-mash of programs but it works for me :)


* Download and install Clavier+ (I'll be using this for the example - use whichever hotkey program you're comfortable with)
* Download the attached archive and put ExClip.exe somewhere
Then see below for setting it all up:

Clavier+ - set up the hotkey to what you want, set the path to ExClip.exe and the auxiliary cmd file as necessary.
"IDEA" : Key to Replace Context Menu R-Clik Program Start On Selected

"IDEA" : Key to Replace Context Menu R-Clik Program Start On Selected

The cmd file - this is a simple file that takes the text file generated by ExClip and changes it to an M3U playlist file, then calls the default program for it (MPC-BE in my case):

m3u.cmd

--- Code: Text ---echo #EXTM3U > "%~dpn1.m3u"type "%~1" >> "%~dpn1.m3u"DEL "%~1"start "" "%~dpn1.m3u"

The text file generated by ExClip looks like this (for example):

--- Code: Text ---E:\music\song1.mp3E:\music\song2.m4aE:\music\song3.oggE:\music\song4.mp3
After the cmd file has run there will be a M3U file that looks like this:

--- Code: Text ---#EXTM3UE:\music\song1.mp3E:\music\song2.m4aE:\music\song3.oggE:\music\song4.mp3
The cmd file is just an example, you don't have to turn it into an M3U playlist (but it is the simplest) - you could call a program directly to act upon the files selected.

Archive contains executable, source, and the example cmd file.

ExClip.au3 source:

--- Code: AutoIt ---#Region ;**** Directives created by AutoIt3Wrapper_GUI ****#AutoIt3Wrapper_UseUpx=n#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****; http://www.autoitscript.com/forum/topic/89833-windows-explorer-current-folder/page__st__40#entry973904#include <Array.au3>#include <File.au3>#include <Date.au3> Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ComErrFunc") If $CmdLine[0] = 1 Then        $sCmd = $CmdLine[1]        _ExClip()Else        ExitEndIf  Func _ExClip()        $hExplr = WinActive("[REGEXPCLASS:(Explore|Cabinet)WClass]")        If $hExplr <> '' Then                $aSelection = _ExplorerWinGetSelectedItems($hExplr)                If $aSelection[0] > 0 Then                        $fName = @TempDir & "\" & _Date_Time_GetTickCount() & ".txt"                        _ArrayDelete($aSelection, 1);                       _ArrayDisplay($aSelection)                        _FileWriteFromArray($fName, $aSelection, 1)                        ShellExecute($sCmd, $fName)                EndIf        EndIfEndFunc   ;==>_ExClip   ; ========================================================================================================================== ; Func _ObjectSHFolderViewFromWin($hWnd);; Returns an 'ShellFolderView' Object for the given Window handle;; Author: Ascend4nt, based on code by KaFu, klaus.s; ========================================================================================================================== Func _ObjectSHFolderViewFromWin($hWnd)        If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0)        Local $oShell, $oShellWindows, $oIEObject, $oSHFolderView         ; Shell Object        $oShell = ObjCreate("Shell.Application")        If Not IsObj($oShell) Then Return SetError(2, 0, 0)         ;   Get a 'ShellWindows Collection' object        $oShellWindows = $oShell.Windows()        If Not IsObj($oShellWindows) Then Return SetError(3, 0, 0)         ;   Iterate through the collection - each of type 'InternetExplorer' Object         For $oIEObject In $oShellWindows                If $oIEObject.HWND = $hWnd Then                        ; InternetExplorer->Document = ShellFolderView object                        $oSHFolderView = $oIEObject.Document                        If IsObj($oSHFolderView) Then Return $oSHFolderView                        Return SetError(4, 0, 0)                EndIf        Next         Return SetError(-1, 0, 0)EndFunc   ;==>_ObjectSHFolderViewFromWin ; ==========================================================================================================================; Func _ExplorerWinGetSelectedItems($hWnd);;; Author: klaus.s, KaFu, Ascend4nt (consolidation & cleanup, Path name simplification); ========================================================================================================================== Func _ExplorerWinGetSelectedItems($hWnd)        If Not IsHWnd($hWnd) Then Return SetError(1, 0, '')        Local $oSHFolderView        Local $iSelectedItems, $iCounter = 2, $aSelectedItems[2] = [0, ""]         $oSHFolderView = _ObjectSHFolderViewFromWin($hWnd)        If @error Then Return SetError(@error, 0, '')         ;   SelectedItems = FolderItems Collection object->Count        $iSelectedItems = $oSHFolderView.SelectedItems.Count         Dim $aSelectedItems[$iSelectedItems + 2] ; 2 extra -> 1 for count [0], 1 for Folder Path [1]         $aSelectedItems[0] = $iSelectedItems        ;   ShellFolderView->Folder->Self as 'FolderItem'->Path        $aSelectedItems[1] = $oSHFolderView.Folder.Self.Path         ;   ShellFolderView->SelectedItems = FolderItems Collection object        $oSelectedFolderItems = $oSHFolderView.SelectedItems         #cs                ; For ALL items in an Explorer Window (not just the selected ones):                $oSelectedFolderItems = $oSHFolderView.Folder.Items                ReDim $aSelectedItems[$oSelectedFolderItems.Count+2]        #ce         For $oFolderItem In $oSelectedFolderItems                $aSelectedItems[$iCounter] = $oFolderItem.Path                $iCounter += 1        Next         Return SetExtended($iCounter - 2, $aSelectedItems)EndFunc   ;==>_ExplorerWinGetSelectedItems Func _ComErrFunc($oError)        ConsoleWrite("COM Error occurred:" & @CRLF & _                        "Number: " & @TAB & $oError.number & @CRLF & _                        "Windescription:" & @TAB & $oError.windescription & @CRLF & _                        "Description is: " & @TAB & $oError.description & @CRLF & _                        "Source is: " & @TAB & $oError.source & @CRLF & _                        "Helpfile is: " & @TAB & $oError.helpfile & @CRLF & _                        "Helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _                        "Lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _                        "Scriptline is: " & @TAB & $oError.scriptline & @CRLF & _                        "Retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)EndFunc   ;==>_ComErrFunc

p3lb0x:
"IDEA" : Key to Replace Context Menu R-Clik Program Start On Selected

Something like this you were thinking off? I set the hotkey to ALT + L in this case and it is hardcoded to open VLC, but with a bit more work it could be configurable with an ini file or something.

Currently I am just running the application with the file names sent in as arguments, so any media player you'd want to run this with needs to be able to do that (or be able to do it with some argument flags)

Navigation

[0] Message Index

[*] Previous page

Go to full version