$Path = @WorkingDir
;$Path = "F:\autoit\"
$hExplorer = WinGetHandle( "[REGEXPCLASS:^(Cabinet|Explore)WClass$]" )
$oShell = ObjCreate("Shell.Application" )
$oWindows = $oShell.Windows()
for $i = 0 to $oWindows.Count - 1
For $oWindow In $oShell.Windows()
if $oWindows.Item($i).HWND = $hExplorer then
$Replace = StringReplace($oWindows.Item($i).Locationurl, 'file:///', '')
$Replace = StringReplace($Replace, '/', '\')
$Replace = _URIDecode($Replace)
If $Replace = $Path Then
$oWindow = $oWindows.Item($i)
For $oItem In $oWindow.Document.SelectedItems()
MsgBox(0,"",$oItem.Path())
ConsoleWrite( $oItem.Path() & @CRLF )
Next
ExitLoop
EndIf
ExitLoop
EndIf
Next
Next
Func _URIDecode($sData)
Local $aData = StringSplit(StringReplace($sData,"+"," ",0,1),"%")
$sData = ""
For $i = 2 To $aData[0]
$aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2)
Next
Return $aData[1]
EndFunc
there are almost all checks, except for the case when two identical tabs are open in the same folder