I have this little script that essentially just moves desktop icons to my desired position, and then if they are moved, they "snap" back into place. I have it setup to run the .exe via login script.
I run into some issues if there are two instances of this script running at the same time. How can I make an exit parameter to detect if there are two instances of this script running, and close one of the two (the 'longer running' one would be best, but either would work).
Here is the code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Downloads\Logo-for-Pax-Machine-in-RGB.ico
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiListView.au3>
Local $arrShortcutNames[19] = ["Company Postings", "Redacted", "Redacted Database", "Redacted", "Mobile Redacted", "Redacted Private", "Redacted Records", "Redacted Log Files", "Mfgx-edge-v3", "Search by Redacted in Redacted", "Redacted Schedule", "Redacted UX", "Production Card", "Calculator", "Certification", "Redacted", "CRedacted Log Files", "Notepad", "Redacted"]
Local $arrXPos[19] = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 116, 116, 116, 116, 116, 116, 116, 116, 116]
Local $arrYPos[19] = [29, 105, 192, 278, 364, 449, 535, 621, 707, 793, 29, 105, 191, 277, 363, 535, 621, 707, 793]
While 1
For $i = 0 To UBound($arrShortcutNames) - 1
_SetShortcutPos($arrShortcutNames[$i], $arrXPos[$i], $arrYPos[$i])
sleep(100)
Next
Sleep(1000)
WEnd
Func _SetShortcutPos($Name = "", $X = 0, $Y = 0)
Local $Desktop = ControlGetHandle("[CLASS:Progman]", "", "[CLASS:SysListView32;INSTANCE:1]")
Local $Pos = _GUICtrlListView_FindInText($Desktop, $Name)
_GUICtrlListView_SetItemPosition($Desktop, $Pos, $X, $Y)
EndFunc
Thank you!