Hello. Try to add all the references. I did this PoC without using extern UDF. Tested in Windows 10 (Spanish Lang)
#RequireAdmin ; Runs script as admin user
#include <AutoItConstants.au3>
Local $sTextDesktop="Escritorio" ;Use "Desktop" for English OS
Local $sTextDocuments="Documentos" ;Use "Documents" for English OS
;just for closing the windows if they exist
WinClose("[CLASS:CabinetWClass]", $sTextDesktop)
WinClose("[CLASS:CabinetWClass]",$sTextDocuments)
Local $sFile = @UserProfileDir & "\Desktop\testautoit.txt"
FileWrite($sFile,"My Demo File")
Local $filePath1 = @UserProfileDir & "\Desktop"
Local $filePath2 = @UserProfileDir & "\Documents"
Local $iPid1 = Run("explorer.exe " & $filePath1)
Local $hHandle1 = WinWait("[CLASS:CabinetWClass]", $sTextDesktop)
Local $iPid2 = Run("explorer.exe " & $filePath2)
Local $hHandle2 = WinWait("[CLASS:CabinetWClass]", $sTextDocuments)
ConsoleWrite("Handle1: " & $hHandle1 & @TAB & "Title: " & WinGetTitle($hHandle1) & @CRLF)
ConsoleWrite("Handle2: " & $hHandle2 & @TAB & "Title: " & WinGetTitle($hHandle2) & @CRLF)
Local $iWidth = @DesktopWidth / 2
Local $iHeight = @DesktopHeight - 50
ConsoleWrite($iWidth & @CRLF)
ConsoleWrite($iHeight & @CRLF)
WinMove($hHandle1, "", 1, 1, $iWidth, $iHeight) ;move window 1
WinMove($hHandle2, "", $iWidth, 1, $iWidth, $iHeight) ;move window 2
Sleep(500)
WinActivate($hHandle1, "")
Local $oShell = ObjCreate("Shell.Application")
Local $oDocument = 0
For $oWindow In $oShell.Windows
If $hHandle1 = $oWindow.HWND Then
ConsoleWrite(Hex($oWindow.HWND) & @CRLF)
$oDocument = $oWindow.Document
EndIf
Next
If IsObj($oDocument) Then
Local $bFound = False
Local $iCountIndex = 0
Local $oItems = $oDocument.Folder.Items
For $oItem In $oItems
If $iCountIndex = 0 Then $oDocument.SelectItem($oItem, 1) ;select First Item
If $oItem.Path = $sFile Then
ConsoleWrite($oItem.Path & @CRLF)
$bFound = True
ExitLoop
EndIf
$iCountIndex += 1
Next
If $bFound Then
ConsoleWrite($iCountIndex & @CRLF)
ControlSend($hHandle1, "", "", "{DOWN " & $iCountIndex & "}")
Local $aPixel = PixelSearch(0, 0, $iWidth, $iHeight, 0xCCE8FF)
If IsArray($aPixel) Then
;~ MouseMove($aPixel[0] + 10, $aPixel[1] + 10)
;~ MouseMove($iWidth + ($iWidth / 2), 10)
MouseClickDrag($MOUSE_CLICK_LEFT, $aPixel[0] + 10, $aPixel[1] + 10, $iWidth + ($iWidth / 2), 10)
EndIf
Else
MsgBox(0,"Information","File Not Found")
EndIf
EndIf
Exit
Saludos