#include <File.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GUIImageList.au3>
#include <WinAPIEx.au3>
$sPath = @DesktopDir
$j = 0
Break(0)
$aLnk = _FileListToArray($sPath, '*.lnk', 1)
If Not @error Then
Dim $aInfo[$j + 1][5]
For $i = 1 To $aLnk[0]
$aDetails = FileGetShortcut($sPath & '\' & $aLnk[$i])
If $aDetails[0] Then
$j += 1
ReDim $aInfo[$j + 1][5]
$aInfo[$j][0] = $aLnk[$i]
$aInfo[$j][1] = $aDetails[0]
$aInfo[$j][4] = $aDetails[1]
EndIf
Next
$aInfo[0][0] = $j
Else
Switch @error
Case 1
MsgBox(16, 'Error', 'Проблема с папкой ' & $sPath)
Case 4
MsgBox(16, 'Error', 'В папке ' & $sPath & 'нет ярлыков')
Case Else
MsgBox(16, 'Error', 'Error')
EndSwitch
Exit
EndIf
$aLnk = 0
$j = 0
$iR = 3 ;3 в ряд
If $aInfo[0][0] < $iR Then
$iR = $aInfo[0][0]
EndIf
$iK = Ceiling($aInfo[0][0] / $iR)
$iX = 0
$iY = 10
$hGui = GUICreate($sPath, 160 * $iR, 40 * $iK + 10)
For $i = 1 To $aInfo[0][0]
$aInfo[$i][3] = _GUIImageList_Create(16, 16, 5, 3, 6)
$hIcon = _WinAPI_ShellExtractAssociatedIcon($aInfo[$i][1], 1)
_GUIImageList_ReplaceIcon($aInfo[$i][3], -1, $hIcon)
$aInfo[$i][2] = _
GUICtrlCreateButton(StringRegExpReplace($aInfo[$i][0], '\A(.{1,20})?.*\.lnk', '\1'), _
10 + $iX * 160, $iY, 140, 30)
GUICtrlSetTip(-1, $aInfo[$i][1])
_GUICtrlButton_SetImageList($aInfo[$i][2], $aInfo[$i][3])
_WinAPI_DestroyIcon($hIcon)
$iX += 1
If Not Mod($i, $iR) Then
$iY += 40
$iX = 0
EndIf
Next
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case Else
For $i = 1 To $aInfo[0][0]
If $nMsg = $aInfo[$i][2] Then
If FileExists($aInfo[$i][1]) Then
If StringRight($aInfo[$i][1], 3) == 'exe' Then
Run($aInfo[$i][1], $aInfo[$i][4])
Else
ShellExecute($aInfo[$i][1])
EndIf
EndIf
EndIf
Next
EndSwitch
WEnd