Jump to content

Filepaths from explorer?


 Share

Recommended Posts

Let's say I have got explorer open and I click two files using control. Now I wish to press some hotkey so that I get the paths of these two files. How is it to be done... I was thinking of trying it with GetCurrentSelection like this:

Dim $selectedFiles
WinWaitActive("[CLASS:ExploreWClass]", "", 10)
If WinActive("[CLASS:ExploreWClass]", "") Then
     $selectedFiles = ControlCommand("", "", "[CLASS:SysListView32]","GetCurrentSelection") 
     MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & 'selectedFiles' & @lf & @lf & 'Return:' & @lf & $selectedFiles);### Debug MSGBOX
 EndIf

but I wasn't getting anything, just 0. However this will only give me the file names (even if I got it to work). So, what should I do?

Thanks

Edited by ali79
Link to comment
Share on other sites

Hi,

Opt("WinTitleMatchMode", 4)
Global $ShellObject = ObjCreate("Shell.Application")
Dim $Pfade = ''

$WinList = WinList('[CLASS:ExploreWClass]')
For $i = 1 To $WinList[0][0]
    $Pfade &= _GetExplorerWinOpenedPath($WinList[$i][1], $ShellObject) & @CRLF
Next

MsgBox(0, "", "Pfade geöffneter Explorer-Fenster:" & @CRLF & @CRLF & $Pfade)


Func _GetExplorerWinOpenedPath($WinHandle, ByRef $ShellObject)
    If (Not IsObj($ShellObject)) And (Not ObjName($ShellObject) == 'IShellDispatch4') Then Return SetError(1, 0, '')

    For $Window In $ShellObject.Windows
        If ObjName($Window) == 'IWebBrowser2'  Then
            If $window.HWND = $WinHandle Then
                Return StringReplace(StringReplace(StringReplace($window.LocationURL, 'file:///', ''), '/', '\'), '%20', ' ')
            EndIf
        EndIf
    Next
    Return SetError(2, 0, '')
EndFunc

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hmmh, then I do not get what you need. Screenshot?

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...