Jump to content

[SOLVED] Function _ExplorerGetSelectedItems for items on Desktop


k4rl3on
 Share

Recommended Posts

Hi,

How can i make function _ExplorerGetSelectedItems get selecteds items on the Desktop?

Func _ExplorerGetSelectedItems($sCabinetWClass="[CLASS:CabinetWClass]")
    Local $Ret = ""
    Local $aIndexes, $sSelected, $sSelected_Path
    Local $hSearch, $sCurrentFile

    $sSelected_Path = ControlGetText($sCabinetWClass, "", "Edit1")
    ConsoleWrite($sSelected_Path&@CRLF)
    $aIndexes = StringSplit(ControlListView($sCabinetWClass, "", "SysListView321", "GetSelected", 1), "|")

    If $aIndexes[0] = 1 And ($aIndexes[1] == "" Or $aIndexes[1] = 0) Then Return SetError(1, 0, 0)

    For $i = 1 To $aIndexes[0]
        $sSelected = ControlListView($sCabinetWClass, "", "SysListView321", "GetText", $aIndexes[$i])
        $sCurrentFile = StringRegExpReplace($sSelected_Path, "\\+$", "") & "\" & $sSelected
        If Not FileExists($sCurrentFile) Then ;Search the extension for file...
            $hSearch = FileFindFirstFile($sCurrentFile & ".*")
            If $hSearch <> -1 Then
                $sSelected = FileFindNextFile($hSearch)
                FileClose($hSearch)
            EndIf
        EndIf
        ;Check if item is a directory
        If StringInStr(FileGetAttrib($sCurrentFile), "D") > 0 Then $sSelected = "*"&$sSelected
        $Ret = $Ret&$sSelected&Chr(10)
        Sleep(1)
    Next

    Return $Ret
EndFunc

 

Edited by k4rl3on
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

×
×
  • Create New...