Leaderboard
Popular Content
Showing content with the highest reputation on 01/11/2024 in all areas
-
I had the same issue as @donnyh13 And after I delete all the *dyn*.tbl files the issue is gone. Thanks @Jos2 points
-
GUI assistant to pin shortcuts to the taskbar The first time you run the script TaskPin.au3 , it will create a executable shortcut in the script directory, with the name TaskPin.Pin Right-click on the shortcut and select 'pin to taskbar' For each pin you need an ini file, which you call as a parameter in TaskPin.au3, with a help of a shortcut The script automatically creates the shortcut, which we either pin to the taskbar, or assign to a button on another taskpin More info: TaskPin.au3 ; https://www.autoitscript.com/forum/topic/211276-taskpin/ ;---------------------------------------------------------------------------------------- ; Title...........: TaskPin.au3 ; Description.....: GUI assistant to pin shortcuts to the taskbar ; AutoIt Version..: 3.3.16.1 Author: ioa747 ;---------------------------------------------------------------------------------------- #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_ProductName=TaskPin.au3 #AutoIt3Wrapper_Res_Fileversion=0.0.0.9 #AutoIt3Wrapper_Res_Description=GUI assistant to pin shortcuts to the taskbar #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 6 -w 7 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #NoTrayIcon #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GuiListBox.au3> #include <File.au3> #include <Array.au3> #include <Misc.au3> #include <GUIConstants.au3> #include <WinAPI.au3> ; for _WinAPI_CreateWindowEx() #include <GDIPlus.au3> Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 1) ;0=don't expand, 1=do expand ; Add some usefull global Macro as variable Global $AutoIt3Dir = FileGetShortName(StringTrimRight(@AutoItExe, 12)) Global $AutoItExe = FileGetShortName(@AutoItExe) Global $ScriptName = StringTrimRight(@ScriptName, 4) Global $MyIni = ($CmdLine[0] ? $CmdLine[1] : FileGetShortName(StringTrimRight(@ScriptFullPath, 4) & ".ini")) ; Read the INI file for the value of 'Elements' Global $aElements = Elements_ReadIni() Global $MyLnk = StringTrimRight($MyIni, 4) & ".TaskPin.lnk" If Not FileExists($MyLnk) Then MakeExecuteShortcut($MyIni) EndIf If _IsPressed("11") Then ;11 CTRL key TaskPin_Editor() Else TaskPin_GUI() EndIf ;---------------------------------------------------------------------------------------- Func GoToExit() Exit EndFunc ;==>GoToExit ;---------------------------------------------------------------------------------------- Func TaskPin_Editor() Local $TaskPinEditor = FileGetShortName(@ScriptDir & "\TaskPinEditor.au3") Run(FileGetShortName(@AutoItExe) & " /AutoIt3ExecuteScript " & $TaskPinEditor & " " & $MyIni) EndFunc ;==>TaskPin_Editor ;---------------------------------------------------------------------------------------- Func TaskPin_GUI() Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled Opt("ExpandEnvStrings", 1) ;0=don't expand, 1=do expand Local $iDarkMode = IniRead($MyIni, "GUI_Settings", "GuiDarkMode", 0) Local $bDarkMode = ($iDarkMode = 1 ? True : False) Local $iGuiWidth = Int(IniRead($MyIni, "GUI_Settings", "GuiWidth", 200)) Local $iGuiMargin = Int(IniRead($MyIni, "GUI_Settings", "GuiMargin", 3)) Local $iBtnMargin = Int(IniRead($MyIni, "GUI_Settings", "BtnMargin", 2)) Local $iBtnIconSize = Int(IniRead($MyIni, "GUI_Settings", "BtnIconSize", 0)) Local $iBtnHeight = Int(IniRead($MyIni, "GUI_Settings", "BtnHeight", 28)) Local $sBtnTxtSpace = IniRead($MyIni, "GUI_Settings", "BtnTxtSpace", " ") Local $sBtnFont = IniRead($MyIni, "GUI_Settings", "BtnFont", "") If $iGuiMargin < 0 Then $iGuiMargin = 0 If $iGuiMargin > 50 Then $iGuiMargin = 50 If $iBtnMargin < 0 Then $iBtnMargin = 0 If $iBtnMargin > 10 Then $iBtnMargin = 10 If $iBtnIconSize < 0 Then $iBtnIconSize = 0 If $iBtnIconSize > 1 Then $iBtnIconSize = 1 Local $iStep = $iBtnHeight + $iBtnMargin Local $iBtnWidth = $iGuiWidth - ($iGuiMargin * 2) Local $aPos = MouseGetPos() Local $TaskPin_GUI = GUICreate("TaskPin GUI", $iGuiWidth, ($aElements[0][0] * $iStep) + ($iGuiMargin * 2), _ $aPos[0] - ($iGuiWidth / 2), @DesktopHeight - ($aElements[0][0] * $iStep) - ($iGuiMargin * 2), _ $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) ; $aPos[1] - ($aElements[0][0] * $iStep) + $iGuiMargin GUISetOnEvent($GUI_EVENT_CLOSE, "GoToExit") Local $aSplit, $sIcon For $i = 1 To $aElements[0][0] $aElements[$i][4] = GUICtrlCreateButton($sBtnTxtSpace & $aElements[$i][0], $iGuiMargin, ($i * $iStep) + $iGuiMargin - $iStep, _ $iBtnWidth, $iBtnHeight, BitOR($BS_LEFT, $BS_VCENTER, $BS_FLAT)) Execute('GUICtrlSetFont(-1, $sBtnFont$)') GUICtrlSetTip(-1, $aElements[$i][3]) GUICtrlSetOnEvent(-1, "Elements_Click") ; check for the icon $aSplit = StringSplit($aElements[$i][2], ", ", 1) $sIcon = $aSplit[1] If $aSplit[0] = 2 Then GUICtrlSetImage(-1, $sIcon, Int($aSplit[2]), $iBtnIconSize) Else If StringLen($aSplit[1]) = 0 Then $sIcon = $aElements[$i][1] GUICtrlSetImage(-1, $sIcon, 0, $iBtnIconSize) Else GUICtrlSetImage(-1, $sIcon, "", $iBtnIconSize) EndIf EndIf Next ;_ArrayDisplay($aElements, "$aElements") GUISetState(@SW_SHOW) DarkMode($TaskPin_GUI, $bDarkMode) ; Loop until mouse not over GUI ;****************************** While 1 If Not IsMouseOverWin($TaskPin_GUI, 50) Then ExitLoop Sleep(100) WEnd ;****************************** EndFunc ;==>TaskPin_GUI ;---------------------------------------------------------------------------------------- Func IsMouseOverWin($hWnd, $iOffSet = 0) Local $aMPos = MouseGetPos() Local $aWPos = WinGetPos($hWnd) If $aMPos[0] > $aWPos[0] - $iOffSet _ And $aMPos[1] > $aWPos[1] - $iOffSet _ And $aMPos[0] < $aWPos[0] + $aWPos[2] + $iOffSet _ And $aMPos[1] < $aWPos[1] + $aWPos[3] + $iOffSet Then Return True EndIf Return False EndFunc ;==>IsMouseOverWin ;---------------------------------------------------------------------------------------- Func Elements_Click() Local $aSplit For $i = 0 To $aElements[0][0] If $aElements[$i][4] = @GUI_CtrlId Then GUISetState(@SW_HIDE) $aSplit = StringSplit($aElements[$i][1], ", ", 1) ;ConsoleWrite("$aSplit[1]=" & $aSplit[1] & @CRLF) If $aSplit[0] = 2 Then ShellExecute($aSplit[1], $aSplit[2]) ;ConsoleWrite("$aSplit[2]=" & $aSplit[2] & @CRLF) Else ShellExecute($aSplit[1]) EndIf GoToExit() EndIf Next EndFunc ;==>Elements_Click ;---------------------------------------------------------------------------------------- Func Elements_ReadIni() Local $aArray[1][5] $aArray[0][0] = 0 ;index $aArray[0][1] = "Executable" $aArray[0][2] = "Icon" $aArray[0][3] = "ToolTip" $aArray[0][4] = "ID" ;Checks if TaskPin.ini not exists then make one. If $MyIni = FileGetShortName(StringTrimRight(@ScriptFullPath, 4) & ".ini") Then Local $iniFileExists = FileExists($MyIni) If Not $iniFileExists Then Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 0) ;0=don't expand, 1=do expand ;Open the file for writing (append to the end of a file) and store the handle to a variable. Local $hFileOpen = FileOpen($MyIni, $FO_APPEND + $FO_UNICODE) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred while writing the " & $MyIni) Exit EndIf ;Write Example data to the ini file Local $sTxt = "" $sTxt &= "[GUI_Settings]" & @CRLF $sTxt &= "AutoSort=False" & @CRLF $sTxt &= "GuiIcon=imageres.dll, 288" & @CRLF $sTxt &= "GuiDarkMode=1" & @CRLF $sTxt &= "GuiWidth=200" & @CRLF $sTxt &= "GuiMargin=3" & @CRLF $sTxt &= "BtnHeight=28" & @CRLF $sTxt &= "BtnMargin=1" & @CRLF $sTxt &= "BtnIconSize=1" & @CRLF $sTxt &= "BtnTxtSpace="" """ & @CRLF $sTxt &= "BtnFont=11, 400, 0, ""Segoe UI""" & @CRLF $sTxt &= "[TaskPinEditor]" & @CRLF $sTxt &= "Executable=@AutoItExe@, /AutoIt3ExecuteScript ""@ScriptDir@\TaskPinEditor.au3"" ""$MyIni$""" & @CRLF $sTxt &= "Icon=wmploc.dll, -18" & @CRLF $sTxt &= "ToolTip=Editor for the TaskPin" & @CRLF $sTxt &= "[Edit INI]" & @CRLF $sTxt &= "Executable=""$MyIni$""" & @CRLF $sTxt &= "Icon=shell32.dll, -70" & @CRLF $sTxt &= "ToolTip=Edit This INI" & @CRLF $sTxt &= "[Sleep]" & @CRLF $sTxt &= "Executable=@AutoItExe@, /AutoIt3ExecuteLine ""Send('#1')""" & @CRLF $sTxt &= "Icon=shell32.dll, -28" & @CRLF $sTxt &= "ToolTip=Send Computer to Sleep" & @CRLF $sTxt &= "[Control Panel]" & @CRLF $sTxt &= "Executable=explorer.exe, shell:ControlPanelFolder" & @CRLF $sTxt &= "Icon=shell32.dll, -22" & @CRLF $sTxt &= "ToolTip=Display the Control Panel" & @CRLF $sTxt &= "[Calculator]" & @CRLF $sTxt &= "Executable=@WindowsDir@\System32\calc.exe" & @CRLF $sTxt &= "Icon=" & @CRLF $sTxt &= "ToolTip=Calculator" & @CRLF $sTxt &= "[StringRegExpGUI]" & @CRLF $sTxt &= "Executable=@AutoItExe@, /AutoIt3ExecuteScript ""$AutoIt3Dir$\Examples\Helpfile\StringRegExpGUI.au3""" & @CRLF $sTxt &= "Icon=imageres.dll, -247" & @CRLF $sTxt &= "ToolTip=GUI for testing various StringRegExp() patterns" & @CRLF $sTxt &= "[www.autoitscript.com]" & @CRLF $sTxt &= "Executable=https://www.autoitscript.com/forum" & @CRLF $sTxt &= "Icon=shell32.dll, -136" & @CRLF $sTxt &= "ToolTip=www.autoitscript.com/forum" & @CRLF $sTxt &= "[Desktop]" & @CRLF $sTxt &= "Executable=explorer.exe, shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}" & @CRLF $sTxt &= "Icon=imageres.dll, -175" & @CRLF $sTxt &= "ToolTip=Show Desktop" & @CRLF $sTxt &= "[Folders...]" & @CRLF $sTxt &= "Executable=@AutoItExe@, /AutoIt3ExecuteScript ""@ScriptDir@\TaskPin.au3"" ""@ScriptDir@\Folders.ini""" & @CRLF $sTxt &= "Icon=imageres.dll, -265" & @CRLF $sTxt &= "ToolTip=Favorite Folders" & @CRLF FileWrite($hFileOpen, $sTxt) ;Close the handle returned by FileOpen. FileClose($hFileOpen) ;Check for the MyFolders.ini also $iniFileExists = FileExists(@ScriptDir & "\Folders.ini") If Not $iniFileExists Then $hFileOpen = FileOpen(@ScriptDir & "\Folders.ini", $FO_APPEND + $FO_UNICODE) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred while writing the Folders.ini") Exit EndIf $sTxt = "" $sTxt &= "[GUI_Settings]" & @CRLF $sTxt &= "AutoSort=False" & @CRLF $sTxt &= "GuiIcon=imageres.dll, 264" & @CRLF $sTxt &= "GuiDarkMode=1" & @CRLF $sTxt &= "GuiWidth=200" & @CRLF $sTxt &= "GuiMargin=3" & @CRLF $sTxt &= "BtnHeight=28" & @CRLF $sTxt &= "BtnMargin=1" & @CRLF $sTxt &= "BtnIconSize=1" & @CRLF $sTxt &= "BtnTxtSpace="" """ & @CRLF $sTxt &= "BtnFont=11, 400, 0, ""Segoe UI""" & @CRLF $sTxt &= "[TaskPinEditor]" & @CRLF $sTxt &= "Executable=@AutoItExe@, /AutoIt3ExecuteScript ""@ScriptDir@\TaskPinEditor.au3"" ""$MyIni$""" & @CRLF $sTxt &= "Icon=wmploc.dll, -18" & @CRLF $sTxt &= "ToolTip=Editor for the TaskPin" & @CRLF $sTxt &= "[ScriptDir]" & @CRLF $sTxt &= "Executable=@ScriptDir@" & @CRLF $sTxt &= "Icon=shell32.dll, -68" & @CRLF $sTxt &= "ToolTip=ScriptDir" & @CRLF $sTxt &= "[HomePath]" & @CRLF $sTxt &= "Executable=@HomeDrive@@HomePath@" & @CRLF $sTxt &= "Icon=imageres.dll, -118" & @CRLF $sTxt &= "ToolTip=HomePath" & @CRLF $sTxt &= "[AutoIt3 Dir]" & @CRLF $sTxt &= "Executable=$AutoIt3Dir$" & @CRLF $sTxt &= "Icon=$AutoIt3Dir$\Icons\au3.ico" & @CRLF $sTxt &= "ToolTip=AutoIt3Dir" & @CRLF $sTxt &= "[SCITE_USERHOME]" & @CRLF $sTxt &= "Executable=%SCITE_USERHOME%" & @CRLF $sTxt &= "Icon=$AutoIt3Dir$\scite\SciTE.exe" & @CRLF $sTxt &= "ToolTip=SCITE_USERHOME" & @CRLF $sTxt &= "[AppDataDir]" & @CRLF $sTxt &= "Executable=@LocalAppDataDir@" & @CRLF $sTxt &= "Icon=imageres.dll, -158" & @CRLF $sTxt &= "ToolTip=AppDataDir" & @CRLF $sTxt &= "[Downloads]" & @CRLF $sTxt &= "Executable=explorer.exe, shell:Downloads" & @CRLF $sTxt &= "Icon=imageres.dll, -176" & @CRLF $sTxt &= "ToolTip=Downloads" & @CRLF $sTxt &= "[Documents]" & @CRLF $sTxt &= "Executable=explorer.exe, shell:Documents" & @CRLF $sTxt &= "Icon=shell32.dll, -127" & @CRLF $sTxt &= "ToolTip=Documents" & @CRLF $sTxt &= "[This PC]" & @CRLF $sTxt &= "Executable=explorer.exe, shell:MyComputerFolder" & @CRLF $sTxt &= "Icon=imageres.dll, -105" & @CRLF $sTxt &= "ToolTip=This PC" & @CRLF $sTxt &= "[TaskPin...]" & @CRLF $sTxt &= "Executable=@AutoItExe@, /AutoIt3ExecuteScript ""@ScriptDir@\TaskPin.au3"" ""@ScriptDir@\TaskPin.ini""" & @CRLF $sTxt &= "Icon=imageres.dll, -289" & @CRLF $sTxt &= "ToolTip=Favorite" & @CRLF FileWrite($hFileOpen, $sTxt) ;Close the handle returned by FileOpen. FileClose($hFileOpen) EndIf Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 1) ;0=don't expand, 1=do expand Sleep(100) EndIf EndIf Local $iSort = Execute(IniRead($MyIni, "GUI_Settings", "AutoSort", False)) ; Read the INI section names. This will return a 1 dimensional array. Local $aSection = IniReadSectionNames($MyIni) If Not @error Then _ArrayDelete($aSection, _ArraySearch($aSection, "GUI_Settings")) ; Removed section named [Main Settings] from the array $aSection[0] = UBound($aSection) - 1 ; Adjust the amount of row in the array If $iSort Then _ArraySort($aSection) For $i = 1 To $aSection[0] ReDim $aArray[UBound($aArray) + 1][5] $aArray[0][0] = $i $aArray[$i][0] = $aSection[$i] ;"Name" $aArray[$i][1] = IniRead($MyIni, $aSection[$i], "Executable", "<>") ;"Executable" $aArray[$i][2] = IniRead($MyIni, $aSection[$i], "Icon", "<>") ;"Icon" $aArray[$i][3] = IniRead($MyIni, $aSection[$i], "ToolTip", "<>") ;"ToolTip" Next EndIf Return $aArray EndFunc ;==>Elements_ReadIni ;---------------------------------------------------------------------------------------- Func MakeExecuteShortcut($IniPath, $Suffix = ".Pin") ; Make Execute Shortcut .execute.lnk Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit($IniPath, $sDrive, $sDir, $sFileName, $sExtension) ; Create a constant variable in Local scope of the $Suffixcut filepath. Local Const $ShortFilePath = $sDrive & $sDir & $sFileName & $Suffix & ".lnk" Local $sArgs = ' /AutoIt3ExecuteScript "' & @ScriptFullPath & '" "' & $IniPath & '"' ; Create a shortcut Local $aSplit = IniRead($IniPath, "GUI_Settings", "GuiIcon", "") If $aSplit = "" Then $aSplit = "@SystemDir@\imageres.dll, 288" $aSplit = StringSplit($aSplit, ", ", 1) Local $aIcon[3] $aIcon[0] = ($aSplit[1]) ? ($aSplit[1]) : ("") ;icon $aIcon[1] = "" ;hotkey $aIcon[2] = ($aSplit[2]) ? ($aSplit[2]) : ("") ;icon number FileCreateShortcut(FileGetShortName(@AutoItExe), _ ;file $ShortFilePath, _ ;lnk $sDrive & $sDir, _ ;workdir $sArgs, _ ;args "Execute: " & $sFileName & $sExtension, _ ;desc $aIcon[0], $aIcon[1], $aIcon[2]) ;icon EndFunc ;==>MakeExecuteShortcut ;---------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------------------------------------------------- ; https://www.autoitscript.com/forum/topic/211475-darkmode-udf-for-autoits-win32guis/#comment-1530103 ;-------------------------------------------------------------------------------------------------------------------------------- Func DarkMode($hGui, $bDarkMode = True) ; DarkMode Local Enum $DWMWA_USE_IMMERSIVE_DARK_MODE = (@OSBuild <= 18985) ? 19 : 20 ;ConsoleWrite("$DWMWA_USE_IMMERSIVE_DARK_MODE=" & $DWMWA_USE_IMMERSIVE_DARK_MODE & @CRLF) ; DWMWA_USE_IMMERSIVE_DARK_MODE ; https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute ; Use with DwmSetWindowAttribute. Allows the window frame for this window to be drawn in dark mode colors when the dark mode system setting is enabled. ; For compatibility reasons, all windows default to light mode regardless of the system setting. ; The pvAttribute parameter points to a value of type BOOL. TRUE to honor dark mode for the window, FALSE to always use light mode. ; This value is supported starting with Windows 11 Build 22000. Local $iRet = _WinAPI_DwmSetWindowAttribute_unr($hGui, $DWMWA_USE_IMMERSIVE_DARK_MODE, $bDarkMode) If Not $iRet Then Return SetError(1, 0, -1) For $i = 1 To $aElements[0][0] _SetCtrlColorMode($aElements[$i][4], $bDarkMode) Next If $bDarkMode Then ; $hGUI GUISetBkColor(0x1B1B1B, $hGui) ;0x1B1B1B Black Else ; $hGUI GUISetBkColor(0xF0F0F0, $hGui) ;0xF0F0F0 Honeydew EndIf _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_UPDATENOW) ;WinActivate("[CLASS:Progman;]") ; To refresh the frame. ;WinActivate($hGui) ; Only needed for the constant back and forth in this demo. EndFunc ;==>DarkMode ;---------------------------------------------------------------------------------------- Func _SetCtrlColorMode($hWnd, $bDarkMode = True, $sName = Default) If $sName = Default Then $sName = $bDarkMode ? 'DarkMode_Explorer' : 'Explorer' $bDarkMode = Not Not $bDarkMode ; https://www.vbforums.com/showthread.php?900444-Windows-10-Dark-Mode-amp-VB6-apps If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Local Enum $eDefault, $eAllowDark, $eForceDark, $eForceLight, $eMax ; enum PreferredAppMode DllCall('uxtheme.dll', 'bool', 133, 'hwnd', $hWnd, 'bool', $bDarkMode) ; fnAllowDarkModeForWindow = 133 DllCall('uxtheme.dll', 'int', 135, 'int', ($bDarkMode ? $eForceDark : $eForceLight)) ; fnAllowDarkModeForApp = 135 _WinAPI_SetWindowTheme_unr($hWnd, $sName) ; https://www.autoitscript.com/forum/index.php?showtopic=211475&view=findpost&p=1530103 DllCall('uxtheme.dll', 'none', 104) ; fnRefreshImmersiveColorPolicyState = 104 ; not needed ? _SendMessage($hWnd, $WM_THEMECHANGED, 0, 0) ; not needed ? EndFunc ;==>_SetCtrlColorMode ;---------------------------------------------------------------------------------------- Func _WinAPI_SetWindowTheme_unr($hWnd, $sName = Null, $sList = Null) ;Causes a window to use a different set of visual style information than its class normally uses Local $sResult = DllCall('UxTheme.dll', 'long', 'SetWindowTheme', 'hwnd', $hWnd, 'wstr', $sName, 'wstr', $sList) If @error Then Return SetError(@error, @extended, 0) If $sResult[0] Then Return SetError(10, $sResult[0], 0) Return 1 EndFunc ;==>_WinAPI_SetWindowTheme_unr ;---------------------------------------------------------------------------------------- Func _WinAPI_DwmSetWindowAttribute_unr($hWnd, $iAttribute, $iData) ;Sets the value of the specified attributes for non-client rendering to apply to the window Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', $iAttribute, _ 'dword*', $iData, 'dword', 4) If @error Then Return SetError(@error, @extended, 0) If $aCall[0] Then Return SetError(10, $aCall[0], 0) Return 1 EndFunc ;==>_WinAPI_DwmSetWindowAttribute_unr ;---------------------------------------------------------------------------------------- I also added an Editor optionally, for easy alignment and management of commands To enter edit mode, hold down the control key while clicking on the shortcut we pinned to the taskbar or hit the TaskPinEditor button in version 0.0.0.7 I added the ability to the executable field to accept icons with drag & drop and adjust them accordingly if it's a script to open it with AutoIT, if it's a shortcut to move it to @ScriptDir & "\lnkBackUp\" TaskPinEditor.au3 ; https://www.autoitscript.com/forum/topic/211276-taskpin/ ;---------------------------------------------------------------------------------------- ; Title...........: TaskPinEditor.au3 ; Description.....: Editor for the TaskPin ; AutoIt Version..: 3.3.16.1 Author: ioa747 ;---------------------------------------------------------------------------------------- #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_ProductName=TaskPinEditor.au3 #AutoIt3Wrapper_Res_Fileversion=0.0.0.9 #AutoIt3Wrapper_Res_Description=Editor for the TaskPin #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <AutoItConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <GuiListBox.au3> #include <StaticConstants.au3> #include <WinAPIDlg.au3> #include <Misc.au3> #include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <WinAPI.au3> ; for _WinAPI_CreateWindowEx() #include <GDIPlus.au3> ; Add some usefull global Macro as variable Global $AutoIt3Dir = FileGetShortName(StringTrimRight(@AutoItExe, 12)) Global $AutoItExe = FileGetShortName(@AutoItExe) Global $hGuiEdit, $Input_Name, $Input_Exec, $Input_icon, $Input_ToolTip Global $aCtrl[11] = [10], $aBtn[10] = [9] Global $MyIni = $CmdLine[0] If Not $MyIni Then MsgBox($MB_SYSTEMMODAL + $MB_ICONWARNING, @ScriptName, "I did not find command line parameters", 10) GoToExit() Else $MyIni = $CmdLine[1] EndIf ; Read the INI file for the value of 'Elements' Global $aElements = Elements_ReadIni() Editor_GUI() ;---------------------------------------------------------------------------------------- Func GoToExit() Exit EndFunc ;==>GoToExit ;---------------------------------------------------------------------------------------- Func Editor_GUI() Local $idListBox, $Label_Exec, $Button_GetExec, $Button_TestRun, $Button_ExecInsert Local $Button_GetIcon, $Button_IconInsert, $Button_Add, $Button_Remove, $Button_Up, $Button_Down #Region === TaskPin Editor GUI === $hGuiEdit = GUICreate($MyIni, 498, 610, -1, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) $idListBox = GUICtrlCreateList("", 5, 0, 484, 310) GUICtrlSetFont(-1, 11) $aCtrl[1] = GUICtrlCreateLabel("Name:", 5, 328) $Input_Name = GUICtrlCreateInput("Name", 5, 345, 405, 23) GUICtrlSetFont(-1, 11, 300, 0, "Consolas") $aCtrl[2] = GUICtrlCreateLabel("Executable:", 5, 377) $Input_Exec = GUICtrlCreateInput("Executable", 5, 395, 460, 60, $ES_MULTILINE) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 11, 300, 0, "Consolas") GUICtrlSetTip(-1, "Drag and drop Executable file here" & @CRLF & "or select with ... button") $Label_Exec = GUICtrlCreateLabel("", 5, 460, 485, 54) GUICtrlSetFont(-1, 9, 300, 0, "Consolas") $Button_GetExec = GUICtrlCreateButton("...", 470, 395, 20, 20) GUICtrlSetTip(-1, "FileOpenDialog to get Executable") $Button_TestRun = GUICtrlCreateButton("▶", 470, 415, 20, 20) GUICtrlSetTip(-1, "Test Run") $Button_ExecInsert = GUICtrlCreateButton("|+", 470, 435, 20, 20) GUICtrlSetTip(-1, "First place the cursor in Executable" & @CRLF & "where the text will be inserted") $aCtrl[3] = GUICtrlCreateLabel("Icon:", 45, 520) $Input_icon = GUICtrlCreateInput("icon", 45, 537, 400, 21) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetTip(-1, "Drag and drop Icon file here" & @CRLF & "or select with ... button") $Button_GetIcon = GUICtrlCreateButton("...", 448, 537, 20, 20) GUICtrlSetTip(-1, "Icon Open Dialog to get Icon") $Button_IconInsert = GUICtrlCreateButton("|+", 470, 537, 20, 20) GUICtrlSetTip(-1, "Insert Window .dll to get Icon") $aCtrl[4] = GUICtrlCreateLabel("ToolTip:", 5, 565) $Input_ToolTip = GUICtrlCreateInput("ToolTip", 5, 583, 484, 21) $Button_Add = GUICtrlCreateButton("➕", 422, 323, 32, 32, $BS_VCENTER) GUICtrlSetFont(-1, 18, 600, 0, "Consolas") GUICtrlSetTip(-1, "Add Item") $Button_Remove = GUICtrlCreateButton("➖", 422, 356, 32, 32, $BS_VCENTER) GUICtrlSetFont(-1, 18, 600, 0, "Consolas") GUICtrlSetTip(-1, "Remove Item") $Button_Up = GUICtrlCreateButton("▲", 457, 323, 32, 32, $BS_VCENTER) GUICtrlSetFont(-1, 18, 600, 0, "Consolas") GUICtrlSetTip(-1, "Move UP") $Button_Down = GUICtrlCreateButton("▼", 457, 356, 32, 32, $BS_VCENTER) GUICtrlSetFont(-1, 18, 600, 0, "Consolas") GUICtrlSetTip(-1, "Move DOWN") Local $Icon1 = GUICtrlCreateIcon("", -1, 5, 525, 32, 32) Local $Dummy_Exit = GUICtrlCreateDummy() Local $iDarkMode = IniRead($MyIni, "GUI_Settings", "GuiDarkMode", 0) Local $bDarkMode = ($iDarkMode = 1 ? True : False) ;Need for DarkMode $aCtrl[5] = $Input_Name $aCtrl[6] = $Input_Exec $aCtrl[7] = $Input_icon $aCtrl[8] = $Input_ToolTip $aCtrl[9] = $idListBox $aCtrl[10] = $Label_Exec $aBtn[1] = $Button_GetExec $aBtn[2] = $Button_TestRun $aBtn[3] = $Button_ExecInsert $aBtn[4] = $Button_GetIcon $aBtn[5] = $Button_IconInsert $aBtn[6] = $Button_Add $aBtn[7] = $Button_Remove $aBtn[8] = $Button_Up $aBtn[9] = $Button_Down GUISetState(@SW_SHOW) #EndRegion === TaskPin Editor GUI === DarkMode($hGuiEdit, $bDarkMode) #Region === ContextMenu $idListBox === Local $hBoxMenu = GUICtrlCreateContextMenu($idListBox) Local $Menu_Add = GUICtrlCreateMenuItem("Add Item ", $hBoxMenu) Local $Menu_Remove = GUICtrlCreateMenuItem("Remove Item ", $hBoxMenu) GUICtrlCreateMenuItem("", $hBoxMenu) ; separator ------------------------------------- Local $Menu_Up = GUICtrlCreateMenuItem("Move UP" & @TAB & "Shift ▲", $hBoxMenu) Local $Menu_Down = GUICtrlCreateMenuItem("Move DOWN" & @TAB & "Shift ▼", $hBoxMenu) GUICtrlCreateMenuItem("", $hBoxMenu) ; separator ------------------------------------- #EndRegion === ContextMenu $idListBox === #Region === ContextMenu $Button_ExecInsert === Local $hMenuExecInsert = GUICtrlCreateContextMenu($Button_ExecInsert) Local $aMenuExecInsert = '$AutoIt3Dir$;$AutoItExe$;@AutoItExe@, /AutoIt3ExecuteLine "Send(''#1'')";' $aMenuExecInsert &= '@AutoItExe@, /AutoIt3ExecuteScript "@ScriptFullPath@" "parameters";explorer.exe, "FileToExecute";;' $aMenuExecInsert &= '@AppDataDir@;@AutoItExe@;@ComputerName@;@DesktopDir@;@FavoritesDir@;@HomeDrive@;@HomePath@;@HomeShare@;' $aMenuExecInsert &= '@LocalAppDataDir@;@LogonDomain@;@MyDocumentsDir@;@ProgramFilesDir@;@ProgramsDir@;@ScriptDir@;@ScriptFullPath@;' $aMenuExecInsert &= '@ScriptName@;@SystemDir@;@TempDir@;@StartMenuDir@;@StartupDir@;@UserName@;@UserProfileDir@;@WindowsDir@;' $aMenuExecInsert &= ';@YEAR@;@MON@;@MDAY@;@WDAY@;@HOUR@;@MIN@;@SEC@;@MSEC@' $aMenuExecInsert = StringSplit($aMenuExecInsert, ";", 1) _ArrayColInsert($aMenuExecInsert, 0) $aMenuExecInsert[0][0] = $aMenuExecInsert[0][1] Local $sLbl For $i = 1 To $aMenuExecInsert[0][0] If StringRight($aMenuExecInsert[$i][1], 1) = "@" Then $sLbl = "@" & $aMenuExecInsert[$i][1] & " - " Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand $sLbl = $sLbl & $aMenuExecInsert[$i][1] Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand Else $sLbl = $aMenuExecInsert[$i][1] EndIf $aMenuExecInsert[$i][0] = GUICtrlCreateMenuItem($sLbl, $hMenuExecInsert) Next #EndRegion === ContextMenu $Button_ExecInsert === #Region === ContextMenu $Button_IconInsert === Local $hMenuIconInsert = GUICtrlCreateContextMenu($Button_IconInsert) Local $aMenuIconInsert = 'imageres.dll, -1;shell32.dll, -1;wmploc.dll, -1;ddores.dll, -1;' $aMenuIconInsert &= 'mmcndmgr.dll, -1;ieframe.dll, -1;compstui.dll, -1;setupapi.dll, -1;netshell.dll, -1' $aMenuIconInsert = StringSplit($aMenuIconInsert, ";", 1) _ArrayColInsert($aMenuIconInsert, 0) $aMenuIconInsert[0][0] = $aMenuIconInsert[0][1] For $i = 1 To $aMenuIconInsert[0][0] $aMenuIconInsert[$i][0] = GUICtrlCreateMenuItem($aMenuIconInsert[$i][1], $hMenuIconInsert) Next #EndRegion === ContextMenu $Button_IconInsert === Local $GUI_AccelTable[2][2] = [["+{UP}", $Menu_Up], ["+{DOWN}", $Menu_Down]] GUISetAccelerators($GUI_AccelTable, $hGuiEdit) Local $CurPos, $TmpPos, $AddNew, $mName, $NeedSave, $sFileOpenDialog Local $aIcon, $aTxt[6], $aCtrlRecvMsg = 0 Local $hDLL = DllOpen("user32.dll") ; Add strings _GUICtrlListBox_BeginUpdate($idListBox) For $i = 1 To $aElements[0][0] _GUICtrlListBox_InsertString($idListBox, $aElements[$i][0]) Next _GUICtrlListBox_EndUpdate($idListBox) _GUICtrlListBox_SetCurSel($idListBox, $aElements[0][0] - 1) $CurPos = _GUICtrlListBox_GetCurSel($idListBox) ; Get currently selected item GUICtrlSetData($Input_Name, $aElements[$CurPos + 1][0]) GUICtrlSetData($Input_Exec, $aElements[$CurPos + 1][1]) GUICtrlSetData($Label_Exec, CheckForLabel_Exec(GUICtrlRead($Input_Exec))) GUICtrlSetData($Input_icon, $aElements[$CurPos + 1][2]) GUICtrlSetData($Input_ToolTip, $aElements[$CurPos + 1][3]) CheckForTheIcon($Input_icon, $Icon1, $Input_Exec) Local $ID While 1 If $CurPos <> $TmpPos Then $TmpPos = $CurPos EndIf $ID = GUIGetMsg() Switch $ID Case $GUI_EVENT_CLOSE GUICtrlSendToDummy($Dummy_Exit) Case $idListBox ; Get currently selected item $CurPos = _GUICtrlListBox_GetCurSel($idListBox) GUICtrlSetData($Input_Name, $aElements[$CurPos + 1][0]) GUICtrlSetData($Input_Exec, $aElements[$CurPos + 1][1]) GUICtrlSetData($Label_Exec, CheckForLabel_Exec($aElements[$CurPos + 1][1])) GUICtrlSetData($Input_icon, $aElements[$CurPos + 1][2]) GUICtrlSetData($Input_ToolTip, $aElements[$CurPos + 1][3]) GUICtrlSetTip($Input_Exec, "") GUICtrlSetTip($Input_icon, "") CheckForTheIcon($Input_icon, $Icon1, $Input_Exec) If $AddNew = True Then $AddNew = False GUICtrlSetTip($Input_Exec, "Drag and drop Executable file here" & @CRLF & "or select with ... button") GUICtrlSetTip($Input_icon, "Drag and drop Icon file here" & @CRLF & "or select with ... button") GUICtrlSetState($Input_Name, $GUI_FOCUS) GUICtrlSendMsg($Input_Name, $EM_SETSEL, 0, -1) EndIf Case $Input_Name $aElements[$CurPos + 1][0] = GUICtrlRead($Input_Name) _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $aElements[$CurPos + 1][0]) _GUICtrlListBox_ClickItem($idListBox, $CurPos, "left") $NeedSave = True Case $Input_Exec $aElements[$CurPos + 1][1] = GUICtrlRead($Input_Exec) GUICtrlSetData($Label_Exec, CheckForLabel_Exec($aElements[$CurPos + 1][1])) If GUICtrlRead($Input_ToolTip) = "<Tip>" Then GUICtrlSetData($Input_ToolTip, GUICtrlRead($Label_Exec)) $aElements[$CurPos + 1][3] = GUICtrlRead($Label_Exec) EndIf $NeedSave = True Case $Input_icon $aElements[$CurPos + 1][2] = GUICtrlRead($Input_icon) CheckForTheIcon($Input_icon, $Icon1, $Input_Exec) $NeedSave = True Case $Input_ToolTip $aElements[$CurPos + 1][3] = GUICtrlRead($Input_ToolTip) $NeedSave = True Case $Button_TestRun Elements_Run(GUICtrlRead($Input_Exec)) Case $Button_GetExec GUISetState(@SW_HIDE, $hGuiEdit) $sFileOpenDialog = FileOpenDialog("Select to add in .ini", @ScriptDir & "\", _ "All (*.*)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST)) If @error Then MsgBox(4096, "Error", "No file was selected.", 3) Else $aElements[$CurPos + 1][1] = Check_Executable($sFileOpenDialog) GUICtrlSetData($Input_Exec, $aElements[$CurPos + 1][1]) $mName = StringSplit($sFileOpenDialog, "\") GUICtrlSetData($Input_Name, $mName[$mName[0]]) $aElements[$CurPos + 1][0] = $mName[$mName[0]] GUICtrlSetData($Input_ToolTip, $mName[$mName[0]]) $aElements[$CurPos + 1][3] = $mName[$mName[0]] _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $mName[$mName[0]]) $NeedSave = True EndIf GUISetState(@SW_SHOW, $hGuiEdit) _GUICtrlListBox_ClickItem($idListBox, $CurPos, "left") $NeedSave = True Case $Button_GetIcon $aIcon = StringSplit(GUICtrlRead($Input_icon), ", ", 1) If $aIcon[0] = 1 Then _ArrayAdd($aIcon, "-1", 2) Local $aData = _WinAPI_PickIconDlg($aIcon[1], Abs($aIcon[2]) - 1, $hGuiEdit) If IsArray($aData) Then ;GUICtrlSetImage($idIcon, $aData[0], -(1 + $aData[1])) If StringRight($aData[0], 4) = ".ico" Then GUICtrlSetData($Input_icon, $aData[0]) Else GUICtrlSetData($Input_icon, $aData[0] & ", " & - (1 + $aData[1])) EndIf $aElements[$CurPos + 1][2] = GUICtrlRead($Input_icon) CheckForTheIcon($Input_icon, $Icon1, $Input_Exec) $NeedSave = True ;$aLast = $aData EndIf Case $Button_Add, $Menu_Add Local $sFill = "<Name>|<Path>|<icon>|<Tip>" If $CurPos < $aElements[0][0] - 1 Then _ArrayInsert($aElements, $CurPos + 1, $sFill) _GUICtrlListBox_InsertString($idListBox, "<Name>", $CurPos) _GUICtrlListBox_ClickItem($idListBox, $CurPos, "left") Else _ArrayAdd($aElements, $sFill) _GUICtrlListBox_InsertString($idListBox, "<Name>") _GUICtrlListBox_ClickItem($idListBox, $CurPos + 1, "left") EndIf $aElements[0][0] += 1 $AddNew = True $NeedSave = True Case $Button_Remove, $Menu_Remove _GUICtrlListBox_DeleteString($idListBox, $CurPos) _ArrayDelete($aElements, $CurPos + 1) $aElements[0][0] -= 1 If $CurPos = $aElements[0][0] - 1 Then $CurPos -= 1 If $CurPos > 0 Then _GUICtrlListBox_ClickItem($idListBox, $CurPos - 1, "left") Else _GUICtrlListBox_ClickItem($idListBox, 0, "left") EndIf $NeedSave = True Case $Button_Up, $Menu_Up IniWrite($MyIni, "GUI_Settings", "AutoSort", False) If $CurPos > 0 Then _ArraySwap($aElements, $CurPos + 1, $CurPos) _GUICtrlListBox_SwapString($idListBox, $CurPos, $CurPos - 1) $CurPos -= 1 _GUICtrlListBox_SetCurSel($idListBox, $CurPos) $NeedSave = True EndIf Case $Button_Down, $Menu_Down IniWrite($MyIni, "GUI_Settings", "AutoSort", False) If $CurPos < $aElements[0][0] - 1 Then _ArraySwap($aElements, $CurPos + 1, $CurPos + 2) _GUICtrlListBox_SwapString($idListBox, $CurPos, $CurPos + 1) $CurPos += 1 _GUICtrlListBox_SetCurSel($idListBox, $CurPos) $NeedSave = True EndIf Case $GUI_EVENT_DROPPED If @GUI_DropId = $Input_Exec Then Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit(@GUI_DragFile, $sDrive, $sDir, $sFileName, $sExtension) Switch $sExtension Case ".au3" $aElements[$CurPos + 1][1] = '@AutoItExe@, /AutoIt3ExecuteScript "' & @GUI_DragFile & '"' GUICtrlSetData($Input_Exec, $aElements[$CurPos + 1][1]) $aElements[$CurPos + 1][0] = $sFileName GUICtrlSetData($Input_Name, $sFileName) $aElements[$CurPos + 1][3] = $sFileName GUICtrlSetData($Input_ToolTip, $sFileName) Case ".lnk" Local $lnkBackUp = @ScriptDir & "\lnkBackUp\" $aElements[$CurPos + 1][0] = $sFileName GUICtrlSetData($Input_Name, $sFileName) Local $aDetails = FileGetShortcut(@GUI_DragFile) $aElements[$CurPos + 1][2] = ($aDetails[4] = '' ? "" : $aDetails[4] & ", " & $aDetails[4]) GUICtrlSetData($Input_icon, $aElements[$CurPos + 1][2]) $aElements[$CurPos + 1][3] = ($aDetails[3] = '' ? $sFileName : $aDetails[3]) GUICtrlSetData($Input_ToolTip, $aDetails[3]) Local $NewFile $i = 0 Do $NewFile = $lnkBackUp & $sFileName & ($i = 0 ? "" : "_" & $i) & $sExtension $i += 1 Until Not FileExists($NewFile) FileMove(@GUI_DragFile, $NewFile, $FC_CREATEPATH) $aElements[$CurPos + 1][1] = '"' & $aDetails[0] & ($aDetails[2] = '' ? '"' : '" "' & $aDetails[2] & '"') GUICtrlSetData($Input_Exec, $aElements[$CurPos + 1][1]) Case Else $aElements[$CurPos + 1][1] = '"' & @GUI_DragFile & '"' GUICtrlSetData($Input_Exec, $aElements[$CurPos + 1][1]) $aElements[$CurPos + 1][0] = $sFileName GUICtrlSetData($Input_Name, $sFileName) $aElements[$CurPos + 1][3] = $sFileName GUICtrlSetData($Input_ToolTip, $sFileName) EndSwitch _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $sFileName) _GUICtrlListBox_ClickItem($idListBox, $CurPos, "left") $NeedSave = True ElseIf @GUI_DropId = $Input_icon Then $aElements[$CurPos + 1][2] = @GUI_DragFile GUICtrlSetData($Input_icon, @GUI_DragFile) ; check for the icon CheckForTheIcon($Input_icon, $Icon1, $Input_Exec) $NeedSave = True EndIf Case $Button_ExecInsert ControlFocus($hGuiEdit, "", $Input_Exec) MouseClick("right") Case $aMenuExecInsert[1][0] To $aMenuExecInsert[$aMenuExecInsert[0][0]][0] ;ConsoleWrite("$ID = " & $ID & @CRLF) ;ControlFocus($hGuiEdit, "", $Input_Exec) $aCtrlRecvMsg = GUICtrlRecvMsg($Input_Exec, $EM_GETSEL) $aTxt[4] = (IsArray($aCtrlRecvMsg)) ? (True) : (False) $aTxt[0] = GUICtrlRead($Input_Exec) $aTxt[1] = ($aTxt[4]) ? (StringLeft($aTxt[0], $aCtrlRecvMsg[0])) : ("") $aTxt[2] = $aMenuExecInsert[$ID - $aMenuExecInsert[1][0] + 1][1] $aTxt[3] = ($aTxt[4]) ? (StringTrimLeft($aTxt[0], $aCtrlRecvMsg[1])) : ($aTxt[0]) If $aTxt[2] = "&&" Then $aTxt[2] = "&" $aTxt[0] = $aTxt[1] & $aTxt[2] & $aTxt[3] $aTxt[1] = ($aTxt[4]) ? ($aCtrlRecvMsg[0]) : (0) $aTxt[2] = ($aTxt[4]) ? ($aCtrlRecvMsg[0] + StringLen($aTxt[2])) : (StringLen($aTxt[2])) GUICtrlSetData($Input_Exec, $aTxt[0]) $aElements[$CurPos + 1][1] = $aTxt[0] GUICtrlSetData($Label_Exec, CheckForLabel_Exec($aElements[$CurPos + 1][1])) GUICtrlSendMsg($Input_Exec, $EM_SETSEL, $aTxt[1], $aTxt[2]) $NeedSave = True Case $Button_IconInsert ; Set focus to the $Input_icon control. GUICtrlSetState($Input_icon, $GUI_FOCUS) ;ControlFocus($hGuiEdit, "", $Input_icon) MouseClick("right") Case $aMenuIconInsert[1][0] To $aMenuIconInsert[$aMenuIconInsert[0][0]][0] ;ConsoleWrite("$ID = " & $ID & @CRLF) GUICtrlSetData($Input_icon, $aMenuIconInsert[$ID - $aMenuIconInsert[1][0] + 1][1]) $aElements[$CurPos + 1][2] = GUICtrlRead($Input_icon) CheckForTheIcon($Input_icon, $Icon1, $Input_Exec) $NeedSave = True Case $Dummy_Exit ExitLoop EndSwitch WEnd GUIDelete() DllClose($hDLL) If $NeedSave = True Then Elements_SaveIni() EndFunc ;==>Editor_GUI ;---------------------------------------------------------------------------------------- Func Check_Executable($sFile) Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit($sFile, $sDrive, $sDir, $sFileName, $sExtension) Switch $sExtension Case ".au3" Return '@AutoItExe@, /AutoIt3ExecuteScript "' & $sFile & '"' Case ".lnk" Local $lnkBackUp = @ScriptDir & "\lnkBackUp\" GUICtrlSetData($Input_Name, $sFileName) Local $aDetails = FileGetShortcut($sFile) GUICtrlSetData($Input_icon, $aDetails[4]) GUICtrlSetData($Input_ToolTip, $aDetails[3]) Local $NewFile, $i = 0 Do $i += 1 $NewFile = $lnkBackUp & $sFileName & ($i = 0) ? ("") : ("_" & $i) & $sExtension Until Not FileExists($NewFile) FileMove($sFile, $NewFile, $FC_CREATEPATH) Return '"' & $aDetails[0] & '"' & ($aDetails[2] = "") ? ('') : (' "' & $aDetails[2] & '"') Case Else Return $sFile EndSwitch EndFunc ;==>Check_Executable ;---------------------------------------------------------------------------------------- Func Elements_Run($sFile) Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 1) ;0=don't expand, 1=do expand Local $aSplit $aSplit = StringSplit($sFile, ", ", 1) If $aSplit[0] = 2 Then ShellExecute($aSplit[1], $aSplit[2]) Else ShellExecute($aSplit[1]) EndIf Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 0) ;0=don't expand, 1=do expand EndFunc ;==>Elements_Run ;---------------------------------------------------------------------------------------- Func CheckForLabel_Exec($sFile) Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 1) ;0=don't expand, 1=do expand Local $aSplit, $Result $aSplit = StringSplit($sFile, ", ", 1) If $aSplit[0] = 2 Then $Result = $aSplit[1] & ", " & @LF & $aSplit[2] Else $Result = $aSplit[1] EndIf Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 0) ;0=don't expand, 1=do expand Return $Result EndFunc ;==>CheckForLabel_Exec ;---------------------------------------------------------------------------------------- Func CheckForTheIcon($Input_icon, $Icon1, $Input_Exec) Opt("ExpandVarStrings", 1) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 1) ;0=don't expand, 1=do expand ; check for the icon Local $aSplit, $sIcon $aSplit = StringSplit(GUICtrlRead($Input_icon), ", ", 1) $sIcon = $aSplit[1] If $aSplit[0] = 2 Then GUICtrlSetImage($Icon1, $sIcon, Int($aSplit[2])) Else If StringLen($aSplit[1]) = 0 Then $sIcon = GUICtrlRead($Input_Exec) GUICtrlSetImage($Icon1, $sIcon, 0) Else GUICtrlSetImage($Icon1, $sIcon) EndIf EndIf Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand Opt("ExpandEnvStrings", 0) ;0=don't expand, 1=do expand EndFunc ;==>CheckForTheIcon ;---------------------------------------------------------------------------------------- Func Elements_ReadIni() Local $iniFileExists = FileExists($MyIni) Local $index = 0 Local $aArray[1][5] $aArray[0][0] = $index $aArray[0][1] = "Executable" $aArray[0][2] = "Icon" $aArray[0][3] = "ToolTip" ;$aArray[0][4] = "ID" ;Checks if .ini not GoToExit If Not $iniFileExists Then MsgBox($MB_SYSTEMMODAL + $MB_ICONWARNING, @ScriptName, "I did not find command line parameters", 10) GoToExit() EndIf Local $iSort = Execute(IniRead($MyIni, "GUI_Settings", "AutoSort", False)) ; Read the INI section names. This will return a 1 dimensional array. Local $aSection = IniReadSectionNames($MyIni) If Not @error Then _ArrayDelete($aSection, _ArraySearch($aSection, "GUI_Settings")) ; Removed section named [Main Settings] from the array $aSection[0] = UBound($aSection) - 1 ; Adjust the amount of row in the array If $iSort Then _ArraySort($aSection) For $i = 1 To $aSection[0] ReDim $aArray[UBound($aArray) + 1][5] $aArray[0][0] = $i $aArray[$i][0] = $aSection[$i] ;"Name" $aArray[$i][1] = IniRead($MyIni, $aSection[$i], "Executable", "<Executable>") ;"Executable" $aArray[$i][2] = IniRead($MyIni, $aSection[$i], "Icon", "<Icon>") ;"Icon" $aArray[$i][3] = IniRead($MyIni, $aSection[$i], "ToolTip", "<ToolTip>") ;"ToolTip" Next EndIf Return $aArray EndFunc ;==>Elements_ReadIni ;---------------------------------------------------------------------------------------- Func Elements_SaveIni() ;Read the INI section names. This will return a 1 dimensional array. Local $aSection = IniReadSectionNames($MyIni) ;Check if an error occurred. If Not @error Then _ArrayDelete($aSection, _ArraySearch($aSection, "GUI_Settings")) ; Removed section named [Main Settings] from the array $aSection[0] = UBound($aSection) - 1 ; Adjust the amount of row in the array ;Enumerate through the array displaying the section names. For $i = 1 To $aSection[0] ;Delete the sections IniDelete($MyIni, $aSection[$i]) Next EndIf Local $iSort = Execute(IniRead($MyIni, "GUI_Settings", "AutoSort", False)) ;Write to the .ini If Not @error Then _ArrayDelete($aSection, _ArraySearch($aSection, "GUI_Settings")) ; Removed section named [Main Settings] from the array $aSection[0] = UBound($aSection) - 1 ; Adjust the amount of row in the array If $iSort Then _ArraySort($aSection) For $i = 1 To $aElements[0][0] $aSection = $aElements[$i][0] ; Name IniWrite($MyIni, $aSection, "Executable", $aElements[$i][1]) IniWrite($MyIni, $aSection, "Icon", $aElements[$i][2]) IniWrite($MyIni, $aSection, "ToolTip", $aElements[$i][3]) Next ConsoleWrite("Saved the .ini file" & @CRLF) EndIf EndFunc ;==>Elements_SaveIni ;---------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------------------------------------------------- ; https://www.autoitscript.com/forum/topic/211475-darkmode-udf-for-autoits-win32guis/#comment-1530103 ;-------------------------------------------------------------------------------------------------------------------------------- Func DarkMode($hGui, $bDarkMode = True) ; DarkMode Local Enum $DWMWA_USE_IMMERSIVE_DARK_MODE = (@OSBuild <= 18985) ? 19 : 20 ;ConsoleWrite("$DWMWA_USE_IMMERSIVE_DARK_MODE=" & $DWMWA_USE_IMMERSIVE_DARK_MODE & @CRLF) ; DWMWA_USE_IMMERSIVE_DARK_MODE ; https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute ; Use with DwmSetWindowAttribute. Allows the window frame for this window to be drawn in dark mode colors when the dark mode system setting is enabled. ; For compatibility reasons, all windows default to light mode regardless of the system setting. ; The pvAttribute parameter points to a value of type BOOL. TRUE to honor dark mode for the window, FALSE to always use light mode. ; This value is supported starting with Windows 11 Build 22000. Local $iRet = _WinAPI_DwmSetWindowAttribute_unr($hGui, $DWMWA_USE_IMMERSIVE_DARK_MODE, $bDarkMode) If Not $iRet Then Return SetError(1, 0, -1) ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; $idListBox for scrollBar _SetCtrlColorMode($aCtrl[9], $bDarkMode) ; Buttons For $i = 1 To $aBtn[0] _SetCtrlColorMode($aBtn[$i], $bDarkMode) Next ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If $bDarkMode Then ; $hGUI GUISetBkColor(0x1B1B1B, $hGui) ;0x1B1B1B Black ; other controls For $i = 0 To $aCtrl[0] GUICtrlSetBkColor($aCtrl[$i], 0x2B2B2B) ;Dark slate gray GUICtrlSetColor($aCtrl[$i], 0xFBFBFB) ;0xFBFBFB Snow Next Else ; $hGUI GUISetBkColor(0xF0F0F0, $hGui) ;0xF0F0F0 Honeydew ; other controls For $i = 0 To $aCtrl[0] GUICtrlSetBkColor($aCtrl[$i], 0xF0F0F0) ;Dark slate gray GUICtrlSetColor($aCtrl[$i], 0x1B1B1B) ;0xFBFBFB Snow Next EndIf ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_UPDATENOW) WinActivate("[CLASS:Progman;]") ; To refresh the frame. WinActivate($hGui) ; Only needed for the constant back and forth in this demo. EndFunc ;==>DarkMode ;---------------------------------------------------------------------------------------- Func _SetCtrlColorMode($hWnd, $bDarkMode = True, $sName = Default) If $sName = Default Then $sName = $bDarkMode ? 'DarkMode_Explorer' : 'Explorer' $bDarkMode = Not Not $bDarkMode ; https://www.vbforums.com/showthread.php?900444-Windows-10-Dark-Mode-amp-VB6-apps If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Local Enum $eDefault, $eAllowDark, $eForceDark, $eForceLight, $eMax ; enum PreferredAppMode DllCall('uxtheme.dll', 'bool', 133, 'hwnd', $hWnd, 'bool', $bDarkMode) ; fnAllowDarkModeForWindow = 133 DllCall('uxtheme.dll', 'int', 135, 'int', ($bDarkMode ? $eForceDark : $eForceLight)) ; fnAllowDarkModeForApp = 135 _WinAPI_SetWindowTheme_unr($hWnd, $sName) ; https://www.autoitscript.com/forum/index.php?showtopic=211475&view=findpost&p=1530103 DllCall('uxtheme.dll', 'none', 104) ; fnRefreshImmersiveColorPolicyState = 104 ; not needed ? _SendMessage($hWnd, $WM_THEMECHANGED, 0, 0) ; not needed ? EndFunc ;==>_SetCtrlColorMode ;---------------------------------------------------------------------------------------- Func _WinAPI_SetWindowTheme_unr($hWnd, $sName = Null, $sList = Null) ;Causes a window to use a different set of visual style information than its class normally uses Local $sResult = DllCall('UxTheme.dll', 'long', 'SetWindowTheme', 'hwnd', $hWnd, 'wstr', $sName, 'wstr', $sList) If @error Then Return SetError(@error, @extended, 0) If $sResult[0] Then Return SetError(10, $sResult[0], 0) Return 1 EndFunc ;==>_WinAPI_SetWindowTheme_unr ;---------------------------------------------------------------------------------------- Func _WinAPI_DwmSetWindowAttribute_unr($hWnd, $iAttribute, $iData) ;Sets the value of the specified attributes for non-client rendering to apply to the window Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', $iAttribute, _ 'dword*', $iData, 'dword', 4) If @error Then Return SetError(@error, @extended, 0) If $aCall[0] Then Return SetError(10, $aCall[0], 0) Return 1 EndFunc ;==>_WinAPI_DwmSetWindowAttribute_unr ;---------------------------------------------------------------------------------------- Please, every comment is appreciated! leave your comments and experiences here! Thank you very much1 point
-
Billboard (powered by msEdge)
SOLVE-SMART reacted to Gianni for a topic
A sort of billboard based on the Edge browser and 'served' by AutoIt. Main script engine taken from this post by @Danyfirex: https://www.autoitscript.com/forum/topic/207856-show-parsed-html-code-in-default-browser-not-ie-moved/?do=findComment&comment=1499455 Basically the smallest embedded web server ever. Obviously the content displayed in the browser is generated by the HTML/CSS/Javascript listing embedded in the AutoIt script. AutoIt simply runs msEdge and "serves" the web page. Nothing special, but an interesting way to contain everything in one file. Reports of errors and suggestions for improvements are welcome Cheers P.S. To easily adapt and prepare the HTML listing, ready to be embedded into the AutoIt listing, see this other post: https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/?do=findComment&comment=1474817 #cs a kind of billboard based on Edge browser and 'served' by AutoIt Main script engine taken from this post by @Danyfirex: https://www.autoitscript.com/forum/topic/207856-show-parsed-html-code-in-default-browser-not-ie-moved/?do=findComment&comment=1499455 basically the smallest embedded web server ever #ce OnAutoItExitRegister('_Done') _EdgeBroswerLoadPage() Func _EdgeBroswerLoadPage() Local $sUrl = "http://127.0.0.1:80" TCPStartup() ; https://learn.microsoft.com/en-us/deployedge/microsoft-edge-configure-kiosk-mode ; https://developer.chrome.com/blog/autoplay ; $pid = Run('"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --app=' & $sUrl & ' --kiosk --edge-kiosk-type=public-browsing --no-first-run --window-size="800,800" --kiosk-idle-timeout-minutes=0 --autoplay-policy=no-user-gesture-required') $pid = Run(@ComSpec & " /c start msedge.exe --app=" & $sUrl & ' --kiosk --edge-kiosk-type=public-browsing --no-first-run --window-size="800,800" --kiosk-idle-timeout-minutes=0 --autoplay-policy=no-user-gesture-required', '', @SW_HIDE) Local $iTimer = TimerInit(), $bTimeout = False, $iMaxWait = 5000 Do Sleep(250) $hEdgeHostWin = WinGetHandle("[CLASS:Chrome_WidgetWin_1]", "Chrome Legacy Window") $bTimeout = TimerDiff($iTimer) > $iMaxWait Until (IsHWnd($hEdgeHostWin) Or $bTimeout) If $bTimeout Then Exit MsgBox(0, 'Error', "Problem on starting MsEdge.") WinMove($hEdgeHostWin, '', (@DesktopWidth / 2 - 400), (@DesktopHeight / 2) - 400, 800, 800) $iConnectedSocket = _ConnectToSock() If @error Then Exit _Done() TCPSend($iConnectedSocket, StringToBinary(_GetSource(), 4)) Sleep(5000) TCPCloseSocket($iConnectedSocket) EndFunc ;==>_EdgeBroswerLoadPage Func _ConnectToSock() Local $iConnectedSocket = -1 Local $hTimer = TimerInit() Local $bErrorTimeout = False Local $iMySocket = TCPListen("127.0.0.1", 80) Do Sleep(300) $iConnectedSocket = TCPAccept($iMySocket) If TimerDiff($hTimer) > (1000 * 5) Then $bErrorTimeout = True ConsoleWrite('Error connect sock' & @CRLF) ExitLoop EndIf Until $iConnectedSocket <> -1 If $bErrorTimeout Then TCPShutdown() Return SetError(1, 0, "Error connect sock") EndIf TCPRecv($iConnectedSocket, 1024) ; ConsoleWrite($iConnectedSocket & @CRLF) Return $iConnectedSocket EndFunc ;==>_ConnectToSock Func _GetSource() Local $sPeace = "Peace;Paz;Paix;Frieden;Pace;Paz;Vrede;Fred;Мир;平和;和平;سلام;शांति;평화;Hòa bình;Mír;Barış;שלום;സമാധാനം;صلح;សន្តិភាព;" & _ "Amani;Uxolo;Aman;Rauha;Pokój;Beke;Мир;ප්රාථමික;සාමය;Pokój;สันติภาพ;సమాధానం;Aşiti;Rukuhia;Afioun;Rahu;Barış;Paqe;Paqe;Víðir;Rau;" & _ "Mír;Kalinaw;Salaam;Kapayapaan;ප්රාථමිකයාගේ;Miers;ཞི་གནས;Barış;Heddwch;मानसिक शांति;Shanti;Paghi;Pokoj;روابط داشتن;השקט;Fred;ཞི་བའི་གནས;" & _ "Mir;Hòu-î;Peac;Aaman;واپسی;Rauhaa;Iřiwa;سكينة;Hapus;Mirë;صلح، امن;Santiphap;Paix;Amani;Ashtari;Pangaduan;Мир;Sülh;שאלווע;శాంతి;" & _ "Udo;Beke;Uhuru;Irimë;ಶಾಂತಿ;Hasiti;Kọọkan;Milgħuba;ເສືອດສະຫວັນ;Kapayapaan;راحت;Peis;Rāmā;Udo;မြောက်ရိုးရာ;ප්රාථමික;Laipni;Rahu;ਸ਼ਾਂਤੀ;Paqe;Pax;Paz;Mir;صلح;" $sPeace = StringReplace($sPeace, ";", " ") Local $sSource = "" $sSource &= "<!doctype html>" & @CRLF $sSource &= "<html lang=""en"">" & @CRLF $sSource &= "<head>" & @CRLF $sSource &= "<meta charset=""utf-8"">" & @CRLF $sSource &= "<title>Peace</title>" & @CRLF $sSource &= "<style>" & @CRLF $sSource &= "/* ---- cube---- */" & @CRLF $sSource &= "/* https://3dtransforms.desandro.com/ */" & @CRLF $sSource &= ".cube {" & @CRLF $sSource &= " width: 200px;" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " position: relative;" & @CRLF $sSource &= " transform-style: preserve-3d;" & @CRLF $sSource &= " transform: translateZ(-100px);" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".scene--hero {" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " margin: 180px;" & @CRLF $sSource &= " perspective: 500px;" & @CRLF $sSource &= " border: none;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube--hero {" & @CRLF $sSource &= " margin: 0 auto;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube.is-spinning {" & @CRLF $sSource &= " animation: spinCube 8s infinite ease-in-out;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= "@keyframes spinCube {" & @CRLF $sSource &= " 0% { transform: translateZ(-100px) rotateX( 0deg) rotateY( 0deg); }" & @CRLF $sSource &= " 100% { transform: translateZ(-100px) rotateX(360deg) rotateY(720deg); }" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube__face {" & @CRLF $sSource &= " position: absolute;" & @CRLF $sSource &= " width: 200px;" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " border: 2px solid black;" & @CRLF $sSource &= " line-height: 200px;" & @CRLF $sSource &= " font-size: 100px;" & @CRLF $sSource &= " font-weight: bold;" & @CRLF $sSource &= " color: white;" & @CRLF $sSource &= " text-align: center;" & @CRLF $sSource &= " backface-visibility: hidden;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* Cube faces colors */" & @CRLF $sSource &= ".cube__face--front { background: hsla( 0, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--right { background: hsla( 60, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--back { background: hsla(120, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--left { background: hsla(180, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--top { background: hsla(240, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--bottom { background: hsla(300, 100%, 50%, 0.7); }" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube__face--front { transform: rotateY( 0deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--right { transform: rotateY( 90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--back { transform: rotateY(180deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--left { transform: rotateY(-90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--top { transform: rotateX( 90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--bottom { transform: rotateX(-90deg) translateZ(100px); }" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* --------------------------------------------------------------------------- */" & @CRLF $sSource &= "/* https://beamtic.com/rotating-radial-stripes-css */" & @CRLF $sSource &= "#body_stripes_container .radial_stripes {" & @CRLF $sSource &= " position:absolute; /* absolute; */" & @CRLF $sSource &= " margin:-100px 0 0 25px; /* auto; */" & @CRLF $sSource &= " left:0;" & @CRLF $sSource &= " top:0;" & @CRLF $sSource &= " width:100vw;" & @CRLF $sSource &= " height:100vw;" & @CRLF $sSource &= " opacity:1;" & @CRLF $sSource &= " animation:rotate 60s infinite linear;" & @CRLF $sSource &= "}" & @CRLF $sSource &= ".radial_stripes {background-image: url(""data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 1003.97 1009.5'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill-rule:evenodd;fill:url(%23radial-gradient);%7D%3C/style%3E%3CradialGradient id='radial-gradient' cx='615.23' cy='557.75' r='503.37' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-opacity='0.5'/%3E%3Cstop offset='1' stop-color='%23333' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ctitle%3Eradial-stripes%3C/title%3E%3Cpath class='cls-1' d='M615.23,53V557.75L510.29,64ZM318.54,149.4,615.23,557.75,409.93,96.64Zm-140.44,156L615.23,557.75,240.13,220ZM113.24,505l502,52.76-480-156Zm21.94,208.74,480.05-156-502,52.76Zm105,181.76,375.1-337.74L178.1,810.13Zm169.8,123.37,205.3-461.11L318.54,966.1Zm205.3,43.64V557.75L510.29,1051.47Zm205.3-43.64L615.23,557.75l104.94,493.72Zm169.8-123.37L615.23,557.75,911.91,966.1Zm104.94-181.76-480-156,437.13,252.38ZM1117.21,505l-502,52.76,502,52.76Zm-64.85-199.62L615.23,557.75l480-156Zm-140.45-156L615.23,557.75,990.33,220ZM720.17,64,615.23,557.75,820.53,96.64Z' transform='translate(-113.24 -53)'/%3E%3C/svg%3E"");}" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* Animations */" & @CRLF $sSource &= "@keyframes rotate {" & @CRLF $sSource &= " from {transform:rotate(0deg);}" & @CRLF $sSource &= " to {transform:rotate(360deg);}" & @CRLF $sSource &= "}" & @CRLF $sSource &= "/* --------------------------------------------------------------------------- */" & @CRLF $sSource &= "/* Author: w3schools.in" & @CRLF $sSource &= "URL: https://www.w3schools.in/css/examples/infinite-scrolling-text" & @CRLF $sSource &= "license: Free to use without republishing." & @CRLF $sSource &= "https://www.w3schools.in/page/copyright */" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Container styles */" & @CRLF $sSource &= " .scrolling-text-container {" & @CRLF $sSource &= " border-radius: 4px;" & @CRLF $sSource &= " overflow: hidden;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Inner container styles */" & @CRLF $sSource &= " .scrolling-text-inner {" & @CRLF $sSource &= " display: flex;" & @CRLF $sSource &= " white-space: pre;" & @CRLF $sSource &= " font-size: 32px;" & @CRLF $sSource &= " font-weight: 600;" & @CRLF $sSource &= " padding: 8px 0;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Text styles */" & @CRLF $sSource &= " .scrolling-text {" & @CRLF $sSource &= " display: flex;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " .scrolling-text-item {" & @CRLF $sSource &= " padding: 0 30px;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Apply the animation to the text items */" & @CRLF $sSource &= " .scrolling-text-inner > div {" & @CRLF $sSource &= " animation: var(--direction) var(--marquee-speed) linear infinite;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Pause the animation when a user hovers over it */" & @CRLF $sSource &= " .scrolling-text-container:hover .scrolling-text-inner > div {" & @CRLF $sSource &= " animation-play-state: paused;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Setting the Animation using Keyframes */" & @CRLF $sSource &= " @keyframes scroll-left {" & @CRLF $sSource &= " 0% {" & @CRLF $sSource &= " transform: translateX(0%);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " 100% {" & @CRLF $sSource &= " transform: translateX(-100%);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " }" & @CRLF $sSource &= "/* color */" & @CRLF $sSource &= "/* https://stackoverflow.com/questions/25507496/css-change-text-color-randomly */" & @CRLF $sSource &= " h1 {" & @CRLF $sSource &= " background-image: -webkit-linear-gradient(92deg,#f35626,#feab3a);" & @CRLF $sSource &= " -webkit-background-clip: text;" & @CRLF $sSource &= " -webkit-text-fill-color: transparent;" & @CRLF $sSource &= " -webkit-animation: hue 6s infinite linear;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " @-webkit-keyframes hue {" & @CRLF $sSource &= " from {" & @CRLF $sSource &= " -webkit-filter: hue-rotate(0deg);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " to {" & @CRLF $sSource &= " -webkit-filter: hue-rotate(360deg);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " }" & @CRLF $sSource &= "/* ----- */" & @CRLF $sSource &= "</style>" & @CRLF $sSource &= "</head>" & @CRLF $sSource &= "<body class=""page--intro"">" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "<div id=""body_stripes_container"">" & @CRLF $sSource &= "<div class=""radial_stripes""></div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "" & @CRLF $sSource &= "<div class=""scene scene--hero"">" & @CRLF $sSource &= "<div class=""cube cube--hero is-spinning"">" & @CRLF $sSource &= "<div class=""cube__face cube__face--front""><iframe width=""100%"" height=""100%"" src=""https://www.youtube.com/embed/sEMiWoRRixY?autoplay=1&loop=1&modestbranding=1&controls=0&showinfo=0&rel=0&playlist=sEMiWoRRixY"" allow=""autoplay"" frameborder=""0""></iframe></div>" & @CRLF ; ❤️</div> <!-- red heart -->" & @CRLF $sSource &= "<!-- <div class=""cube__face cube__face--front""><img src=""https://www.autoitscript.com/forum/cdn/images/logo_autoit_210x72.svg"" alt=""☺""></div> --> <!-- AutoIt logo -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--right"">🤟</div> <!-- love-you gesture -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--back"">🕊️</div> <!-- dove of peace -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--left"">🏳️‍🌈</div> <!-- peace flag -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--top"">⚖️</div> <!-- balance of justice -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--bottom"">☮︎</div> <!-- peace sign -->" & @CRLF $sSource &= "<!-- <div class=""cube__face cube__face--bottom""><img src=""https://www.autoitscript.com/forum/uploads/monthly_2022_02/Gianni.jpg.eb7f87bf14dac954de68a882e057e0d5.jpg"" alt=""☺""></div> --> <!-- Gianni -->" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "<!-- Marquee -->" & @CRLF $sSource &= "<div class=""scrolling-text-container"">" & @CRLF $sSource &= " <div class=""scrolling-text-inner"" style=""--marquee-speed: 120s; --direction:scroll-left"" role=""marquee"">" & @CRLF $sSource &= " <div class=""scrolling-text"">" & @CRLF $sSource &= " <div class=""scrolling-text-item""> </div>" & @CRLF $sSource &= " <div class=""scrolling-text-item""><h1>" & $sPeace & "</h1></div>" & @CRLF $sSource &= " </div>" & @CRLF $sSource &= " </div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "</body>" & @CRLF $sSource &= "</html>" & @CRLF Return $sSource EndFunc ;==>_GetSource Func _Done() TCPShutdown() ConsoleWrite(" << Done >>" & @CRLF) EndFunc ;==>TheEnd1 point -
Hi. I wanted to share an algorithm I found online that I thought was neat, so I have ported it over from Python to Autoit. (If I am not quite sure If I can link to external sites on this forum, so if you're interested in the website I have got this math from, feel free to PM me.) The code makes a cursor move realistically by simulating gravity pulling the cursor to a point and wind making it move unpredictably. The cursor speeds up from far away, slows down as it gets closer, and stops when it's close enough. Here is what human mouse movement recorded in Gimp looks like : And here are some random examples of what the code can produce on default parameters : The following is the mouse movement function, use it however you will, but please do not discuss game automation in this thread or contact me about anything having to do with such. (this is against forum rules) Hope someone finds some good use for this. Happy new years. #include <Math.au3> #include <Array.au3> MoveMouse(297, 551,1305,341) Func MoveMouse($start_x, $start_y, $dest_x, $dest_y, $G_0 = 9, $W_0 = 3, $M_0 = 15, $D_0 = 12) Local $current_x = $start_x, $current_y = $start_y Local $v_x = 0, $v_y = 0, $W_x = 0, $W_y = 0 While _Dist($dest_x, $dest_y, $start_x, $start_y) >= 1 Local $dist = _Dist($dest_x, $dest_y, $start_x, $start_y) Local $W_mag = Min($W_0, $dist) If $dist >= $D_0 Then $W_x = $W_x / Sqrt(3) + (2 * Random() - 1) * $W_mag / Sqrt(5) $W_y = $W_y / Sqrt(3) + (2 * Random() - 1) * $W_mag / Sqrt(5) Else $W_x /= Sqrt(3) $W_y /= Sqrt(3) If $M_0 < 3 Then $M_0 = Random() * 3 + 3 Else $M_0 /= Sqrt(5) EndIf EndIf $v_x += $W_x + $G_0 * ($dest_x - $start_x) / $dist $v_y += $W_y + $G_0 * ($dest_y - $start_y) / $dist Local $v_mag = _Dist(0, 0, $v_x, $v_y) If $v_mag > $M_0 Then Local $v_clip = $M_0 / 2 + Random() * $M_0 / 2 $v_x = ($v_x / $v_mag) * $v_clip $v_y = ($v_y / $v_mag) * $v_clip EndIf $start_x += $v_x $start_y += $v_y Local $move_x = Round($start_x) Local $move_y = Round($start_y) If $current_x <> $move_x Or $current_y <> $move_y Then MouseMove($move_x,$move_y,1) ConsoleWrite("Move Mouse to: " & $move_x & ", " & $move_y & @CRLF) $current_x = $move_x $current_y = $move_y EndIf WEnd Return $current_x & "," & $current_y EndFunc ; Calculate distance between two points Func _Dist($x1, $y1, $x2, $y2) Return Sqrt(($x2 - $x1) ^ 2 + ($y2 - $y1) ^ 2) EndFunc Func Min($a, $b) If $a < $b Then Return $a Else Return $b EndIf EndFunc1 point
-
Hex conversions
636C65616E reacted to Nine for a topic
Try this instead : $HexLong = 0xc057119da597d49d $Long=-92.275247 $tUint = DllStructCreate("int64 int") $tFloat = DllStructCreate("double flt", DllStructGetPtr($tUint)) $tUint.int = $HexLong ConsoleWrite($tUint.int & @CRLF) ConsoleWrite($tFloat.flt & @CRLF) $tUint.int = 0 ConsoleWrite($tUint.int & @CRLF) ConsoleWrite($tFloat.flt & @CRLF) $tFloat.flt = $Long ConsoleWrite($tUint.int & @CRLF) ConsoleWrite($tFloat.flt & @CRLF) ConsoleWrite(Hex($tUint.int, 16)& @CRLF)1 point -
Yea I know it did, but it shouldn't be in the current jan 4 version anymore, as I updated both the Exe and Portable zip removing those extra files. They aren't removed by the installer unless a full uninstall is done.1 point
-
Please try latest version of the scripts as I was able to replicate and hopefully fix this also for you.1 point
-
That is helpful and will have a look to check that. I have already made some more change for editing any standard udf files, so this might already be fixed... More later1 point
-
I think he meant something like this : #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ProgressConstants.au3> HotKeySet("{ESC}", Terminate) Opt("GUIOnEventMode", True) Local $hGUI = GUICreate("Nút với thanh loading", 300, 100) GUISetOnEvent($GUI_EVENT_CLOSE, Terminate) Local $btn = GUICtrlCreateButton("Bắt đầu", 110, 30, 80, 30) GUICtrlSetOnEvent(-1, "StartButton_Clicked") Local $progress = GUICtrlCreateProgress(20, 70, 260, 20) GUISetState() While Sleep(100) WEnd Func StartButton_Clicked() GUICtrlSetState($btn, $GUI_DISABLE) For $i = 0 To 100 Step 10 GUICtrlSetData($progress, $i) Sleep(500) Next GUICtrlSetState($btn, $GUI_ENABLE) EndFunc ;==>StartButton_Clicked Func Terminate() Exit EndFunc ;==>Terminate ps. you cannot interrupt a secondary loop from a GUI. Only the main GUI loop can be interrupted (unless you use a "hack" like I did)1 point
-
50872-how-to-post-code-on-the-forum/ https://www.autoitscript.com/autoit3/docs/functions/GUISetOnEvent.htm #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ProgressConstants.au3> Local $hGUI = GUICreate("Nút với thanh loading", 300, 100) Local $btn = GUICtrlCreateButton("Bắt đầu", 110, 30, 80, 30) Local $progress = GUICtrlCreateProgress(20, 70, 260, 20) GUISetState(@SW_SHOW) ;~ GUICtrlSetOnEvent($btn, "StartButton_Clicked") While True $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $btn StartButton_Clicked() EndSwitch WEnd Func StartButton_Clicked() GUICtrlSetState($btn, $GUI_DISABLE) GUICtrlSetBkColor($progress, 0x0000FF) ;~ ProgressOn ( "title", "maintext" [, "subtext" [, x pos [, y pos [, opt]]]] ) ProgressOn("Loading", "Đang thực hiện...", "0%", -1, -1) For $i = 0 To 100 Step 10 Sleep(500) If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop ; Kiểm tra sự kiện GUI trong vòng lặp ProgressSet($i) Next ProgressOff() GUICtrlSetState($btn, $GUI_ENABLE) EndFunc ;==>StartButton_Clicked1 point
-
Search the forum for "progressbar" or the wiki and you will find a lot of hits.1 point
-
Yea, I got this: Just check any/all your cache tables related to this include for the UDF, for it is in .Dyn_UDFs_C_Program_Files_(x86)_AutoIt3_Include_prive.tbl, but have it included in another way so check the correct tbl and remove it so it will be regenerated: ... and let me know when it is still an issue so I can investigate the appropriate part of the code when I know which table it is in.1 point
-
Here my take on it : #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> IsSSD("D:") Func IsSSD($sDriveLetter) Local Const $tagSTORAGE_PROPERTY_QUERY = 'int PropertyId; int QueryType; byte AdditionalParameters[1];' Local Const $tagDEVICE_SEEK_PENALTY_DESCRIPTOR = 'dword Version;dword Size;byte IncursSeekPenalty;' $sDriveLetter = StringRegExpReplace($sDriveLetter, "([[:alpha:]]:).*", "$1") If @error Then Return SetError(1) Local $hDevice = _WinAPI_CreateFile('\\.\' & $sDriveLetter, 2, 0, 6, 0, 0) If Not $hDevice Then Return SetError(2) Local $tSTORAGE_PROPERTY_QUERY = DllStructCreate($tagSTORAGE_PROPERTY_QUERY) $tSTORAGE_PROPERTY_QUERY.PropertyId = 7 Local $tDEVICE_SEEK_PENALTY_DESCRIPTOR = DllStructCreate($tagDEVICE_SEEK_PENALTY_DESCRIPTOR) Local $iRes = _WinAPI_DeviceIoControl($hDevice, $IOCTL_STORAGE_QUERY_PROPERTY, _ DllStructGetPtr($tSTORAGE_PROPERTY_QUERY), DllStructGetSize($tSTORAGE_PROPERTY_QUERY), _ DllStructGetPtr($tDEVICE_SEEK_PENALTY_DESCRIPTOR), DllStructGetSize($tDEVICE_SEEK_PENALTY_DESCRIPTOR)) _WinAPI_CloseHandle($hDevice) If Not $iRes then Return SetError(3) ConsoleWrite($sDriveLetter & " is SSD " & Not $tDEVICE_SEEK_PENALTY_DESCRIPTOR.IncursSeekPenalty & @CRLF) EndFunc ;==>GetDiskSerial1 point