An example of capturing and moving a shortcuts position:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiListView.au3>
#include <Array.au3>
Global $g_sSearch = "HP Support Assistant"
;~ Show all shortcut positions
Global $aShortcutIcon = _GetShortcutPos()
If Not @error Then _ArrayDisplay($aShortcutIcon)
;~ Example for searching and moving "HP Support Assistant" shortcut position
Global $aShortcutIcon = _GetShortcutPos($g_sSearch)
If Not @error Then _ArrayDisplay($aShortcutIcon)
;~ Move the "HP Support Assistant" shortcut to a new position
_SetShortcutPos($g_sSearch, 500, 100)
MsgBox(4096, "Check New Position", "Check " & $g_sSearch & " position has moved")
;~ Move the "HP Support Assistant" shortcut back to it's original position
_SetShortcutPos("HP Support Assistant", $aShortcutIcon[0][1], $aShortcutIcon[0][2])
Func _SetShortcutPos($_sShortcutName = "", $_iXPos = 0, $_iYPos = 0)
If $_sShortcutName = "" Then Return
;~ Desktop handle
Local $hDesktopListview = ControlGetHandle("[CLASS:Progman]", "", "[CLASS:SysListView32;INSTANCE:1]")
If @error Then Exit
Local $iShortcutPos = _GUICtrlListView_FindInText($hDesktopListview, $_sShortcutName)
_GUICtrlListView_SetItemPosition($hDesktopListview, $iShortcutPos, $_iXPos, $_iYPos)
EndFunc
Func _GetShortcutPos($_sShortcutName = "")
Local $sShortcutName
Local $bShortcut = $_sShortcutName = "" ? False : True
;~ Desktop handle
Local $hDesktopListview = ControlGetHandle("[CLASS:Progman]", "", "[CLASS:SysListView32;INSTANCE:1]")
If @error Then Return SetError(1, 0)
;~ Desktop shortcut count
Local $iShortcutCount = _GUICtrlListView_GetItemCount($hDesktopListview)
If $iShortcutCount > 0 Then
Local $aShortcutPos[$iShortcutCount][3]
For $i = 0 To UBound($aShortcutPos, 1) - 1
If $bShortcut Then
Dim $aShortcutPos[0][3]
$sShortcutName = _GUICtrlListView_GetItemText($hDesktopListview, $i)
If $sShortcutName = $_sShortcutName Then
Dim $aShortcutPos[1][3]
$aShortcutPos[0][0] = $sShortcutName
$aShortcutPos[0][1] = _GUICtrlListView_GetItemPositionX($hDesktopListview, $i)
$aShortcutPos[0][2] = _GUICtrlListView_GetItemPositionY($hDesktopListview, $i)
Return SetError((UBound($aShortcutPos) > 0 ? 0 : 1), 0, $aShortcutPos)
EndIf
Else
$aShortcutPos[$i][0] = _GUICtrlListView_GetItemText($hDesktopListview, $i)
$aShortcutPos[$i][1] = _GUICtrlListView_GetItemPositionX($hDesktopListview, $i)
$aShortcutPos[$i][2] = _GUICtrlListView_GetItemPositionY($hDesktopListview, $i)
EndIf
Next
Else
Return SetError(1, 0)
EndIf
Return SetError((UBound($aShortcutPos) > 0 ? 0 : 1), 0, $aShortcutPos)
EndFunc