#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Projet3.ico #AutoIt3Wrapper_Outfile=SlidingToolbar.exe #AutoIt3Wrapper_Outfile_x64=SlidingToolbar.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Res_Comment=Sliding Toolbar on the Left side of the Screen for an easy acces to your Folders, Softwares, etc... #AutoIt3Wrapper_Res_Description=Sliding Toolbar #AutoIt3Wrapper_Res_Fileversion=1.0.0.9 #AutoIt3Wrapper_Res_ProductVersion=1.0.0.9 #AutoIt3Wrapper_Res_LegalCopyright=wakillon 2025 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Res_Field=Credits|Based on a Hest script (https://www.autoitscript.com/forum/topic/96770-another-toolbar) and modified by wakillon #AutoIt3Wrapper_Res_Field=Compiled with | AutoIt Version 3.3.18.0 #AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% #AutoIt3Wrapper_Res_Field=Compile date|%longdate% %time% #AutoIt3Wrapper_Run_After=del "%scriptfile%_stripped.au3" #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region ;************ Includes ************ #include #include #include #include #include #include #include #include #include #include #EndRegion ;************ Includes ************ Opt('MustDeclareVars', 1) Opt('TrayIconHide', 0) Opt('TrayOnEventMode', 1) Opt('TrayMenuMode', 1) #Region ------ Global Variables ------------------------------ Global $iButtonsCount = 20, $iButtonsRow = 10, $iButtonWidth = 40, $iButtonHeight = 40, $iButtonsPerRow = 2 Global $iButtonDistx = 8, $iButtonDisty = 8, $iGuiPartVisible = 5, $iShowWindow = 0 Global $aIdCtrlButton[$iButtonsCount + 1] Global $iGuiWidth = ($iButtonsPerRow * $iButtonWidth) + ($iButtonsPerRow * $iButtonDistx) + $iButtonDistx Global $iGuiHeight = ($iButtonsRow * $iButtonHeight) + ($iButtonsRow * $iButtonDisty) + $iButtonDisty + $iGuiPartVisible + 20 Global $iGuiXPos, $iGuiYPos Global $idMsg, $iOver, $aCursorInfo, $sFile, $iXFontSize, $sPathWithoutArgs Global $hUser32Dll, $hKernel32Dll, $hShlwapiDll, $hShell32Dll, $iAdlibTime = 500 Global $sGuiTitle = 'SlidingToolbar', $bBeepEnable = True, $bNoTrans = True, $sName Global $aButtonMenu[$iButtonsCount + 1], $aMenuDelete[$iButtonsCount + 1], $aMenuChangeIcon[$iButtonsCount + 1], $aMenuChangeDisplayName[$iButtonsCount + 1] Global $hGui, $idLabelInfo, $idLabelExit, $sTempDir = @TempDir & '\SlidingToolBar', $sIniFilePath = $sTempDir & '\SlidingToolBar.ini' Global $sRegTitleKey = 'SlidingToolbar', $hTimerInit = TimerInit(), $aLast[2] = [@SystemDir & '\shell32.dll', 3] Global $idTrayItemStartWithWindows, $idTrayItemExit, $idTrayItemMute, $idTrayItemNoTrans Global $sRegKeyStartWithWindows = 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run' Global $sRegKeySettings = 'HKEY_CURRENT_USER\Software\SlidingToolbar\Settings' #EndRegion ------ Global Variables ------------------------------ #Region ------ Init ------------------------------ If _Singleton('Sl1d1ngT00lbar', 0) = 0 Then Exit If Not FileExists($sIniFilePath) Then _IniFileCreate() $hUser32Dll = DllOpen('user32.dll') $hKernel32Dll = DllOpen('kernel32.dll') $hShlwapiDll = DllOpen('shlwapi.dll') $hShell32Dll = DllOpen('shell32.dll') _Gui() AdlibRegister('_IsCursorOverGui', $iAdlibTime) AdlibRegister('_RecentDocsClean', $iAdlibTime * 100) ; 50 sec OnAutoItExitRegister('_Exit') #EndRegion ------ Init ------------------------------ #Region ------ Main Loop ------------------------------ While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idLabelExit, $idLabelInfo GUISetState(@SW_HIDE, $hGui) AdlibUnRegister('_IsCursorOverGui') AdlibUnRegister('_RecentDocsClean') GUIDelete($hGui) Exit Case $GUI_EVENT_DROPPED AdlibUnRegister('_IsCursorOverGui') _ItemAdd() AdlibRegister('_IsCursorOverGui', $iAdlibTime) Case $idTrayItemExit EndSwitch For $i = 1 To $iButtonsCount Switch $idMsg Case $aIdCtrlButton[$i] $sFile = IniRead($sIniFilePath, 'Launch', $i, 'Empty') $sPathWithoutArgs = _PathWithoutArgs($sFile) If FileExists($sFile) Or FileExists($sPathWithoutArgs) Then If StringInStr($sFile, '{') Then ShellExecute('shell:::' & StringReplace(StringMid($sFile, StringInStr($sFile, '{')), '"', '')) Else ShellExecute($sFile) EndIf Else MsgBox(48, 'Error', 'File/Folder could not be found', 3) EndIf Case $aMenuDelete[$i] _ItemDelete($i) Case $aMenuChangeIcon[$i] _ItemChangeIcon($i) Case $aMenuChangeDisplayName[$i] _ItemChangeDisplayName($i) EndSwitch Next $iOver = 0 If TimerDiff($hTimerInit) > 500 Then $aCursorInfo = GUIGetCursorInfo($hGui) If Not @error Then For $i = 1 To $iButtonsCount If $aCursorInfo[4] = $aIdCtrlButton[$i] Then $sFile = IniRead($sIniFilePath, 'Launch', $i, 'Empty') $sName = IniRead($sIniFilePath, 'Name', $i, '') If $sName Then If GUICtrlRead($idLabelInfo) <> $sName Then GUICtrlSetData($idLabelInfo, $sName) Else If GUICtrlRead($idLabelInfo) <> _FileGetName($sFile) Then GUICtrlSetData($idLabelInfo, _FileGetName($sFile)) EndIf $iOver = 1 ExitLoop EndIf Next EndIf If $iOver = 0 And GUICtrlRead($idLabelInfo) <> $sGuiTitle Then GUICtrlSetData($idLabelInfo, $sGuiTitle) $hTimerInit = TimerInit() EndIf Sleep(30) WEnd #EndRegion ------ Main Loop ------------------------------ Func _DesktopIniPathClean($sPath) Return _ExpandEnvironmentStringsW(StringReplace($sPath, '@', '')) EndFunc ;==>_DesktopIniPathClean Func _DesktopIniRead($sFilepath) Local $a[2], $aDesktopIniRead = IniReadSection($sFilepath, '.ShellClassInfo') For $i = 0 To UBound($aDesktopIniRead) - 1 If $aDesktopIniRead[$i][0] = 'IconResource' Then If StringInStr($aDesktopIniRead[$i][1], ',') Then $a = StringSplit(_DesktopIniPathClean($aDesktopIniRead[$i][1]), ',', 1 + 2) If FileExists($a[0]) Then ExitLoop EndIf EndIf Next If Not FileExists($a[0]) Then For $i = 0 To UBound($aDesktopIniRead) - 1 If $aDesktopIniRead[$i][0] = 'IconFile' Then If StringInStr($aDesktopIniRead[$i][1], ',') Then $a = StringSplit(_DesktopIniPathClean($aDesktopIniRead[$i][1]), ',', 1 + 2) Else $a[0] = _DesktopIniPathClean($aDesktopIniRead[$i][1]) $a[1] = $aDesktopIniRead[$i + 1][1] EndIf If FileExists($a[0]) Then ExitLoop EndIf Next If Not FileExists($a[0]) Then For $i = 0 To UBound($aDesktopIniRead) - 1 If $aDesktopIniRead[$i][0] = 'LocalizedResourceName' Then If StringInStr($aDesktopIniRead[$i][1], ',') Then $a = StringSplit(_DesktopIniPathClean($aDesktopIniRead[$i][1]), ',', 1 + 2) If FileExists($a[0]) Then ExitLoop EndIf EndIf Next EndIf EndIf If Not FileExists($a[0]) Then Return Return $a EndFunc ;==>_DesktopIniRead Func _Exit() GUISetState(@SW_HIDE, $hGui) AdlibUnRegister('_IsCursorOverGui') DllClose($hShell32Dll) DllClose($hShlwapiDll) DllClose($hKernel32Dll) DllClose($hUser32Dll) GUIDelete($hGui) Exit EndFunc ;==>_Exit Func _ExpandEnvironmentStringsW($sString) Local $aRet = DllCall($hKernel32Dll, 'dword', 'ExpandEnvironmentStringsW', 'wstr', $sString, 'wstr', '', 'dword', 4096) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, '') Return $aRet[2] EndFunc ;==>_ExpandEnvironmentStringsW Func _FileGetName($sPath) Return StringTrimRight(_PathFindFileNameW($sPath), StringLen(_PathFindExtensionW($sPath))) EndFunc ;==>_FileGetName Func _Gui() $iGuiYPos = (@DesktopHeight / 2) - ($iGuiHeight / 2) $iGuiXPos = -($iGuiWidth - $iGuiPartVisible) $hGui = GUICreate($sGuiTitle, $iGuiWidth, $iGuiHeight, $iGuiXPos - 8, $iGuiYPos, BitOR($WS_POPUP, $WS_GROUP, $WS_THICKFRAME, $WS_BORDER, $WS_OVERLAPPED), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES, $WS_EX_LAYERED)) GUISetBkColor(0xABCDEF) GUISetCursor(0, 0, $hGui) GUICtrlCreateLabel('', 0, 0, $iGuiWidth, $iGuiHeight) GUICtrlSetCursor(-1, 0) GUICtrlSetState(-1, $GUI_DISABLE) Local $Row = 1, $j = 1, $iError, $sIniRead Local $Buttondist = $iButtonWidth + $iButtonDistx Local $NextButtonx = $iButtonDistx, $NextButtony = $iButtonDisty For $i = 1 To $iButtonsCount Step 1 $aIdCtrlButton[$i] = GUICtrlCreateButton('', $NextButtonx, $NextButtony, $iButtonWidth, $iButtonHeight, $BS_ICON) GUICtrlSetState($aIdCtrlButton[$i], $GUI_DROPACCEPTED) GUICtrlSetCursor(-1, 0) $sIniRead = IniRead($sIniFilePath, 'Launch', $i, 'Empty') ; Empty, The default value to return if the requested key is not found If FileExists($sIniRead) Or StringInStr($sIniRead, '.msc') Or StringInStr($sIniRead, '::{') Then _GuiButtonsAddIcon($sIniRead, $i) ElseIf $sIniRead <> 'Empty' Then ; delete item not existing _ItemDelete($i) $iError += 1 EndIf $aButtonMenu[$i] = GUICtrlCreateContextMenu($aIdCtrlButton[$i]) GUICtrlCreateMenuItem('SlidingToolbar', $aButtonMenu[$i], 0) GUICtrlSetColor(-1, 0xFF0000) GUICtrlCreateMenuItem('', $aButtonMenu[$i], 1) $aMenuDelete[$i] = GUICtrlCreateMenuItem('Delete Item', $aButtonMenu[$i], 2) $aMenuChangeIcon[$i] = GUICtrlCreateMenuItem('Change Icon', $aButtonMenu[$i], 3) $aMenuChangeDisplayName[$i] = GUICtrlCreateMenuItem('Change Display Name', $aButtonMenu[$i], 4) $NextButtonx = $NextButtonx + $Buttondist $j += 1 If $j > $iButtonsPerRow Then $NextButtonx = $iButtonDistx $NextButtony = (($iButtonHeight + $iButtonDisty) * $Row) + $iButtonDisty $Row += 1 $j = 1 EndIf Next If $iError > 0 Then MsgBox(48, 'Error', $iError & ' Items could not be found And has been removed from the Toolbar', 3) For $i = 1 To 9 GUICtrlCreateIcon('shell32.dll', -138, $iGuiWidth - 12, $i * 48 - 3, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) Next $idLabelInfo = GUICtrlCreateLabel($sGuiTitle, ($iGuiWidth / 2) - $iGuiWidth / 2, $iGuiHeight - 20, $iGuiWidth - 10, 24, $WS_GROUP + $SS_CENTER) GUICtrlSetFont(-1, 7, 900, 0, 'Consolas') Local $Color = 0x545555 GUICtrlSetBkColor(-1, $Color) GUICtrlSetColor(-1, 0xFFFFFF) $iXFontSize = 10 GUICtrlSetCursor(-1, 0) GUICtrlSetTip(-1, 'Click here for Exit') $idLabelExit = GUICtrlCreateLabel('X', $iGuiWidth - 10, $iGuiHeight - 20, $iXFontSize + 4, $iXFontSize + 10, $SS_LEFT) GUICtrlSetFont(-1, $iXFontSize, 900, 0, 'Consolas') GUICtrlSetCursor(-1, 0) GUICtrlSetBkColor(-1, $Color) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetTip(-1, 'Click here for Exit') GUISetState() _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF, 255) ; Tray Menu TrayCreateItem($sGuiTitle) TrayCreateItem('') $idTrayItemNoTrans = TrayCreateItem('No Transparency') TrayItemSetOnEvent(-1, '_NoTrans') TrayCreateItem('') $idTrayItemMute = TrayCreateItem('Mute') TrayItemSetOnEvent(-1, '_Mute') TrayCreateItem('') $idTrayItemStartWithWindows = TrayCreateItem('Start With Windows') TrayItemSetOnEvent(-1, '_StartWithWindows') If RegRead($sRegKeySettings, 'StartWithWindows') = 0 Or RegRead($sRegKeySettings, 'StartWithWindows') = '' Then ; when key doesn't exists yet. RegWrite($sRegKeySettings, 'StartWithWindows', 'REG_SZ', 0) TrayItemSetState($idTrayItemStartWithWindows, $TRAY_UNCHECKED) Else RegWrite($sRegKeySettings, "StartWithWindows", "REG_SZ", 1) TrayItemSetState($idTrayItemStartWithWindows, $TRAY_CHECKED) If RegRead($sRegKeyStartWithWindows, $sRegTitleKey) <> '' Then RegDelete($sRegKeyStartWithWindows & '\' & $sRegTitleKey) If @Compiled Then RegWrite($sRegKeyStartWithWindows, $sRegTitleKey, 'REG_SZ', '"' & @ScriptFullPath & '"') TrayItemSetState(-1, $TRAY_CHECKED) EndIf EndIf TrayCreateItem('') $idTrayItemExit = TrayCreateItem('Exit') TrayItemSetOnEvent(-1, '_Exit') If RegRead($sRegKeySettings, 'NoTrans') = 0 Or RegRead($sRegKeySettings, 'NoTrans') = '' Then $bNoTrans = False RegWrite($sRegKeySettings, 'NoTrans', 'REG_SZ', 0) TrayItemSetState($idTrayItemNoTrans, $TRAY_UNCHECKED) Else $bNoTrans = True RegWrite($sRegKeySettings, 'NoTrans', 'REG_SZ', 1) TrayItemSetState($idTrayItemNoTrans, $TRAY_CHECKED) _NoTrans() EndIf If RegRead($sRegKeySettings, 'Mute') = 0 Or RegRead($sRegKeySettings, 'Mute') = '' Then $bBeepEnable = True RegWrite($sRegKeySettings, 'Mute', 'REG_SZ', 0) TrayItemSetState($idTrayItemMute, $TRAY_UNCHECKED) Else $bBeepEnable = False RegWrite($sRegKeySettings, 'Mute', 'REG_SZ', 1) TrayItemSetState($idTrayItemMute, $TRAY_CHECKED) EndIf TraySetState($TRAY_ICONSTATE_FLASH) EndFunc ;==>_Gui Func _GuiButtonsAddIcon($sFile, $id) Local $sExtension = _PathFindExtensionW($sFile), $sIconreg, $aIconSplit, $sExtensionreg Local $sDefIcon, $sDefBrowser, $aShortcut, $aDesktopIni, $sLocalIcon Switch $sExtension Case '.lnk' $aShortcut = FileGetShortcut($sFile) If Not @error Then If IsArray($aShortcut) Then If Not FileExists($aShortcut[0]) Then MsgBox(48, 'Error', 'ShortCut ' & $sFile & @CRLF & @CRLF & ' is dead or not supported', 3) Else _GuiButtonsAddIcon($aShortcut[0], $id) IniWrite($sIniFilePath, 'Launch', $id, $aShortcut[0]) EndIf EndIf Else MsgBox(48, 'Error', 'ShortCut ' & $sFile & ' cant be accessed', 3) EndIf Return Case '.exe', '.msc' If StringInStr($sFile, 'services.msc') Then GUICtrlSetImage($aIdCtrlButton[$id], _IconSaveFromDll(@SystemDir & '\dsuiext.dll', 35, $sTempDir & '\Icons'), -1, 1) Else GUICtrlSetImage($aIdCtrlButton[$id], $sFile, 0, 1) EndIf Case '.url', '.http', '.https', '.html', '.htm' $sDefBrowser = _WinAPI_AssocQueryString('https', $ASSOCSTR_EXECUTABLE, $ASSOCF_VERIFY) If FileExists($sDefBrowser) Then GUICtrlSetImage($aIdCtrlButton[$id], $sDefBrowser, 0, 1) ; Text files Case '.txt', '.chm', '.odt', 'odm', 'ott', '.doc', '.docx', '.pdf', '.rtf', '.wpd', '.wps', '.gdoc', '.eml', '.bat', '.cmd', '.ini', '.nfo', '.diz', '.au3', '.vbs', '.ahk', '.reg', '.h', '.c', '.cc', '.cpp', _ '.asm', '.bas', '.pas', '.py', '.pb', '.pbi', '.bi', '.frm', '.dsp', '.js', '.lua', '.properties', '.xml', '.dev', '.f', '.inl', '.layout', '.lo', '.sh', '.ps1', _ '.milk', '.plo', '.hpp', '.json', '.php', '.yaml', '.swg', '.ts', '.xd' $sDefIcon = _IconSaveDefault($sFile, $sTempDir & '\Icons') If FileExists($sDefIcon) Then GUICtrlSetImage($aIdCtrlButton[$id], $sDefIcon, 0, 1) ; Picture files Case '.jpg', '.jpeg', '.bmp', '.png', '.tiff' ; $iIndex : 127 $iIndex : 128 $iIndex : 238 GUICtrlSetImage($aIdCtrlButton[$id], _IconSaveFromDll(@SystemDir & '\shell32.dll', 127, $sTempDir & '\Icons'), -1, 1) ; Movie files Case '.avi', '.xvid', '.divx', '.mpg', '.mpeg', '.mp4', '.mkv', '.flv', '.mov', '.wmv', '.rm', '.3gp' ; $iIndex : 115, 129 $sExtensionreg = RegRead('HKEY_CLASSES_ROOT\' & $sExtension, '') $sIconreg = StringReplace(RegRead('HKEY_CLASSES_ROOT\' & $sExtensionreg & '\DefaultIcon\', ''), '"', '') $aIconSplit = StringSplit($sIconreg, ',') If Not @error Then GUICtrlSetImage($aIdCtrlButton[$id], $aIconSplit[1], Abs($aIconSplit[2]), 1) ; Music files Case '.m3u', '.m3u8', '.mp3', '.ogg', '.flac', '.midi', '.gsf', '.minigsf', '.m3up', '.sng', '.wav', '.wma', '.mod', '.xm', '.aac', '.snd' ; Music files ; $iIndex : 225 $iIndex : 237 $sExtensionreg = RegRead('HKEY_CLASSES_ROOT\' & $sExtension, '') $sIconreg = StringReplace(RegRead('HKEY_CLASSES_ROOT\' & $sExtensionreg & '\DefaultIcon\', ''), '"', '') $aIconSplit = StringSplit($sIconreg, ',') If Not @error Then GUICtrlSetImage($aIdCtrlButton[$id], $aIconSplit[1], Abs($aIconSplit[2]), 1) Case Else If _WinAPI_PathIsDirectory($sFile) Or StringInStr($sFile, '{') Then ; directory and special Folder $sLocalIcon = IniRead($sIniFilePath, 'Icon', $id, '') If $sLocalIcon Then ; if icon set in SlidingToolBar.ini file Local $a = StringSplit($sLocalIcon, ',', 1 + 2) GUICtrlSetImage($aIdCtrlButton[$id], _IconSaveFromDll($a[0], $a[1], $sTempDir & '\Icons'), -1, 1) Else ; if icon set in desktop.ini file $aDesktopIni = _DesktopIniRead($sFile & '\desktop.ini') If IsArray($aDesktopIni) Then If UBound($aDesktopIni) < 2 Then GUICtrlSetImage($aIdCtrlButton[$id], $aDesktopIni[0], 0, 0) Else GUICtrlSetImage($aIdCtrlButton[$id], _IconSaveFromDll($aDesktopIni[0], $aDesktopIni[1], $sTempDir & '\Icons'), -1, 0) EndIf Else ; set default icon $sIconreg = StringReplace(RegRead('HKEY_CLASSES_ROOT\Directory\DefaultIcon\', ''), '"', '') $aIconSplit = StringSplit($sIconreg, ',') If Not @error Then $aIconSplit[2] = Abs($aIconSplit[2]) GUICtrlSetImage($aIdCtrlButton[$id], $aIconSplit[1], 4) EndIf EndIf EndIf Else MsgBox(48, 'Error', 'Sorry, Filetype ' & $sExtension & ' is not supported', 3) _ItemDelete($id) EndIf EndSwitch EndFunc ;==>_GuiButtonsAddIcon Func _GuiSlide() AdlibUnRegister('_IsCursorOverGui') Local $iSpeed = 5 If $iShowWindow = 0 Then WinSetOnTop($hGui, '', 1) If $bBeepEnable Then Beep(3000, 30) WinMove($hGui, '', -10, $iGuiYPos, Default, Default, $iSpeed) $iShowWindow = 1 WinSetOnTop($hGui, '', 0) Else If $bBeepEnable Then Beep(1200, 30) WinMove($hGui, '', $iGuiXPos - 8, $iGuiYPos, Default, Default, $iSpeed) $iShowWindow = 0 EndIf AdlibRegister('_IsCursorOverGui') EndFunc ;==>_GuiSlide Func _IconSaveDefault($sPath, $sSaveDir = @TempDir) If Not FileExists($sPath) Then Return SetError(1) If Not FileExists($sSaveDir) Then DirCreate($sSaveDir) Local $sIconPath = $sSaveDir & '\' & StringTrimLeft(_PathFindExtensionW($sPath), 1) & '.ico' If FileExists($sIconPath) Then Return $sIconPath Local $tSHFILEINFOW = DllStructCreate('handle Icon;int IconIndex;dword Attributes;wchar DisplayName[260];wchar TypeName[80]') DllCall($hShell32Dll, 'dword_ptr', 'SHGetFileInfoW', 'wstr', $sPath, 'dword', 0, 'ptr', DllStructGetPtr($tSHFILEINFOW), 'dword', DllStructGetSize($tSHFILEINFOW), 'dword', BitOR($SHGFI_ICON, $SHGFI_SYSICONINDEX, $SHGFI_USEFILEATTRIBUTES, $SHGFI_LARGEICON)) If @error Then Return SetError(2) Local $hIconNew = DllStructGetData($tSHFILEINFOW, 'Icon') Local $hIcon = _WinAPI_Create32BitHICON($hIconNew, False) If @error Then Return SetError(3) _WinAPI_SaveHICONToFile($sIconPath, $hIcon) If @error Then Return SetError(4) If $hIconNew Then _WinAPI_DestroyIcon($hIconNew) If $hIcon Then _WinAPI_DestroyIcon($hIcon) $tSHFILEINFOW = 0 Return $sIconPath EndFunc ;==>_IconSaveDefault Func _IconSaveFromDll($sPath, $iIndex, $sSaveDir = @TempDir, $iIconSize = 32) If Not FileExists($sPath) Then Return SetError(1) If Not FileExists($sSaveDir) Then DirCreate($sSaveDir) Local $sIconName = _FileGetName($sPath) Local $sIconPath = $sSaveDir & '\' & $sIconName & StringFormat('%04i', $iIndex) & '.ico' If FileExists($sIconPath) Then Return $sIconPath Local $iTotal = _WinAPI_ExtractIconEx($sPath, -1, 0, 0, 0) If Not @error And $iIndex > $iTotal Then Return SetError(2) Local $hIco = _SHExtractIconsW($sPath, $iIndex, $iIconSize, $iIconSize) If @error Then Return SetError(3) Local $hIcon = _WinAPI_Create32BitHICON($hIco, 1) If @error Then Return SetError(4) _WinAPI_SaveHICONToFile($sIconPath, $hIcon) If @error Then Return SetError(5) If $hIco Then _WinAPI_DestroyIcon($hIco) If $hIcon Then _WinAPI_DestroyIcon($hIcon) Return $sIconPath EndFunc ;==>_IconSaveFromDll Func _IniFileCreate() If Not FileExists($sTempDir) Then DirCreate($sTempDir) IniWrite($sIniFilePath, 'Launch', 1, @SystemDir & '\notepad.exe') IniWrite($sIniFilePath, 'Launch', 2, @SystemDir & '\calc.exe') IniWrite($sIniFilePath, 'Launch', 15, @SystemDir & '\services.msc') IniWrite($sIniFilePath, 'Launch', 16, @SystemDir & '\Taskmgr.exe') IniWrite($sIniFilePath, 'Launch', 17, @WindowsDir & '\explorer.exe "::{21EC2020-3AEA-1069-A2DD-08002b30309d}"') ; Control Panel in Icons view IniWrite($sIniFilePath, 'Launch', 18, @WindowsDir & '\explorer.exe "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"') ; This PC IniWrite($sIniFilePath, 'Launch', 19, @WindowsDir & '\explorer.exe "::{D34A6CA6-62C2-4C34-8A7C-14709C1AD938}"') ; Common Places FS Folder IniWrite($sIniFilePath, 'Launch', 20, @AppDataDir & '\Microsoft\Windows\Recent') ; Recent files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IniWrite($sIniFilePath, 'Icon', 1, @SystemDir & '\notepad.exe,0') IniWrite($sIniFilePath, 'Icon', 2, @SystemDir & '\calc.exe,0') IniWrite($sIniFilePath, 'Icon', 15, @SystemDir & '\dsuiext.dll, 35') IniWrite($sIniFilePath, 'Icon', 16, @SystemDir & '\Taskmgr.exe, 0') IniWrite($sIniFilePath, 'Icon', 17, @SystemDir & '\shell32.dll, 21') ; Control Panel in Icons view IniWrite($sIniFilePath, 'Icon', 18, @SystemDir & '\shell32.dll, 15') ; This PC IniWrite($sIniFilePath, 'Icon', 19, @SystemDir & '\shell32.dll, 316') ; Common Places FS Folder IniWrite($sIniFilePath, 'Icon', 20, @SystemDir & '\ieframe.dll, 43') ; Recent files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IniWrite($sIniFilePath, 'Name', 1, 'Notepad') IniWrite($sIniFilePath, 'Name', 2, 'Calc') IniWrite($sIniFilePath, 'Name', 15, 'Services') IniWrite($sIniFilePath, 'Name', 16, 'Taskmgr') IniWrite($sIniFilePath, 'Name', 17, 'Control Panel') ; Control Panel in Names view IniWrite($sIniFilePath, 'Name', 18, 'This PC') ; This PC IniWrite($sIniFilePath, 'Name', 19, 'Common Folders') ; Common Places FS Folder IniWrite($sIniFilePath, 'Name', 20, 'Recent Files') ; Recent files EndFunc ;==>_IniFileCreate Func _IsCursorOverGui() Local $aCursorInfo = GUIGetCursorInfo($hGui) If Not @error Then If Abs($aCursorInfo[0]) < 4 Then Return If $iShowWindow = 0 And _WinGetAncestor(GUICtrlGetHandle($aCursorInfo[4])) = $hGui Then _GuiSlide() ElseIf $iShowWindow = 1 And _WinGetAncestor(GUICtrlGetHandle($aCursorInfo[4])) <> $hGui Then _GuiSlide() EndIf EndIf EndFunc ;==>_IsCursorOverGui Func _ItemAdd() Local $id For $i = 1 To UBound($aIdCtrlButton) - 1 If $aIdCtrlButton[$i] = @GUI_DropId Then $id = $i ExitLoop EndIf Next Local $sFile = @GUI_DragFile If _PathFindExtensionW($sFile) <> '.lnk' Then IniWrite($sIniFilePath, 'Launch', $id, $sFile) IniWrite($sIniFilePath, 'Name', $id, _FileGetName($sFile)) EndIf _GuiButtonsAddIcon($sFile, $id) EndFunc ;==>_ItemAdd Func _ItemChangeDisplayName($id) If IniRead($sIniFilePath, 'Name', $id, '') = '' Then MsgBox(262144 + 64, 'Info', 'Item is Empty...' & @CRLF & 'No Change was done', 3, $hGui) Return EndIf Local $hGuiName = GUICreate('Change Display Name', 300, 60) Local $idInputName = GUICtrlCreateInput('', 10, 10, 200, 20, -1, $WS_EX_CLIENTEDGE) Local $idButtonValid = GUICtrlCreateButton('Validate', 220, 10, 60, 20) GUISetState(@SW_SHOW, $hGuiName) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButtonValid ExitLoop EndSwitch Sleep(20) WEnd Local $sNewName = GUICtrlRead($idInputName) GUIDelete($hGuiName) If $sNewName Then IniDelete($sIniFilePath, 'Name', $id) IniWrite($sIniFilePath, 'Name', $id, $sNewName) GUICtrlSetData($idLabelInfo, $sNewName) Else MsgBox(262144 + 64, 'Info', 'No Change was done', 3) EndIf GUICtrlSetTip($aIdCtrlButton[$id], '') EndFunc ;==>_ItemChangeDisplayName Func _ItemChangeIcon($id) If IniRead($sIniFilePath, 'Name', $id, '') = '' Then MsgBox(262144 + 64, 'Info', 'Item is Empty...' & @CRLF & 'No Change was done', 3, $hGui) Return EndIf Local $aData = _WinAPI_PickIconDlg($aLast[0], $aLast[1]) If IsArray($aData) Then $aLast = $aData IniDelete($sIniFilePath, 'Icon', $id) IniWrite($sIniFilePath, 'Icon', $id, $aData[0] & ', ' & $aData[1]) GUICtrlSetImage($aIdCtrlButton[$id], $aData[0], -(1 + $aData[1])) Else MsgBox(262144 + 64, 'Info', 'No Change was done', 3) EndIf GUICtrlSetTip($aIdCtrlButton[$id], '') EndFunc ;==>_ItemChangeIcon Func _ItemDelete($id) IniDelete($sIniFilePath, 'Launch', $id) IniDelete($sIniFilePath, 'Icon', $id) IniDelete($sIniFilePath, 'Name', $id) GUICtrlSetImage($aIdCtrlButton[$id], 'Shell32.dll', 50) GUICtrlSetTip($aIdCtrlButton[$id], '') EndFunc ;==>_ItemDelete Func _Mute() $bBeepEnable = Not $bBeepEnable If _TrayItemIsChecked($idTrayItemMute) Then RegWrite($sRegKeySettings, 'Mute', 'REG_SZ', 1) Else RegWrite($sRegKeySettings, 'Mute', 'REG_SZ', 0) EndIf EndFunc ;==>_Mute Func _NoTrans() If _TrayItemIsChecked($idTrayItemNoTrans) Then $bNoTrans = 1 GUISetBkColor(0xFFFFFF, $hGui) RegWrite($sRegKeySettings, 'NoTrans', 'REG_SZ', 1) Else $bNoTrans = 0 GUISetBkColor(0xABCDEF, $hGui) RegWrite($sRegKeySettings, 'NoTrans', 'REG_SZ', 0) EndIf GUISetState() EndFunc ;==>_NoTrans Func _PathFindExtensionW($sFilepath) Local $aRet = DllCall($hShlwapiDll, 'wstr', 'PathFindExtensionW', 'wstr', $sFilepath) If @error Then Return SetError(@error, @extended, '') Return $aRet[0] EndFunc ;==>_PathFindExtensionW Func _PathFindFileNameW($sFilepath) Local $aRet = DllCall($hShlwapiDll, 'wstr', 'PathFindFileNameW', 'wstr', $sFilepath) If @error Then Return SetError(@error, @extended, $sFilepath) Return $aRet[0] EndFunc ;==>_PathFindFileNameW Func _PathWithoutArgs($sPath) $sPath = _WinAPI_PathRemoveArgs($sPath) If StringRight($sPath, 1) = ',' Then $sPath = StringTrimRight($sPath, 1) Return $sPath EndFunc ;==>_PathWithoutArgs Func _RecentDocsClean() Local Const $_MY_RECENT_DOCUMENTS = 0x8 Local $objShell = ObjCreate('Shell.Application') Local $objFolder = $objShell.Namespace($_MY_RECENT_DOCUMENTS) ;~ Local $objFolderItem = $objFolder.Self Local $colItems = $objFolder.Items, $a For $objItem In $colItems If StringRight($objItem.path, 4) = '.lnk' Then $a = FileGetShortcut($objItem.path) ; delete doublons For $i = 1 To 10 If StringInStr($objItem.Name, ' (' & $i & ')') Then FileDelete($objItem.path) Next ; delete dead links If Not FileExists($a[1] & '\' & $objItem.Name) Then FileDelete($objItem.path) EndIf Next EndFunc ;==>_RecentDocsClean Func _SHExtractIconsW($sIcon, $iIndex, $iWidth, $iHeight) Local $aRet = DllCall($hShell32Dll, 'int', 'SHExtractIconsW', 'wstr', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr*', 0, 'ptr*', 0, 'int', 1, 'int', 0) If @error Or Not $aRet[0] Or Not $aRet[5] Then Return SetError(@error, @extended, 0) Return $aRet[5] EndFunc ;==>_SHExtractIconsW Func _StartWithWindows() If @Compiled Then If TrayItemGetState(@TRAY_ID) = $TRAY_CHECKED + $TRAY_ENABLE Then RegWrite($sRegKeySettings, "StartWithWindows", "REG_SZ", 1) RegDelete($sRegKeyStartWithWindows & '\' & $sRegTitleKey) RegWrite($sRegKeyStartWithWindows, $sRegTitleKey, 'REG_SZ', '"' & @ScriptFullPath & '"') Else RegWrite($sRegKeySettings, "StartWithWindows", "REG_SZ", 0) RegDelete($sRegKeyStartWithWindows, $sRegTitleKey) EndIf Else TrayItemSetState(@TRAY_ID, $TRAY_UNCHECKED) MsgBox(262144 + 16, 'Error', 'Script must be Compiled !' & @CRLF, 5) EndIf EndFunc ;==>_StartWithWindows Func _TrayItemIsChecked($idCtrl) Return BitAND(TrayItemGetState($idCtrl), $TRAY_CHECKED) = $TRAY_CHECKED EndFunc ;==>_TrayItemIsChecked Func _WinGetAncestor($hWnd, $iFlags = $GA_PARENT) Local $aRet = DllCall($hUser32Dll, 'hwnd', 'GetAncestor', 'hwnd', $hWnd, 'uint', $iFlags) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinGetAncestor