如何获取当前选定文件的路径

Mar*_*ark 2 vbscript explorer selection livecode

VBScript 是否具有获取文件资源管理器中当前选定文件的路径的功能?如果有,它的功能是什么?我正在寻找类似的东西

Set fileObj = CreateObject("Scripting.FileSystemObject")
dim filepath 
filepath = fileObj.GetCurrentSelection() 'doesn´t exist
dim result
result = filepath 'communicate with LiveCode
Run Code Online (Sandbox Code Playgroud)

Kul*_*gin 6

我写了一个简单的例子。
请记住,可能有多个打开的 Windows 资源管理器窗口,这会将它们全部列出。

Function GetSelectedFiles() 'Returns paths as array of strings
    Dim FileList, Window, SelectedItem
    'avoid duplicates by storing paths in dictionary keys
    Set FileList = CreateObject("Scripting.Dictionary")

    With CreateObject("Shell.Application")
        For Each Window In .Windows
            'skip IE Windows
            If InStr(1, Window.FullName, "iexplore.exe", vbTextCompare) = 0 Then
                For Each SelectedItem In Window.Document.SelectedItems
                    FileList(SelectedItem.Path) = Null
                Next
            End If
        Next
    End With

    GetSelectedFiles = FileList.Keys 'array of paths
End Function

MsgBox  "Click OK after selecting the items",  _
        vbOKOnly Or vbInformation, "Select a few items"

Dim SelectedFiles
    SelectedFiles =  GetSelectedFiles

MsgBox  "You selected: " & vbNewLine  & vbNewLine & _
         Join(SelectedFiles, vbNewLine), vbOKOnly Or vbInformation, "Selected Items"

'loop through array
'Dim FileItem
'For Each FileItem In SelectedFiles
'   WScript.Echo FileItem
'Next
Run Code Online (Sandbox Code Playgroud)