首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Windows上实现两个文件资源管理器之间的拖放自动化

如何在Windows上实现两个文件资源管理器之间的拖放自动化
EN

Stack Overflow用户
提问于 2017-02-20 17:04:09
回答 1查看 435关注 0票数 0

我正在尝试在windows操作系统上的两个文件资源管理器之间自动拖放。我可以找到在线帮助来拖放浏览器的实现。但是没有将文件拖放到另一个文件资源管理器的帮助。

EN

回答 1

Stack Overflow用户

发布于 2017-02-20 21:00:02

为此,请使用Shell.Application对象。要从浏览器中获取选择,您可以使用以下函数:

代码语言:javascript
复制
;===============================================================================
; Function Name....: _ActiveExplorer_GetSelected
; Description......: Creates an array with
;                    - Count of selected files/folder
;                    - Path of active Explorer window and
;                    - the path/es of selected file/s /folder
; Requirement(s)...: Opened Explorer window
; Return Value(s)..: Array with data, $a[0] = Count, $a[1] = Folderpath, $a[2..] = File/Foldername
; .................: ATTENTION! Last index $a[0]+1 !!
; Author(s)........: BugFix ( AutoIt@bug-fix.info )
;===============================================================================
Func _ActiveExplorer_GetSelected()
    Local $oShell = ObjCreate("Shell.Application")
    Local $oExplorer, $sPath, $oFolderView, $iCount = 0, $sSelectedFiles = '', $n = 2
    Local $oShellWindows = $oShell.Windows
    For $i = 0 To $oShellWindows.Count -1
        $oExplorer = $oShellWindows($i)
        $sPath = StringReplace(StringReplace(StringTrimLeft($oExplorer.LocationURL, 8), '%20', ' '), '/', '\')
        If WinGetTitle('[ACTIVE]') = $sPath Then ExitLoop
    Next
    $oFolderView = $oExplorer.Document.SelectedItems()
    $iCount = $oFolderView.Count
    Local $aOut[$iCount +2]
    $aOut[0] = $iCount
    $aOut[1] = $sPath
    If $iCount = 0 Then
        Return ''
    Else
        For $oFolderItem In $oFolderView
            $aOut[$n] = $oFolderItem.Name
            $n += 1
        Next
        Return $aOut
    EndIf
EndFunc  ; ==>_ActiveExplorer_GetSelected
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42340275

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档