Jump to content

Danny35d

Active Members
  • Posts

    810
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    Danny35d got a reaction from ioa747 in TaskPin   
    I like the Dark Mode matching the taskbar.  I did notice every time you executed the script it recreates the shortcut.   
    The function named MakeExecuteShortcut() is missing the suffix (.TaskPin).
    MakeExecuteShortcut($MyIni, '.TaskPin') I'm not sure if this is the way you want the script to work, but I noticed it creates two shortcuts named TaskPin.TaskPin.lnk and Folders.TaskPin.lnk.  If you want one shortcut with the script name I used the code below.
    Global $MyLnk = StringLeft($MyIni, StringInStr($MyIni, '\', 0, -1)) & $ScriptName & ".TaskPin.lnk" This is more of a personal preference, at work I'm not able to install AutoIT and I needed to compile the script.  Below are the changes to run the compiled script.
    Func TaskPin_Editor() Local $TaskPinEditor = FileGetShortName(@ScriptDir & "\TaskPinEditor.au3") If Not FileExists(@ScriptDir & "\TaskPinEditor.exe") Then Run(FileGetShortName(@AutoItExe) & ' /AutoIt3ExecuteScript "' & $TaskPinEditor & '" "' & $MyIni & '"') Else $TaskPinEditor = FileGetShortName(@ScriptDir & "\TaskPinEditor.exe") Run(FileGetShortName($TaskPinEditor) & ' "' & $MyIni & '"') EndIf EndFunc ;==>TaskPin_Editor  
    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, 289" $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 If @Compiled Then $sArgs = ' "' & $IniPath & '"' IniWrite($MyIni, 'Folders...', 'Executable', Chr(64) & 'AutoItExe' & Chr(64) & ', ' & Chr(34) & Chr(64) & 'ScriptDir' & Chr(64) & '\Folders.ini"') IniWrite(@ScriptDir & '\Folders.ini', 'TaskPin...', 'Executable', Chr(64) & 'AutoItExe' & Chr(64) & ', ' & Chr(34) & Chr(64) & 'ScriptDir' & Chr(64) & '\TaskPin.ini"') EndIf If FileExists(@ScriptDir & '\TaskPinEditor.exe') Then IniWrite($MyIni, 'TaskPinEditor', 'Executable', 'TaskPinEditor.exe, ' & Chr(34) & Chr(36) & 'MyIni' & Chr(36) & Chr(34)) FileCreateShortcut(FileGetShortName(@AutoItExe), _ ;file $ShortFilePath, _ ;lnk $sDrive & $sDir, _ ;workdir $sArgs, _ ;args "Execute: " & $sFileName & $sExtension, _ ;desc $aIcon[0], $aIcon[1], $aIcon[2]) ;icon EndFunc ;==>MakeExecuteShortcut  
  2. Like
    Danny35d got a reaction from ioa747 in TaskPin   
    I just want to make you aware of the double quotes especially if you are manually creating the .ini file.  This is the perfect tool I needed for the missing toolbar in the Windows 11 taskbar.  I found it even better than the Windows 10 toolbar because I don't have to navigate through directories to get to the application.
  3. Like
    Danny35d got a reaction from argumentum in TaskPin   
    I just want to make you aware of the double quotes especially if you are manually creating the .ini file.  This is the perfect tool I needed for the missing toolbar in the Windows 11 taskbar.  I found it even better than the Windows 10 toolbar because I don't have to navigate through directories to get to the application.
  4. Like
    Danny35d got a reaction from gcue in Replace all NON "A-Z, a-z" characters inside a string   
    Try it:
    $UserEnters = ' 1(2E[u]ro)p e' MsgBox(0, "Regular Expression Replace Test", StringRegExpReplace($UserEnters, '[^a-zA-Z]|\W', ''))
  5. Thanks
    Danny35d got a reaction from marcgforce in Button Deck   
    Hi Chimp, Nine and Marcforce very nice script.  Below are the changes I made on the script.
    Instead of Auto-hide after 5 secs now hide when GUI loose focus Removed Tray management of the deck Improve drag and drop Updated _RestartProgram() function to handle file with .a3x extension Added _GetVirtualScreen() function the handle better multi monitors and undocking laptop Added GUI animation and startup script when login Instead of saving shortcut and config into an ini file, now save to SQLite database Added way to export and import Lauchpad configurations Added About GUI Added and improve to Add, Remove buttons and change icon Improve how to get icons and execute files from extension .lnk  Added a way open the database for modification using 3rd party application called DB browser ; =============================================================================================================================== ; Title .........: LaunchPad ; Description ...: button deck to be used as an applications launcher (and not only) ; Author(s) .....: Chimp (Gianni Addiego) ; credits to @KaFu, @Danyfirex, @mikell (see comments for references) ; Modification ..: Marcgforce (drag and drop add, passing ini to links) ; Danny35d Replace passing ini for a SQLite DB, improve drag and drop, improve func called _RestartProgram ; to be able to execute file with the extension .a3x, added func called _GetVirtualScreen to better ; handle Multi monitors and undocking laptop, added GUI animation and Choice to startup when you login. ; URL ...........: https://www.autoitscript.com/forum/topic/202048-button-deck/ ; =============================================================================================================================== #NoTrayIcon #include <Misc.au3> #include <Array.au3> #include <Crypt.au3> #include <String.au3> #include <SQLite.au3> #include <WinAPI.au3> #include <SQLite.dll.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If _Singleton("LaunchPadApps", 2) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "An occurrence of LaunchPad is already running.") Exit EndIf ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) OnAutoItExitRegister('_Exit') ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing Global Const $WMSZ_LEFT = 1 Global Const $WMSZ_RIGHT = 2 Global Const $WMSZ_TOP = 3 Global Const $WMSZ_TOPLEFT = 4 Global Const $WMSZ_TOPRIGHT = 5 Global Const $WMSZ_BOTTOM = 6 Global Const $WMSZ_BOTTOMLEFT = 7 Global Const $WMSZ_BOTTOMRIGHT = 8 Global Enum $vButton_Tip = 0, $vButton_IconPath, $vButton_IconNumber, $vButton_Command, $vButton_UniqueID Global Const $AW_FADE_IN = 0x00080000 ;fade-in Global Const $AW_FADE_OUT = 0x00090000 ;fade-out Global Const $AW_SLIDE_IN_LEFT = 0x00040001 ;slide in from left Global Const $AW_SLIDE_OUT_LEFT = 0x00050002 ;slide out to left Global Const $AW_SLIDE_IN_RIGHT = 0x00040002 ;slide in from right Global Const $AW_SLIDE_OUT_RIGHT = 0x00050001 ;slide out to right Global Const $AW_SLIDE_IN_TOP = 0x00040004 ;slide-in from top Global Const $AW_SLIDE_OUT_TOP = 0x00050008 ;slide-out to top Global Const $AW_SLIDE_IN_BOTTOM = 0x00040008 ;slide-in from bottom Global Const $AW_SLIDE_OUT_BOTTOM = 0x00050004 ;slide-out to bottom Global Const $AW_DIAG_SLIDE_IN_TOP_LEFT = 0x00040005 ;diag slide-in from Top-left Global Const $AW_DIAG_SLIDE_OUT_TOP_LEFT = 0x0005000a ;diag slide-out to Top-left Global Const $AW_DIAG_SLIDE_IN_TOP_RIGHT = 0x00040006 ;diag slide-in from Top-Right Global Const $AW_DIAG_SLIDE_OUT_TOP_RIGHT = 0x00050009 ;diag slide-out to Top-Right Global Const $AW_DIAG_SLIDE_IN_BOTTOM_LEFT = 0x00040009 ;diag slide-in from Bottom-left Global Const $AW_DIAG_SLIDE_OUT_BOTTOM_LEFT = 0x00050006 ;diag slide-out to Bottom-left Global Const $AW_DIAG_SLIDE_IN_BOTTOM_RIGHT = 0x0004000a ;diag slide-in from Bottom-right Global Const $AW_DIAG_SLIDE_OUT_BOTTOM_RIGHT = 0x00050005 ;diag slide-out to Bottom-right Global Const $AW_EXPLODE = 0x00040010 ;explode Global Const $AW_IMPLODE = 0x00050010 ;implode Local Const $AppDataUser = @LocalAppDataDir & '\LaunchPad' Local Const $dll_icons = $AppDataUser & '\Bin\iconset.dll' Local $aAnimation = StringSplit('Explode|Fade In|Slide In Left|Slide In Right|Slide In Top|Slide In Bottom|Diag Slide In Top Left|Diag Slide In Top Right|Diag Slide In Bottom Left|Diag Slide In Bottom Right', '|', 2) If Not FileExists($AppDataUser) Then DirCreate($AppDataUser) If Not FileExists($AppDataUser & '\Bin') Then DirCreate($AppDataUser & '\Bin') If Not FileExists($AppDataUser & '\Icons') Then DirCreate($AppDataUser & '\Icons') If Not FileExists($AppDataUser & "\BackupDB") Then DirCreate($AppDataUser & "\BackupDB") If Not FileExists($AppDataUser & '\Bin\iconset.dll') Then FileInstall('.\Include\iconset.dll', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3.exe') Then FileInstall('.\Include\sqlite3.exe', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3.dll') Then FileInstall('.\Include\sqlite3.dll', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3_x64.dll') Then FileInstall('.\Include\sqlite3_x64.dll', $AppDataUser & '\Bin\') #cs The following 2D array contains the settings that determine the behavior of each "Button" namely 4 parameters for each row (for each button); [n][0] the tooltip of the button [n][1] path of an icon or a file containing icons [n][2] the number of the icon (if the previous parameter is a collection) [n][3] AutoIt command(s) to be executed directly on button click (or also the name of a function) #ce Global $aTools[][] = [ _ ['Administrative Tools', 'SHELL32.dll', 177, 'run("explorer.exe shell:::{D20EA4E1-3957-11d2-A40B-0C5020524153}")', ''], _ ['Windows version', 'winver.exe', 1, 'run("explorer.exe shell:::{BB06C0E4-D293-4f75-8A90-CB05B6477EEE}")', ''], _ ; or "Run('winver.exe')" ['This computer', 'netcenter.dll', 6, 'run("explorer.exe shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")', ''], _ ['Devices and Printers', 'SHELL32.dll', 272, 'run("explorer.exe shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}")', ''], _ ['Folder options', 'SHELL32.dll', 210, 'run("explorer.exe shell:::{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}")', ''], _ ['Command Prompt', @ComSpec, 1, 'Run(@ComSpec)', ''], _ ['Internet Explorer', @ProgramFilesDir & '\Internet Explorer\iexplore.exe', 1, "Run(@ProgramFilesDir & '\Internet Explorer\iexplore.exe')", ''], _ ['Media Player', @ProgramFilesDir & '\Windows media player\wmplayer.exe', 1, "Run(@ProgramFilesDir & '\Windows media player\wmplayer.exe')", ''], _ ['File browser', @WindowsDir & '\explorer.exe', 1, "Run(@WindowsDir & '\explorer.exe')", ''], _ ['Notepad', @SystemDir & '\notepad.exe', 1, "Run(@SystemDir & '\notepad.exe')", ''], _ ['Wordpad', @SystemDir & '\write.exe', 1, "Run(@SystemDir & '\write.exe')", ''], _ ['Registry editor', @SystemDir & '\regedit.exe', 1, "ShellExecute('regedit.exe')", ''], _ ['Connect to', 'netcenter.dll', 19, 'run("explorer.exe shell:::{38A98528-6CBF-4CA9-8DC0-B1E1D10F7B1B}")', ''], _ ['Calculator', @SystemDir & '\Calc.exe', 1, "Run(@SystemDir & '\calc.exe')", ''], _ ['Control panel', 'control.exe', 1, 'run("explorer.exe shell:::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}")', ''], _ ['Users manager', @SystemDir & '\Netplwiz.exe', 1, "ShellExecute('Netplwiz.exe')", ''], _ ; {7A9D77BD-5403-11d2-8785-2E0420524153} ['Run', 'SHELL32.dll', 25, 'Run("explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}")', ''], _ ['Search files', 'SHELL32.dll', 135, 'run("explorer.exe shell:::{9343812e-1c37-4a49-a12e-4b2d810d956b}")', ''], _ ['On screen Magnifier', @SystemDir & '\Magnify.exe', 1, "ShellExecute('Magnify.exe')", ''], _ ['Paint', @SystemDir & '\mspaint.exe', 1, "Run(@SystemDir & '\mspaint.exe')", ''], _ ['Remote desktop', @SystemDir & '\mstsc.exe', 1, " Run('mstsc.exe')", ''], _ ['Resource monitoring', @SystemDir & '\resmon.exe', 1, "Run('resmon.exe')", ''], _ ['Device manager', 'SHELL32.dll', 13, 'Run("explorer.exe Shell:::{74246bfc-4c96-11d0-abef-0020af6b0b7a}")', ''], _ ['Audio', 'SndVol.exe', 1, 'Run("explorer.exe Shell:::{F2DDFC82-8F12-4CDD-B7DC-D4FE1425AA4D}")', ''], _ ; or 'run(@SystemDir & "\SndVol.exe")'] ['Task view', 'SHELL32.dll', 133, 'Run("explorer.exe shell:::{3080F90E-D7AD-11D9-BD98-0000947B0257}")', ''], _ ['Task Manager', @SystemDir & '\taskmgr.exe', 1, 'Send("^+{ESC}")', ''], _ ; "Run(@SystemDir & '\taskmgr.exe')"], _ ['On Screen Keyboard', 'osk.exe', 1, 'ProcessExists("osc.exe") ? False : ShellExecute("osk.exe")', ''], _ ; <-- ternary example ['... if Notepad is running Send F5 to it', 'SHELL32.dll', 167, ' WinExists("[CLASS:Notepad]") ? ControlSend("[CLASS:Notepad]", "", "", "{F5}") : MsgBox(16, ":(", "Notepad not found", 2)', ''] _ ; Check if Notepad is currently running ] ; Show desktop {3080F90D-D7AD-11D9-BD98-0000947B0257} ; Desktop Background {ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} ; IE internet option {A3DD4F92-658A-410F-84FD-6FBBBEF2FFFE} ; ['Notes', 'StikyNot.exe', 1, "ShellExecute('StikyNot')"], _ Global $GUI, $hSQLiteDB, $tmpVirtualScreen Global $bSaveSettings = True, $bShowGUI = True Global $SQLiteDB = $AppDataUser & '\Launchpad.sqlite' Local $sqlRow, $sqlColumn Local $SQLiteDBExists = FileExists($SQLiteDB) Global $sSQliteDll = _SQLite_Startup($AppDataUser & '\Bin\sqlite3.dll', False, 1) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _ "Not FOUND in " & $AppDataUser & '\Bin\') $bSaveSettings = False Exit -1 Else $hSQLiteDB = _SQLite_Open($SQLiteDB) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't open or create a permanent Database!" & @CRLF & @CRLF & $SQLiteDB) $bSaveSettings = False Exit -1 EndIf EndIf _SQLite_LaunchPad($hSQLiteDB, "CREATE TABLE IF NOT EXISTS Buttons(Name TEXT, Icon TEXT, IconNum INTEGER, Execute TEXT, Button_ID INTEGER PRIMARY KEY);") _SQLite_LaunchPad($hSQLiteDB, "CREATE TABLE IF NOT EXISTS Settings(LeftPos INTEGER, TopPos INTEGER, ButtonSize INTEGER, xColumns INTEGER, GUIin TEXT, GUIout TEXT, Freeze TEXT, StartUp TEXT);") If Not $SQLiteDBExists Then _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Settings VALUES(10, 10, 40, " & Ceiling(UBound($aTools) / 2) & ",'AW_EXPLODE', 'AW_IMPLODE', 'False', 'False');") For $x = 0 To UBound($aTools) - 1 $aTools[$x][$vButton_Command] = StringReplace($aTools[$x][$vButton_Command], "'", '"') _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('" & $aTools[$x][$vButton_Tip] & "','" & $aTools[$x][$vButton_IconPath] & "'," & $aTools[$x][$vButton_IconNumber] & ",'" & $aTools[$x][$vButton_Command] & "');") Next EndIf _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) _SQLite_QuerySingleRow($hSQLiteDB, "SELECT LeftPos FROM Settings;", $sqlRow) Global $iLeftPos = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT TopPos FROM Settings;", $sqlRow) Global $iTopPos = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT ButtonSize FROM Settings;", $sqlRow) Global $iStep = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT xColumns FROM Settings;", $sqlRow) Global $iNrPerLine = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT GUIin FROM Settings;", $sqlRow) Global $GUI_IN = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT GUIout FROM Settings;", $sqlRow) Global $GUI_OUT = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT Freeze FROM Settings;", $sqlRow) Global $bFreezeWindow = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT StartUp FROM Settings;", $sqlRow) Global $bStartUp = $sqlRow[0] If Not IsBool($bFreezeWindow) And $bFreezeWindow = 'True' Then $bFreezeWindow = True ElseIf Not IsBool($bFreezeWindow) And $bFreezeWindow = 'False' Then $bFreezeWindow = False EndIf If Not IsBool($bStartUp) And $bStartUp = 'True' Then $bStartUp = True ElseIf Not IsBool($bStartUp) And $bStartUp = 'False' Then $bStartUp = False EndIf Global $idAddIcon[1], $idRemoveIcon[1], $idChangeIcon[1] Global $iNrOfLines = Ceiling(UBound($aTools) / $iNrPerLine) Global $dllUser32 = DllOpen("user32.dll") $GUI = GUICreate('Launch Pad', 10, 10, $iLeftPos, $iTopPos, BitOR($WS_THICKFRAME, 0), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_ACCEPTFILES)) Global $GuiContextMenu = GUICtrlCreateContextMenu() Global $idFreezeWindow = GUICtrlCreateMenuItem("Freeze", $GuiContextMenu) Global $idSettings = GUICtrlCreateMenu("Settings", $GuiContextMenu, 1) Global $idDatabase = GUICtrlCreateMenu("Database", $idSettings) Global $idOpenDB = GUICtrlCreateMenuItem("Open DB", $idDatabase) Global $idExportDB = GUICtrlCreateMenuItem("Export DB", $idDatabase) Global $idImportDB = GUICtrlCreateMenuItem("Import DB", $idDatabase) Global $idStartUp = GUICtrlCreateMenuItem("StartUp", $idSettings) Global $idAnimation = GUICtrlCreateMenu("Animate", $GuiContextMenu, 1) GUICtrlCreateMenuItem("", $GuiContextMenu) Global $idAbout = GUICtrlCreateMenuItem("About", $GuiContextMenu) $aMyMatrix = _GuiControlPanel("Button", $iNrPerLine, $iNrOfLines, $iStep, $iStep, BitOR(0x40, 0x1000), -1, 0, 0, 0, 0, 0, 0, False, "") Global $iPreviousX = ($aMyMatrix[0])[1], $iPreviousY = ($aMyMatrix[0])[2] ReDim $idAddIcon[UBound($aMyMatrix)] ReDim $idRemoveIcon[UBound($aMyMatrix)] ReDim $idChangeIcon[UBound($aMyMatrix)] ReDim $aTools[UBound($aMyMatrix)][5] ; Be sure none of the array elements are NULL, otherwise _ArraySearch failed For $i = 0 To UBound($aMyMatrix) - 1 If $idAddIcon[$i] = '' Then $idAddIcon[$i] = 9999 If $idRemoveIcon[$i] = '' Then $idRemoveIcon[$i] = 9999 If $idChangeIcon[$i] = '' Then $idChangeIcon[$i] = 9999 Next For $i = 0 To UBound($aAnimation) - 1 $aAnimation[$i] = GUICtrlCreateMenuItem($aAnimation[$i], $idAnimation) Next For $i = 1 To UBound($aMyMatrix) - 1 GUICtrlSetResizing($aMyMatrix[$i], $GUI_DOCKALL) ; (2+32+256+512) so the control will not move during resizing If $i <= UBound($aTools) Then GUICtrlSetImage($aMyMatrix[$i], $aTools[$i - 1][$vButton_IconPath], $aTools[$i - 1][$vButton_IconNumber]) GUICtrlSetTip($aMyMatrix[$i], $aTools[$i - 1][$vButton_Tip]) EndIf Next _WinSetClientSize($GUI, ($aMyMatrix[0])[11], ($aMyMatrix[0])[12]) ; thanks to KaFu If $bFreezeWindow Then GUICtrlSetState($idFreezeWindow, $GUI_CHECKED) If $bStartUp Then GUICtrlSetState($idStartUp, $GUI_CHECKED) GUISetState() ; https://devblogs.microsoft.com/oldnewthing/20110218-00/?p=11453 GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_SIZING, "WM_SIZING") _MainLoop() _Exit() Func _MainLoop() Local $iDeltaX, $iDeltaY, $row, $col, $left, $top, $awPos, $iAnswer, $sTemp Local $hTimer, $sFileDialog, $sBackupName While 1 Sleep(10) $xyVirtualScreen = _GetVirtualScreen() If Not WinActive($GUI) And Not $bFreezeWindow And $bShowGUI Then _ToggleGuiShowHide($GUI, False) $aPos = MouseGetPos() $hTimer = TimerInit() While ($aPos[0] = $xyVirtualScreen[0] Or $aPos[1] = $xyVirtualScreen[2] Or $aPos[0] = $xyVirtualScreen[1] Or $aPos[1] = $xyVirtualScreen[3]) And Not $bFreezeWindow $aPos = MouseGetPos() If TimerDiff($hTimer) > 1000 Then _ToggleGuiShowHide($GUI, True) Sleep(10) WEnd $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED Local $iAnswer = $IDNO Local $ProposeLink = StringSplit(@GUI_DragFile, '\') $ProposeLink = StringRegExpReplace($ProposeLink[UBound($ProposeLink) - 1], '(.*)\..*', "$1") $i = _ArrayBinarySearch($aMyMatrix, @GUI_DropId) If $i <> -1 Then If $aTools[$i - 1][$vButton_Command] <> '' Then $iAnswer = MsgBox($MB_YESNO, "LauchPad Drag & Drop", "Are you sure you want to overwrite " & $aTools[$i - 1][$vButton_Tip] & " shortcut?", 0, $GUI) Else $iAnswer = $IDYES EndIf If $iAnswer = $IDYES Then $sTemp = '' Local $sReponse = InputBox("Icon name", "Give the shortcut a title", $ProposeLink) If @error <> 1 Or $sReponse <> '' Then $aTools[$i - 1][$vButton_Tip] = $sReponse $aTools[$i - 1][$vButton_IconNumber] = 1 $aTools[$i - 1][$vButton_IconPath] = $dll_icons $aTools[$i - 1][$vButton_Command] = @GUI_DragFile $sExt = StringRegExpReplace($aTools[$i - 1][$vButton_Command], "^.*\.", "") ; extraction of its extension Switch $sExt Case "doc", "docx", "odt" $aTools[$i - 1][$vButton_IconNumber] = 436 Case "xls", "xlsx", "ods" $aTools[$i - 1][$vButton_IconNumber] = 441 Case "pdf" $aTools[$i - 1][$vButton_IconNumber] = 400 Case "ppt", "pptx", "odp" $aTools[$i - 1][$vButton_IconNumber] = 431 Case "txt", "rtf" $aTools[$i - 1][$vButton_IconNumber] = 406 Case "msg" $aTools[$i - 1][$vButton_IconNumber] = 426 Case Else If $sExt = 'lnk' Then $aDetails = FileGetShortcut($aTools[$i - 1][$vButton_Command]) If IsArray($aDetails) Then $sTemp = $aTools[$i - 1][$vButton_Command] If $aDetails[4] <> '' Then $aTools[$i - 1][$vButton_Command] = $aDetails[4] Else $aTools[$i - 1][$vButton_Command] = $aDetails[0] EndIf EndIf EndIf If _WinAPI_ExtractIconEx($aTools[$i - 1][$vButton_Command], -1, 0, 0, 0) > 0 Then ; allows you to test if the file has one or more icon (s) Local $aIcon[3] = [64, 32, 16] For $a = 0 To UBound($aIcon) - 1 $aIcon[$a] = _WinAPI_Create32BitHICON(_WinAPI_ShellExtractIcon($aTools[$i - 1][$vButton_Command], 0, $aIcon[$a], $aIcon[$a]), 1) Next $aTools[$i - 1][$vButton_IconPath] = $AppDataUser & '\Icons\' & $aTools[$i - 1][$vButton_Tip] & '.ico' _WinAPI_SaveHICONToFile($aTools[$i - 1][$vButton_IconPath], $aIcon) For $a = 0 To UBound($aIcon) - 1 _WinAPI_DestroyIcon($aIcon[$a]) Next Else $aRet = _PickIconDlg($dll_icons) If Not @error Then If GUICtrlSetImage(@GUI_DropId, $aRet[0], $aRet[1]) Then $aTools[$i - 1][$vButton_IconPath] = $aRet[0] $aTools[$i - 1][$vButton_IconNumber] = $aRet[1] EndIf EndIf EndIf EndSwitch EndIf If $sTemp <> '' Then $aTools[$i - 1][$vButton_Command] = $sTemp If $aTools[$i - 1][$vButton_UniqueID] <> '' And $iAnswer = $IDYES Then _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Name = '" & $aTools[$i - 1][$vButton_Tip] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Execute = '" & $aTools[$i - 1][$vButton_Command] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Icon = '" & $aTools[$i - 1][$vButton_IconPath] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET IconNum = '" & $aTools[$i - 1][$vButton_IconNumber] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") Else _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('" & $aTools[$i - 1][$vButton_Tip] & "', '" & $aTools[$i - 1][$vButton_IconPath] & "', " & $aTools[$i - 1][$vButton_IconNumber] & ", '" & $aTools[$i - 1][$vButton_Command] & "');") _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) ReDim $aTools[UBound($aMyMatrix)][5] EndIf If $iAnswer = $IDYES Then GUICtrlSetTip(@GUI_DropId, $aTools[$i - 1][$vButton_Tip]) GUICtrlSetImage(@GUI_DropId, $aTools[$i - 1][$vButton_IconPath], $aTools[$i - 1][$vButton_IconNumber]) EndIf EndIf EndIf Case $idFreezeWindow If BitAND(GUICtrlRead($idFreezeWindow), $GUI_UNCHECKED) = $GUI_UNCHECKED Then $bFreezeWindow = True GUICtrlSetState($idFreezeWindow, $GUI_CHECKED) Else $bFreezeWindow = False GUICtrlSetState($idFreezeWindow, $GUI_UNCHECKED) EndIf Case $idStartUp If BitAND(GUICtrlRead($idStartUp), $GUI_UNCHECKED) = $GUI_UNCHECKED Then $bStartUp = True _StartUpProgram($bStartUp) GUICtrlSetState($idStartUp, $GUI_CHECKED) Else $bStartUp = False _StartUpProgram($bStartUp) GUICtrlSetState($idStartUp, $GUI_UNCHECKED) EndIf Case $idOpenDB If Not FileExists($AppDataUser & '\SQLiteDatabaseBrowserPortable') Then If MsgBox($MB_YESNO, "LauchPad DB Browser", "DB Browser for SQLite Portable is needed to change settings or buttons." & @CRLF & _StringRepeat(' ', 30) & "Do you want to download DB Browser?", 0, $GUI) = $IDYES Then ShellExecute('https://portableapps.com/apps/development/sqlite_database_browser_portable') MsgBox($MB_OK, "LauchPad DB Browser", "Installing DB Browser for SQLite Portable" & @CRLF & @CRLF & _ '1) Press green button to download DB Browser' & @CRLF & @CRLF & '2) Execute the downloaded file' & @CRLF & @CRLF & _ '3) Press Next and Destination Folder is ' & $AppDataUser & @CRLF & @CRLF & '4) Press Install and then Finish', 0, $GUI) EndIf Else $dHash = _Crypt_HashFile($SQLiteDB, $CALG_MD5) ShellExecuteWait($AppDataUser & '\SQLiteDatabaseBrowserPortable\SQLiteDatabaseBrowserPortable.exe', $SQLiteDB) If $dHash <> _Crypt_HashFile($SQLiteDB, $CALG_MD5) Then $bSaveSettings = False _RestartProgram() EndIf EndIf Case $idExportDB $sBackupName = 'LaunchPad-' & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & '.sql' $sFileDialog = FileSaveDialog('Export DB - LaunchPad', $AppDataUser & "\BackupDB\", "SQLite (*.sql)", BitOR($FD_PATHMUSTEXIST, $FD_PROMPTOVERWRITE), $sBackupName, $GUI) If Not @error Then $sTemp = '.open ' & StringReplace($SQLiteDB, '\', '/') & @CRLF $sTemp &= '.once "' & StringReplace($sFileDialog, '\', '/') & '"' & @CRLF $sTemp &= '.dump' & @CRLF & '.exit' & @CRLF _SQLite_SQLiteExe($SQLiteDB, $sTemp, $row, $AppDataUser & '\Bin\sqlite3.exe') EndIf Case $idImportDB $sFileDialog = FileOpenDialog('Import DB - LaunchPad', $AppDataUser & "\BackupDB\", "SQLite (*.sql)|All (*.*)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST), '', $GUI) If Not @error Then $bSaveSettings = False $sTemp = '.open ' & StringReplace($SQLiteDB, '\', '/') & @CRLF $sTemp &= 'DROP TABLE IF EXISTS Buttons;' & @CRLF $sTemp &= 'DROP TABLE IF EXISTS Settings;' & @CRLF $sTemp &= '.read "' & StringReplace($sFileDialog, '\', '/') & '"' & @CRLF $sTemp &= '.exit' & @CRLF _SQLite_SQLiteExe($SQLiteDB, $sTemp, $row, $AppDataUser & '\Bin\sqlite3.exe') _RestartProgram() EndIf Case $idAbout _About() Case Else $i = _ArraySearch($aMyMatrix, $Msg) If $i <> -1 Then If $aTools[$i - 1][$vButton_Command] <> '' Then $dummy = Execute($aTools[$i - 1][$vButton_Command]) If @error Then ShellExecute($aTools[$i - 1][$vButton_Command]) ElseIf $aTools[$i - 1][$vButton_Command] = '' Then MsgBox($MB_OK, "LauchPad Execute Shortcut", "This shortcut doesn't have an Application associated.", 0, $GUI) EndIf EndIf $i = _ArraySearch($aAnimation, $Msg) If $i <> -1 Then If GUICtrlRead($Msg, 1) = 'Explode' Then $GUI_IN = 'AW_EXPLODE' $GUI_OUT = 'AW_IMPLODE' Else $GUI_IN = 'AW_' & StringReplace(GUICtrlRead($Msg, 1), ' ', '_') $GUI_OUT = StringReplace($GUI_IN, '_In', '_Out') EndIf _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIin = '" & $GUI_IN & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIout = '" & $GUI_OUT & "';") ; Need to add focus EndIf $i = _ArraySearch($idAddIcon, $Msg) If $i <> -1 Then _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('', '', '', '');") _RestartProgram() EndIf $i = _ArraySearch($idRemoveIcon, $Msg) If $i <> -1 Then If MsgBox($MB_YESNO, "LauchPad Removing Icon", "Are you sure you want to delete " & $aTools[$i][$vButton_Tip] & " shortcut?", 0, $GUI) = $IDYES Then _SQLite_LaunchPad($hSQLiteDB, 'DELETE FROM Buttons WHERE Button_ID = ' & $aTools[$i][$vButton_UniqueID] & ';') If StringInStr($aTools[$i][$vButton_IconPath], $AppDataUser & '\Icons') Then FileDelete($aTools[$i][$vButton_IconPath]) _RestartProgram() EndIf EndIf $i = _ArraySearch($idChangeIcon, $Msg) If $i <> -1 Then $aRet = _PickIconDlg($dll_icons) If Not @error Then If GUICtrlSetImage($aMyMatrix[$i + 1], $aRet[0], $aRet[1]) Then $aTools[$i][$vButton_IconPath] = $aRet[0] $aTools[$i][$vButton_IconNumber] = $aRet[1] If $aTools[$i][$vButton_UniqueID] <> '' Then _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Icon = '" & $aTools[$i][$vButton_IconPath] & "' WHERE Button_ID = " & $aTools[$i][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET IconNum = '" & $aTools[$i][$vButton_IconNumber] & "' WHERE Button_ID = " & $aTools[$i][$vButton_UniqueID] & ";") Else _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('', '" & $aTools[$i][$vButton_IconPath] & "', " & $aTools[$i][$vButton_IconNumber] & ", '');") _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) ReDim $aTools[UBound($aMyMatrix)][5] EndIf EndIf EndIf EndIf EndSwitch ; check if any size has changed If $iPreviousX <> ($aMyMatrix[0])[1] Or $iPreviousY <> ($aMyMatrix[0])[2] Then ; calculate the variations $iDeltaX = Abs($iPreviousX - ($aMyMatrix[0])[1]) $iDeltaY = Abs($iPreviousY - ($aMyMatrix[0])[2]) ; if both dimensions changed at the same time, the largest variation prevails over the other If $iDeltaX >= $iDeltaY Then ; keep the new number of columns ; calculate and set the correct number of lines accordingly _SubArraySet($aMyMatrix[0], 2, Ceiling((UBound($aMyMatrix) - 1) / ($aMyMatrix[0])[1])) Else ; otherwise keep the new number of rows ; calculate and set the correct number of columns accordingly _SubArraySet($aMyMatrix[0], 1, Ceiling((UBound($aMyMatrix) - 1) / ($aMyMatrix[0])[2])) EndIf ; set client area new sizes _WinSetClientSize($GUI, ($aMyMatrix[0])[1] * $iStep, ($aMyMatrix[0])[2] * $iStep) ; remember the new panel settings $iPreviousX = ($aMyMatrix[0])[1] $iPreviousY = ($aMyMatrix[0])[2] ; rearrange the controls inside the panel For $i = 0 To UBound($aMyMatrix) - 2 ; coordinates 1 based $col = Mod($i, $iPreviousX) + 1 ; Horizontal position within the grid (column) $row = Int($i / $iPreviousX) + 1 ; Vertical position within the grid (row number) $left = ($aMyMatrix[0])[5] + (((($aMyMatrix[0])[3] + ($aMyMatrix[0])[9]) * $col) - ($aMyMatrix[0])[9]) - ($aMyMatrix[0])[3] + ($aMyMatrix[0])[7] $top = ($aMyMatrix[0])[6] + (((($aMyMatrix[0])[4] + ($aMyMatrix[0])[10]) * $row) - ($aMyMatrix[0])[10]) - ($aMyMatrix[0])[4] + ($aMyMatrix[0])[8] GUICtrlSetPos($aMyMatrix[$i + 1], $left, $top) Next EndIf WEnd EndFunc ;==>_MainLoop ; Allow/Disallow specific borders resizing ; thanks to Danyfirex ; --------- ; https://www.autoitscript.com/forum/topic/201464-partially-resizable-window-how-solved-by-danyfirex-%F0%9F%91%8D/?do=findComment&comment=1445748 Func WM_NCHITTEST($hwnd, $iMsg, $iwParam, $ilParam) If $hwnd = $GUI Then Local $iRet = _WinAPI_DefWindowProc($hwnd, $iMsg, $iwParam, $ilParam) ; https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-nchittest If $iRet = $HTBOTTOM Or $iRet = $HTRIGHT Or $iRet = $HTBOTTOMRIGHT Then ; allowed resizing Return $iRet ; default process of border resizing Else ; resizing not allowed Return $HTCLIENT ; do like if cursor is in the client area EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTEST ; controls and process resizing operations in real time ; thanks to mikell ; ------ ; https://www.autoitscript.com/forum/topic/201464-partially-resizable-window-how-solved-by-danyfirex-%F0%9F%91%8D/?do=findComment&comment=1445754 Func WM_SIZING($hwnd, $iMsg, $wparam, $lparam) ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing Local $iCols = ($aMyMatrix[0])[1] Local $iRows = ($aMyMatrix[0])[2] Local $xClientSizeNew, $yClientSizeNew #cs $wparam The edge of the window that is being sized. $lparam A pointer to a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure. Return value Type: LRESULT #ce $wparam $aPos = WinGetPos($GUI) #cs Success : a 4 - element array containing the following information : $aArray[0] = X position $aArray[1] = Y position $aArray[2] = Width #ce Success : a 4 - element array containing the following information : $aPos2 = WinGetClientSize($GUI) #cs Success: a 2-element array containing the following information: $aArray[0] = Width of window's client area #ce Success: a 2-element array containing the following information: ; https://docs.microsoft.com/en-us/previous-versions//dd162897(v=vs.85) Local $sRect = DllStructCreate("Int[4]", $lparam) ; outer dimensions (includes borders) Local $left = DllStructGetData($sRect, 1, 1) Local $top = DllStructGetData($sRect, 1, 2) Local $Right = DllStructGetData($sRect, 1, 3) Local $bottom = DllStructGetData($sRect, 1, 4) ; border width Local $iEdgeWidth = ($aPos[2] - $aPos2[0]) / 2 Local $iHeadHeigth = $aPos[3] - $aPos2[1] - $iEdgeWidth * 2 Local $aEdges[2] $aEdges[0] = $aPos[2] - $aPos2[0] ; x $aEdges[1] = $aPos[3] - $aPos2[1] ; y $xClientSizeNew = $Right - $left - $aEdges[0] $xClientSizeNew = Round($xClientSizeNew / $iStep) * $iStep $yClientSizeNew = $bottom - $top - $aEdges[1] $yClientSizeNew = Round($yClientSizeNew / $iStep) * $iStep Switch $wparam Case $WMSZ_RIGHT ; calculate the new position of the right border DllStructSetData($sRect, 1, $left + $xClientSizeNew + $aEdges[0], 3) Case $WMSZ_BOTTOM ; calculate the new position of the bottom border DllStructSetData($sRect, 1, $top + $yClientSizeNew + $aEdges[1], 4) Case $WMSZ_BOTTOMRIGHT ; calculate the new position of both borders DllStructSetData($sRect, 1, $left + $xClientSizeNew + $aEdges[0], 3) DllStructSetData($sRect, 1, $top + $yClientSizeNew + $aEdges[1], 4) EndSwitch #cs If DllStructGetData($sRect, 1, 3) > @DesktopWidth Then ; $Right DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 3) - $iStep, 3) $xClientSizeNew -= $iStep EndIf If DllStructGetData($sRect, 1, 4) > @DesktopHeight Then ; $bottom DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 4), 4) $yClientSizeNew -= $iStep #ce If DllStructGetData($sRect, 1, 3) > @DesktopWidth Then ; $Right ; check if number of rows has changed If $iRows <> $yClientSizeNew / $iStep Then _SubArraySet($aMyMatrix[0], 2, $yClientSizeNew / $iStep) EndIf ; check if number of columns has changed If $iCols <> $xClientSizeNew / $iStep Then _SubArraySet($aMyMatrix[0], 1, $xClientSizeNew / $iStep) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZING ; set client area new sizes ; thanks to KaFu ; ---- ; https://www.autoitscript.com/forum/topic/201524-guicreate-and-wingetclientsize-mismatch/?do=findComment&comment=1446141 Func _WinSetClientSize($hwnd, $iW, $iH) Local $aWinPos = WinGetPos($hwnd) Local $sRect = DllStructCreate("int;int;int;int;") DllStructSetData($sRect, 3, $iW) DllStructSetData($sRect, 4, $iH) _WinAPI_AdjustWindowRectEx($sRect, _WinAPI_GetWindowLong($hwnd, $GWL_STYLE), _WinAPI_GetWindowLong($hwnd, $GWL_EXSTYLE)) WinMove($hwnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] + (DllStructGetData($sRect, 3) - $aWinPos[2]) - DllStructGetData($sRect, 1), $aWinPos[3] + (DllStructGetData($sRect, 4) - $aWinPos[3]) - DllStructGetData($sRect, 2)) EndFunc ;==>_WinSetClientSize ; ; #FUNCTION# ==================================================================================================================== ; Name...........: _GuiControlPanel ; Description ...: Creates a rectangular panel with adequate size to contain the required amount of controls ; and then fills it with the same controls by placing them according to the parameters ; Syntax.........: _GuiControlPanel($ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, $style, $exStyle, $xPos = 0, $yPos = 0, $xBorder, $yBorder, $xSpace = 1, $ySpace = 1, $Group = false, , $sGrpTitle = "") ; Parameters ....: $ControlType - Type of controls to be generated ("Button"; "Text"; ..... ; $nrPerLine - Nr. of controls per line in the matrix ; $nrOfLines - Nr. of lines in the matrix ; $ctrlWidth - Width of each control ; $ctrlHeight - Height of each control ; $Style - Defines the style of the control ; $exStyle - Defines the extended style of the control ; $xPanelPos - x Position of panel in GUI ; $yPanelPos - y Position of panel in GUI ; $xBorder - distance from lateral panel's borders to the matrix (width of left and right margin) default = 0 ; $yBorder - distance from upper and lower panel's borders to the matrix (width of upper and lower margin) default = 0 ; $xSpace - horizontal distance between the controls ; $ySpace - vertical distance between the controls ; $Group - if you want to group the controls (true or false) ; $sGrpTitle - title of the group (ignored if above is false) ; Return values .: an 1 based 1d array containing references to each control ; element [0] contains an 1d array containing various parameters about the panel ; Author ........: Gianni Addiego (Chimp) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _GuiControlPanel($ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, $style = -1, $exStyle = -1, $xPanelPos = 0, $yPanelPos = 0, $xBorder = 0, $yBorder = 0, $xSpace = 1, $ySpace = 1, $Group = False, $sGrpTitle = "") Local Static $sAllowedControls = "|Label|Input|Edit|Button|CheckBox|Radio|List|Combo|Pic|Icon|Graphic|" If Not StringInStr($sAllowedControls, '|' & $ControlType & '|') Then Return SetError(1, 0, "Unkown control") Local $PanelWidth = (($ctrlWidth + $xSpace) * $nrPerLine) - $xSpace + ($xBorder * 2) Local $PanelHeight = (($ctrlHeight + $ySpace) * $nrOfLines) - $ySpace + ($yBorder * 2) Local $hGroup If $Group Then If $sGrpTitle = "" Then $xPanelPos += 1 $yPanelPos += 1 $hGroup = GUICtrlCreateGroup("", $xPanelPos - 1, $yPanelPos - 7, $PanelWidth + 2, $PanelHeight + 8) Else $xPanelPos += 1 $yPanelPos += 15 $hGroup = GUICtrlCreateGroup($sGrpTitle, $xPanelPos - 1, $yPanelPos - 15, $PanelWidth + 2, $PanelHeight + 16) EndIf EndIf ; create the controls Local $aGuiGridCtrls[$nrPerLine * $nrOfLines + 1] Local $aPanelParams[14] = [ _ $ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, _ $xPanelPos, $yPanelPos, $xBorder, $yBorder, $xSpace, $ySpace, $PanelWidth, $PanelHeight, $hGroup] ReDim $idAddIcon[UBound($aGuiGridCtrls)] ReDim $idRemoveIcon[UBound($aGuiGridCtrls)] ReDim $idChangeIcon[UBound($aGuiGridCtrls)] For $i = 0 To $nrPerLine * $nrOfLines - 1 ; coordinates 1 based $col = Mod($i, $nrPerLine) + 1 ; Horizontal position within the grid (column) $row = Int($i / $nrPerLine) + 1 ; Vertical position within the grid (row) $left = $xPanelPos + ((($ctrlWidth + $xSpace) * $col) - $xSpace) - $ctrlWidth + $xBorder $top = $yPanelPos + ((($ctrlHeight + $ySpace) * $row) - $ySpace) - $ctrlHeight + $yBorder $text = $i + 1 ; "*" ; "." ; "(*)" ; create the control(s) $aGuiGridCtrls[$i + 1] = Execute("GUICtrlCreate" & $ControlType & "($text, $left, $top, $ctrlWidth, $ctrlHeight, $style, $exStyle)") If BitAND($exStyle, $WS_EX_ACCEPTFILES) = $WS_EX_ACCEPTFILES Then GUICtrlSetState($aGuiGridCtrls[$i + 1], $GUI_DROPACCEPTED) $idContextmenu = GUICtrlCreateContextMenu($aGuiGridCtrls[$i + 1]) $idAddIcon[$i] = GUICtrlCreateMenuItem("Add Icon", $idContextmenu) $idRemoveIcon[$i] = GUICtrlCreateMenuItem("Remove Icon", $idContextmenu) $idChangeIcon[$i] = GUICtrlCreateMenuItem("Change icon", $idContextmenu) Next If $Group Then GUICtrlCreateGroup("", -99, -99, 1, 1) ; close group $aGuiGridCtrls[0] = $aPanelParams Return $aGuiGridCtrls EndFunc ;==>_GuiControlPanel ; writes a value to an element of an array embedded in another array Func _SubArraySet(ByRef $aSubArray, $iElement, $vValue) $aSubArray[$iElement] = $vValue EndFunc ;==>_SubArraySet Func _ToggleGuiShowHide($hwnd, $bToggleGUI) If $bToggleGUI Then $bShowGUI = True DllCall($dllUser32, "int", "AnimateWindow", "hwnd", $hwnd, "int", 200, "long", Eval($GUI_IN)) ; show panel WinActivate($hwnd) Else $bShowGUI = False If Not $bFreezeWindow Then DllCall($dllUser32, "int", "AnimateWindow", "hwnd", $hwnd, "int", 200, "long", Eval($GUI_OUT)) ; hide panel EndIf EndFunc ;==>_ToggleGuiShowHide Func _Exit() Local $awPos If $bSaveSettings Then $awPos = WinGetPos($GUI) If $awPos[0] < 0 Then $awPos[0] = 0 If $awPos[1] < 0 Then $awPos[1] = 0 _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET LeftPos = " & $awPos[0] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET TopPos = " & $awPos[1] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET ButtonSize = " & $iStep & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET xColumns = " & ($aMyMatrix[0])[1] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIin = '" & $GUI_IN & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIout = '" & $GUI_OUT & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET Freeze = '" & $bFreezeWindow & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET StartUp = '" & $bStartUp & "';") EndIf _SQLite_Close($hSQLiteDB) _SQLite_Shutdown() EndFunc ;==>_Exit #Region --- Restart Program --- Func _RestartProgram() If @Compiled And StringRegExpReplace(FileGetShortName(@ScriptFullPath), "^.*\.", "") <> 'a3x' Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc ;==>_RestartProgram #EndRegion --- Restart Program --- Func _StartUpProgram($iStartup = True) If $iStartup And @Compiled And StringRegExpReplace(@ScriptFullPath, "^.*\.", "") <> 'a3x' Then FileCreateShortcut(@ScriptFullPath, @StartupDir & '\LaunchPad.lnk', $AppDataUser) ElseIf $iStartup Then FileCreateShortcut(@AutoItExe, @StartupDir & '\LaunchPad.lnk', $AppDataUser, FileGetShortName(@ScriptFullPath)) EndIf If Not $iStartup Then FileDelete(@StartupDir & '\LaunchPad.lnk') EndFunc ;==>_StartUpProgram Func _PickIconDlg($sFileName, $nIconIndex = 0, $hwnd = 0) Local $nRet, $aRetArr[2] $nRet = DllCall("shell32.dll", "int", "PickIconDlg", _ "hwnd", $hwnd, _ "wstr", $sFileName, "int", 1000, "int*", $nIconIndex) If Not $nRet[0] Then Return SetError(1, 0, -1) $aRetArr[0] = $nRet[2] $aRetArr[1] = $nRet[4] + 1 Return $aRetArr EndFunc ;==>_PickIconDlg Func _SQLite_LaunchPad($hwnd, $sqlCMD, $sqlExit = False) If Not _SQLite_Exec($hSQLiteDB, $sqlCMD) = $SQLITE_OK Then _ MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg() & @CRLF & @CRLF & $sqlCMD, 0, $GUI) If $sqlExit Then Exit -1 EndFunc ;==>_SQLite_LaunchPad ; Return an array which xMin[0], xMax[1], yMin[2], yMax[3] Func _GetVirtualScreen() ;~ 'Virtual Desktop sizes Local $SM_XVIRTUALSCREEN = 76 ; 'Virtual Left Local $SM_YVIRTUALSCREEN = 77 ; 'Virtual Top Local $SM_CXVIRTUALSCREEN = 78 ; 'Virtual Width Local $SM_CYVIRTUALSCREEN = 79 ; 'Virtual Height Dim $xyScreen[4] Local $posWin = WinGetPos($GUI) Dim $VirtualScreen[4] = [$SM_XVIRTUALSCREEN, $SM_CXVIRTUALSCREEN, $SM_YVIRTUALSCREEN, $SM_CYVIRTUALSCREEN] For $x = 0 To 3 $xTemp = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $VirtualScreen[$x]) If $x = 1 Then ;~ Note: $SM_CXVIRTUALSCREEN + $SM_XVIRTUALSCREEN = $RightSideScreen $xyScreen[$x] = ($xTemp[0] + $xyScreen[$x - 1]) - 1 Else $xyScreen[$x] = $xTemp[0] If $x = 3 Then $xyScreen[$x] -= 1 EndIf Next ;~ Note: The if statement below is to deal with multi monitors and undocked laptop move LaunchPad If (IsArray($posWin) And IsArray($xyScreen)) And ($posWin[0] > $xyScreen[1] Or $posWin[1] > $xyScreen[3]) Then $bSaveSettings = False WinMove($GUI, '', 0, 0) EndIf Return ($xyScreen) EndFunc ;==>_GetVirtualScreen Func _About() Local $sAboutText = 'LaunchPad you can easily create panels with buttons for starting applications on a Windows System.' $sAboutText &= @CRLF & @CRLF & 'Author: Chimp' & @CRLF $sAboutText &= 'Modify: Marcgforce, Danny35d' & @CRLF $sAboutText &= 'Credits: @KaFu, @Danyfirex, @mikell' GUISetState(@SW_DISABLE, $GUI) Local $AboutGUI = GuiCreate(' About LaunchPad' , 280, 160, Default, Default, $WS_CAPTION, Default, $GUI) GUISetBkColor (0xf8c848) GuiCtrlCreateLabel($sAboutText, 5, 10, 280, 100) GuiCtrlCreateLabel('____________________________________________', 10, 90, 260, 15, $SS_CENTER) ; separator $WebsiteLink = GuiCtrlCreateLabel('www.autoitscript.com/forum/topic/202048-button-deck/', 5, 105, 270, 20, $SS_CENTER) ; he he! GUICtrlSetCursor($WebsiteLink, 0) GUICtrlSetColor($WebsiteLink, 0x0000ff) Local $ok = GUICtrlCreateButton('OK', 10, 130, 70, 22, $BS_DEFPUSHBUTTON) GUISetState() While 1 $aboutMsg = GUIGetMsg() Select Case $aboutMsg = $GUI_EVENT_CLOSE ExitLoop Case $aboutMsg = $ok ExitLoop Case $aboutMsg = $WebsiteLink ShellExecute ('https://www.autoitscript.com/forum/topic/202048-button-deck/') EndSelect WEnd GUISetState(@SW_ENABLE, $GUI) GUIDelete($AboutGUI) Return EndFunc ;==>About Func Test() MsgBox(0, 0, ":)", 1) EndFunc ;==>Test  
  6. Like
    Danny35d got a reaction from coffeeturtle in Button Deck   
    Hi Chimp, Nine and Marcforce very nice script.  Below are the changes I made on the script.
    Instead of Auto-hide after 5 secs now hide when GUI loose focus Removed Tray management of the deck Improve drag and drop Updated _RestartProgram() function to handle file with .a3x extension Added _GetVirtualScreen() function the handle better multi monitors and undocking laptop Added GUI animation and startup script when login Instead of saving shortcut and config into an ini file, now save to SQLite database Added way to export and import Lauchpad configurations Added About GUI Added and improve to Add, Remove buttons and change icon Improve how to get icons and execute files from extension .lnk  Added a way open the database for modification using 3rd party application called DB browser ; =============================================================================================================================== ; Title .........: LaunchPad ; Description ...: button deck to be used as an applications launcher (and not only) ; Author(s) .....: Chimp (Gianni Addiego) ; credits to @KaFu, @Danyfirex, @mikell (see comments for references) ; Modification ..: Marcgforce (drag and drop add, passing ini to links) ; Danny35d Replace passing ini for a SQLite DB, improve drag and drop, improve func called _RestartProgram ; to be able to execute file with the extension .a3x, added func called _GetVirtualScreen to better ; handle Multi monitors and undocking laptop, added GUI animation and Choice to startup when you login. ; URL ...........: https://www.autoitscript.com/forum/topic/202048-button-deck/ ; =============================================================================================================================== #NoTrayIcon #include <Misc.au3> #include <Array.au3> #include <Crypt.au3> #include <String.au3> #include <SQLite.au3> #include <WinAPI.au3> #include <SQLite.dll.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If _Singleton("LaunchPadApps", 2) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "An occurrence of LaunchPad is already running.") Exit EndIf ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) OnAutoItExitRegister('_Exit') ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing Global Const $WMSZ_LEFT = 1 Global Const $WMSZ_RIGHT = 2 Global Const $WMSZ_TOP = 3 Global Const $WMSZ_TOPLEFT = 4 Global Const $WMSZ_TOPRIGHT = 5 Global Const $WMSZ_BOTTOM = 6 Global Const $WMSZ_BOTTOMLEFT = 7 Global Const $WMSZ_BOTTOMRIGHT = 8 Global Enum $vButton_Tip = 0, $vButton_IconPath, $vButton_IconNumber, $vButton_Command, $vButton_UniqueID Global Const $AW_FADE_IN = 0x00080000 ;fade-in Global Const $AW_FADE_OUT = 0x00090000 ;fade-out Global Const $AW_SLIDE_IN_LEFT = 0x00040001 ;slide in from left Global Const $AW_SLIDE_OUT_LEFT = 0x00050002 ;slide out to left Global Const $AW_SLIDE_IN_RIGHT = 0x00040002 ;slide in from right Global Const $AW_SLIDE_OUT_RIGHT = 0x00050001 ;slide out to right Global Const $AW_SLIDE_IN_TOP = 0x00040004 ;slide-in from top Global Const $AW_SLIDE_OUT_TOP = 0x00050008 ;slide-out to top Global Const $AW_SLIDE_IN_BOTTOM = 0x00040008 ;slide-in from bottom Global Const $AW_SLIDE_OUT_BOTTOM = 0x00050004 ;slide-out to bottom Global Const $AW_DIAG_SLIDE_IN_TOP_LEFT = 0x00040005 ;diag slide-in from Top-left Global Const $AW_DIAG_SLIDE_OUT_TOP_LEFT = 0x0005000a ;diag slide-out to Top-left Global Const $AW_DIAG_SLIDE_IN_TOP_RIGHT = 0x00040006 ;diag slide-in from Top-Right Global Const $AW_DIAG_SLIDE_OUT_TOP_RIGHT = 0x00050009 ;diag slide-out to Top-Right Global Const $AW_DIAG_SLIDE_IN_BOTTOM_LEFT = 0x00040009 ;diag slide-in from Bottom-left Global Const $AW_DIAG_SLIDE_OUT_BOTTOM_LEFT = 0x00050006 ;diag slide-out to Bottom-left Global Const $AW_DIAG_SLIDE_IN_BOTTOM_RIGHT = 0x0004000a ;diag slide-in from Bottom-right Global Const $AW_DIAG_SLIDE_OUT_BOTTOM_RIGHT = 0x00050005 ;diag slide-out to Bottom-right Global Const $AW_EXPLODE = 0x00040010 ;explode Global Const $AW_IMPLODE = 0x00050010 ;implode Local Const $AppDataUser = @LocalAppDataDir & '\LaunchPad' Local Const $dll_icons = $AppDataUser & '\Bin\iconset.dll' Local $aAnimation = StringSplit('Explode|Fade In|Slide In Left|Slide In Right|Slide In Top|Slide In Bottom|Diag Slide In Top Left|Diag Slide In Top Right|Diag Slide In Bottom Left|Diag Slide In Bottom Right', '|', 2) If Not FileExists($AppDataUser) Then DirCreate($AppDataUser) If Not FileExists($AppDataUser & '\Bin') Then DirCreate($AppDataUser & '\Bin') If Not FileExists($AppDataUser & '\Icons') Then DirCreate($AppDataUser & '\Icons') If Not FileExists($AppDataUser & "\BackupDB") Then DirCreate($AppDataUser & "\BackupDB") If Not FileExists($AppDataUser & '\Bin\iconset.dll') Then FileInstall('.\Include\iconset.dll', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3.exe') Then FileInstall('.\Include\sqlite3.exe', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3.dll') Then FileInstall('.\Include\sqlite3.dll', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3_x64.dll') Then FileInstall('.\Include\sqlite3_x64.dll', $AppDataUser & '\Bin\') #cs The following 2D array contains the settings that determine the behavior of each "Button" namely 4 parameters for each row (for each button); [n][0] the tooltip of the button [n][1] path of an icon or a file containing icons [n][2] the number of the icon (if the previous parameter is a collection) [n][3] AutoIt command(s) to be executed directly on button click (or also the name of a function) #ce Global $aTools[][] = [ _ ['Administrative Tools', 'SHELL32.dll', 177, 'run("explorer.exe shell:::{D20EA4E1-3957-11d2-A40B-0C5020524153}")', ''], _ ['Windows version', 'winver.exe', 1, 'run("explorer.exe shell:::{BB06C0E4-D293-4f75-8A90-CB05B6477EEE}")', ''], _ ; or "Run('winver.exe')" ['This computer', 'netcenter.dll', 6, 'run("explorer.exe shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")', ''], _ ['Devices and Printers', 'SHELL32.dll', 272, 'run("explorer.exe shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}")', ''], _ ['Folder options', 'SHELL32.dll', 210, 'run("explorer.exe shell:::{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}")', ''], _ ['Command Prompt', @ComSpec, 1, 'Run(@ComSpec)', ''], _ ['Internet Explorer', @ProgramFilesDir & '\Internet Explorer\iexplore.exe', 1, "Run(@ProgramFilesDir & '\Internet Explorer\iexplore.exe')", ''], _ ['Media Player', @ProgramFilesDir & '\Windows media player\wmplayer.exe', 1, "Run(@ProgramFilesDir & '\Windows media player\wmplayer.exe')", ''], _ ['File browser', @WindowsDir & '\explorer.exe', 1, "Run(@WindowsDir & '\explorer.exe')", ''], _ ['Notepad', @SystemDir & '\notepad.exe', 1, "Run(@SystemDir & '\notepad.exe')", ''], _ ['Wordpad', @SystemDir & '\write.exe', 1, "Run(@SystemDir & '\write.exe')", ''], _ ['Registry editor', @SystemDir & '\regedit.exe', 1, "ShellExecute('regedit.exe')", ''], _ ['Connect to', 'netcenter.dll', 19, 'run("explorer.exe shell:::{38A98528-6CBF-4CA9-8DC0-B1E1D10F7B1B}")', ''], _ ['Calculator', @SystemDir & '\Calc.exe', 1, "Run(@SystemDir & '\calc.exe')", ''], _ ['Control panel', 'control.exe', 1, 'run("explorer.exe shell:::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}")', ''], _ ['Users manager', @SystemDir & '\Netplwiz.exe', 1, "ShellExecute('Netplwiz.exe')", ''], _ ; {7A9D77BD-5403-11d2-8785-2E0420524153} ['Run', 'SHELL32.dll', 25, 'Run("explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}")', ''], _ ['Search files', 'SHELL32.dll', 135, 'run("explorer.exe shell:::{9343812e-1c37-4a49-a12e-4b2d810d956b}")', ''], _ ['On screen Magnifier', @SystemDir & '\Magnify.exe', 1, "ShellExecute('Magnify.exe')", ''], _ ['Paint', @SystemDir & '\mspaint.exe', 1, "Run(@SystemDir & '\mspaint.exe')", ''], _ ['Remote desktop', @SystemDir & '\mstsc.exe', 1, " Run('mstsc.exe')", ''], _ ['Resource monitoring', @SystemDir & '\resmon.exe', 1, "Run('resmon.exe')", ''], _ ['Device manager', 'SHELL32.dll', 13, 'Run("explorer.exe Shell:::{74246bfc-4c96-11d0-abef-0020af6b0b7a}")', ''], _ ['Audio', 'SndVol.exe', 1, 'Run("explorer.exe Shell:::{F2DDFC82-8F12-4CDD-B7DC-D4FE1425AA4D}")', ''], _ ; or 'run(@SystemDir & "\SndVol.exe")'] ['Task view', 'SHELL32.dll', 133, 'Run("explorer.exe shell:::{3080F90E-D7AD-11D9-BD98-0000947B0257}")', ''], _ ['Task Manager', @SystemDir & '\taskmgr.exe', 1, 'Send("^+{ESC}")', ''], _ ; "Run(@SystemDir & '\taskmgr.exe')"], _ ['On Screen Keyboard', 'osk.exe', 1, 'ProcessExists("osc.exe") ? False : ShellExecute("osk.exe")', ''], _ ; <-- ternary example ['... if Notepad is running Send F5 to it', 'SHELL32.dll', 167, ' WinExists("[CLASS:Notepad]") ? ControlSend("[CLASS:Notepad]", "", "", "{F5}") : MsgBox(16, ":(", "Notepad not found", 2)', ''] _ ; Check if Notepad is currently running ] ; Show desktop {3080F90D-D7AD-11D9-BD98-0000947B0257} ; Desktop Background {ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} ; IE internet option {A3DD4F92-658A-410F-84FD-6FBBBEF2FFFE} ; ['Notes', 'StikyNot.exe', 1, "ShellExecute('StikyNot')"], _ Global $GUI, $hSQLiteDB, $tmpVirtualScreen Global $bSaveSettings = True, $bShowGUI = True Global $SQLiteDB = $AppDataUser & '\Launchpad.sqlite' Local $sqlRow, $sqlColumn Local $SQLiteDBExists = FileExists($SQLiteDB) Global $sSQliteDll = _SQLite_Startup($AppDataUser & '\Bin\sqlite3.dll', False, 1) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _ "Not FOUND in " & $AppDataUser & '\Bin\') $bSaveSettings = False Exit -1 Else $hSQLiteDB = _SQLite_Open($SQLiteDB) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't open or create a permanent Database!" & @CRLF & @CRLF & $SQLiteDB) $bSaveSettings = False Exit -1 EndIf EndIf _SQLite_LaunchPad($hSQLiteDB, "CREATE TABLE IF NOT EXISTS Buttons(Name TEXT, Icon TEXT, IconNum INTEGER, Execute TEXT, Button_ID INTEGER PRIMARY KEY);") _SQLite_LaunchPad($hSQLiteDB, "CREATE TABLE IF NOT EXISTS Settings(LeftPos INTEGER, TopPos INTEGER, ButtonSize INTEGER, xColumns INTEGER, GUIin TEXT, GUIout TEXT, Freeze TEXT, StartUp TEXT);") If Not $SQLiteDBExists Then _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Settings VALUES(10, 10, 40, " & Ceiling(UBound($aTools) / 2) & ",'AW_EXPLODE', 'AW_IMPLODE', 'False', 'False');") For $x = 0 To UBound($aTools) - 1 $aTools[$x][$vButton_Command] = StringReplace($aTools[$x][$vButton_Command], "'", '"') _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('" & $aTools[$x][$vButton_Tip] & "','" & $aTools[$x][$vButton_IconPath] & "'," & $aTools[$x][$vButton_IconNumber] & ",'" & $aTools[$x][$vButton_Command] & "');") Next EndIf _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) _SQLite_QuerySingleRow($hSQLiteDB, "SELECT LeftPos FROM Settings;", $sqlRow) Global $iLeftPos = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT TopPos FROM Settings;", $sqlRow) Global $iTopPos = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT ButtonSize FROM Settings;", $sqlRow) Global $iStep = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT xColumns FROM Settings;", $sqlRow) Global $iNrPerLine = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT GUIin FROM Settings;", $sqlRow) Global $GUI_IN = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT GUIout FROM Settings;", $sqlRow) Global $GUI_OUT = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT Freeze FROM Settings;", $sqlRow) Global $bFreezeWindow = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT StartUp FROM Settings;", $sqlRow) Global $bStartUp = $sqlRow[0] If Not IsBool($bFreezeWindow) And $bFreezeWindow = 'True' Then $bFreezeWindow = True ElseIf Not IsBool($bFreezeWindow) And $bFreezeWindow = 'False' Then $bFreezeWindow = False EndIf If Not IsBool($bStartUp) And $bStartUp = 'True' Then $bStartUp = True ElseIf Not IsBool($bStartUp) And $bStartUp = 'False' Then $bStartUp = False EndIf Global $idAddIcon[1], $idRemoveIcon[1], $idChangeIcon[1] Global $iNrOfLines = Ceiling(UBound($aTools) / $iNrPerLine) Global $dllUser32 = DllOpen("user32.dll") $GUI = GUICreate('Launch Pad', 10, 10, $iLeftPos, $iTopPos, BitOR($WS_THICKFRAME, 0), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_ACCEPTFILES)) Global $GuiContextMenu = GUICtrlCreateContextMenu() Global $idFreezeWindow = GUICtrlCreateMenuItem("Freeze", $GuiContextMenu) Global $idSettings = GUICtrlCreateMenu("Settings", $GuiContextMenu, 1) Global $idDatabase = GUICtrlCreateMenu("Database", $idSettings) Global $idOpenDB = GUICtrlCreateMenuItem("Open DB", $idDatabase) Global $idExportDB = GUICtrlCreateMenuItem("Export DB", $idDatabase) Global $idImportDB = GUICtrlCreateMenuItem("Import DB", $idDatabase) Global $idStartUp = GUICtrlCreateMenuItem("StartUp", $idSettings) Global $idAnimation = GUICtrlCreateMenu("Animate", $GuiContextMenu, 1) GUICtrlCreateMenuItem("", $GuiContextMenu) Global $idAbout = GUICtrlCreateMenuItem("About", $GuiContextMenu) $aMyMatrix = _GuiControlPanel("Button", $iNrPerLine, $iNrOfLines, $iStep, $iStep, BitOR(0x40, 0x1000), -1, 0, 0, 0, 0, 0, 0, False, "") Global $iPreviousX = ($aMyMatrix[0])[1], $iPreviousY = ($aMyMatrix[0])[2] ReDim $idAddIcon[UBound($aMyMatrix)] ReDim $idRemoveIcon[UBound($aMyMatrix)] ReDim $idChangeIcon[UBound($aMyMatrix)] ReDim $aTools[UBound($aMyMatrix)][5] ; Be sure none of the array elements are NULL, otherwise _ArraySearch failed For $i = 0 To UBound($aMyMatrix) - 1 If $idAddIcon[$i] = '' Then $idAddIcon[$i] = 9999 If $idRemoveIcon[$i] = '' Then $idRemoveIcon[$i] = 9999 If $idChangeIcon[$i] = '' Then $idChangeIcon[$i] = 9999 Next For $i = 0 To UBound($aAnimation) - 1 $aAnimation[$i] = GUICtrlCreateMenuItem($aAnimation[$i], $idAnimation) Next For $i = 1 To UBound($aMyMatrix) - 1 GUICtrlSetResizing($aMyMatrix[$i], $GUI_DOCKALL) ; (2+32+256+512) so the control will not move during resizing If $i <= UBound($aTools) Then GUICtrlSetImage($aMyMatrix[$i], $aTools[$i - 1][$vButton_IconPath], $aTools[$i - 1][$vButton_IconNumber]) GUICtrlSetTip($aMyMatrix[$i], $aTools[$i - 1][$vButton_Tip]) EndIf Next _WinSetClientSize($GUI, ($aMyMatrix[0])[11], ($aMyMatrix[0])[12]) ; thanks to KaFu If $bFreezeWindow Then GUICtrlSetState($idFreezeWindow, $GUI_CHECKED) If $bStartUp Then GUICtrlSetState($idStartUp, $GUI_CHECKED) GUISetState() ; https://devblogs.microsoft.com/oldnewthing/20110218-00/?p=11453 GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_SIZING, "WM_SIZING") _MainLoop() _Exit() Func _MainLoop() Local $iDeltaX, $iDeltaY, $row, $col, $left, $top, $awPos, $iAnswer, $sTemp Local $hTimer, $sFileDialog, $sBackupName While 1 Sleep(10) $xyVirtualScreen = _GetVirtualScreen() If Not WinActive($GUI) And Not $bFreezeWindow And $bShowGUI Then _ToggleGuiShowHide($GUI, False) $aPos = MouseGetPos() $hTimer = TimerInit() While ($aPos[0] = $xyVirtualScreen[0] Or $aPos[1] = $xyVirtualScreen[2] Or $aPos[0] = $xyVirtualScreen[1] Or $aPos[1] = $xyVirtualScreen[3]) And Not $bFreezeWindow $aPos = MouseGetPos() If TimerDiff($hTimer) > 1000 Then _ToggleGuiShowHide($GUI, True) Sleep(10) WEnd $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED Local $iAnswer = $IDNO Local $ProposeLink = StringSplit(@GUI_DragFile, '\') $ProposeLink = StringRegExpReplace($ProposeLink[UBound($ProposeLink) - 1], '(.*)\..*', "$1") $i = _ArrayBinarySearch($aMyMatrix, @GUI_DropId) If $i <> -1 Then If $aTools[$i - 1][$vButton_Command] <> '' Then $iAnswer = MsgBox($MB_YESNO, "LauchPad Drag & Drop", "Are you sure you want to overwrite " & $aTools[$i - 1][$vButton_Tip] & " shortcut?", 0, $GUI) Else $iAnswer = $IDYES EndIf If $iAnswer = $IDYES Then $sTemp = '' Local $sReponse = InputBox("Icon name", "Give the shortcut a title", $ProposeLink) If @error <> 1 Or $sReponse <> '' Then $aTools[$i - 1][$vButton_Tip] = $sReponse $aTools[$i - 1][$vButton_IconNumber] = 1 $aTools[$i - 1][$vButton_IconPath] = $dll_icons $aTools[$i - 1][$vButton_Command] = @GUI_DragFile $sExt = StringRegExpReplace($aTools[$i - 1][$vButton_Command], "^.*\.", "") ; extraction of its extension Switch $sExt Case "doc", "docx", "odt" $aTools[$i - 1][$vButton_IconNumber] = 436 Case "xls", "xlsx", "ods" $aTools[$i - 1][$vButton_IconNumber] = 441 Case "pdf" $aTools[$i - 1][$vButton_IconNumber] = 400 Case "ppt", "pptx", "odp" $aTools[$i - 1][$vButton_IconNumber] = 431 Case "txt", "rtf" $aTools[$i - 1][$vButton_IconNumber] = 406 Case "msg" $aTools[$i - 1][$vButton_IconNumber] = 426 Case Else If $sExt = 'lnk' Then $aDetails = FileGetShortcut($aTools[$i - 1][$vButton_Command]) If IsArray($aDetails) Then $sTemp = $aTools[$i - 1][$vButton_Command] If $aDetails[4] <> '' Then $aTools[$i - 1][$vButton_Command] = $aDetails[4] Else $aTools[$i - 1][$vButton_Command] = $aDetails[0] EndIf EndIf EndIf If _WinAPI_ExtractIconEx($aTools[$i - 1][$vButton_Command], -1, 0, 0, 0) > 0 Then ; allows you to test if the file has one or more icon (s) Local $aIcon[3] = [64, 32, 16] For $a = 0 To UBound($aIcon) - 1 $aIcon[$a] = _WinAPI_Create32BitHICON(_WinAPI_ShellExtractIcon($aTools[$i - 1][$vButton_Command], 0, $aIcon[$a], $aIcon[$a]), 1) Next $aTools[$i - 1][$vButton_IconPath] = $AppDataUser & '\Icons\' & $aTools[$i - 1][$vButton_Tip] & '.ico' _WinAPI_SaveHICONToFile($aTools[$i - 1][$vButton_IconPath], $aIcon) For $a = 0 To UBound($aIcon) - 1 _WinAPI_DestroyIcon($aIcon[$a]) Next Else $aRet = _PickIconDlg($dll_icons) If Not @error Then If GUICtrlSetImage(@GUI_DropId, $aRet[0], $aRet[1]) Then $aTools[$i - 1][$vButton_IconPath] = $aRet[0] $aTools[$i - 1][$vButton_IconNumber] = $aRet[1] EndIf EndIf EndIf EndSwitch EndIf If $sTemp <> '' Then $aTools[$i - 1][$vButton_Command] = $sTemp If $aTools[$i - 1][$vButton_UniqueID] <> '' And $iAnswer = $IDYES Then _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Name = '" & $aTools[$i - 1][$vButton_Tip] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Execute = '" & $aTools[$i - 1][$vButton_Command] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Icon = '" & $aTools[$i - 1][$vButton_IconPath] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET IconNum = '" & $aTools[$i - 1][$vButton_IconNumber] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") Else _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('" & $aTools[$i - 1][$vButton_Tip] & "', '" & $aTools[$i - 1][$vButton_IconPath] & "', " & $aTools[$i - 1][$vButton_IconNumber] & ", '" & $aTools[$i - 1][$vButton_Command] & "');") _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) ReDim $aTools[UBound($aMyMatrix)][5] EndIf If $iAnswer = $IDYES Then GUICtrlSetTip(@GUI_DropId, $aTools[$i - 1][$vButton_Tip]) GUICtrlSetImage(@GUI_DropId, $aTools[$i - 1][$vButton_IconPath], $aTools[$i - 1][$vButton_IconNumber]) EndIf EndIf EndIf Case $idFreezeWindow If BitAND(GUICtrlRead($idFreezeWindow), $GUI_UNCHECKED) = $GUI_UNCHECKED Then $bFreezeWindow = True GUICtrlSetState($idFreezeWindow, $GUI_CHECKED) Else $bFreezeWindow = False GUICtrlSetState($idFreezeWindow, $GUI_UNCHECKED) EndIf Case $idStartUp If BitAND(GUICtrlRead($idStartUp), $GUI_UNCHECKED) = $GUI_UNCHECKED Then $bStartUp = True _StartUpProgram($bStartUp) GUICtrlSetState($idStartUp, $GUI_CHECKED) Else $bStartUp = False _StartUpProgram($bStartUp) GUICtrlSetState($idStartUp, $GUI_UNCHECKED) EndIf Case $idOpenDB If Not FileExists($AppDataUser & '\SQLiteDatabaseBrowserPortable') Then If MsgBox($MB_YESNO, "LauchPad DB Browser", "DB Browser for SQLite Portable is needed to change settings or buttons." & @CRLF & _StringRepeat(' ', 30) & "Do you want to download DB Browser?", 0, $GUI) = $IDYES Then ShellExecute('https://portableapps.com/apps/development/sqlite_database_browser_portable') MsgBox($MB_OK, "LauchPad DB Browser", "Installing DB Browser for SQLite Portable" & @CRLF & @CRLF & _ '1) Press green button to download DB Browser' & @CRLF & @CRLF & '2) Execute the downloaded file' & @CRLF & @CRLF & _ '3) Press Next and Destination Folder is ' & $AppDataUser & @CRLF & @CRLF & '4) Press Install and then Finish', 0, $GUI) EndIf Else $dHash = _Crypt_HashFile($SQLiteDB, $CALG_MD5) ShellExecuteWait($AppDataUser & '\SQLiteDatabaseBrowserPortable\SQLiteDatabaseBrowserPortable.exe', $SQLiteDB) If $dHash <> _Crypt_HashFile($SQLiteDB, $CALG_MD5) Then $bSaveSettings = False _RestartProgram() EndIf EndIf Case $idExportDB $sBackupName = 'LaunchPad-' & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & '.sql' $sFileDialog = FileSaveDialog('Export DB - LaunchPad', $AppDataUser & "\BackupDB\", "SQLite (*.sql)", BitOR($FD_PATHMUSTEXIST, $FD_PROMPTOVERWRITE), $sBackupName, $GUI) If Not @error Then $sTemp = '.open ' & StringReplace($SQLiteDB, '\', '/') & @CRLF $sTemp &= '.once "' & StringReplace($sFileDialog, '\', '/') & '"' & @CRLF $sTemp &= '.dump' & @CRLF & '.exit' & @CRLF _SQLite_SQLiteExe($SQLiteDB, $sTemp, $row, $AppDataUser & '\Bin\sqlite3.exe') EndIf Case $idImportDB $sFileDialog = FileOpenDialog('Import DB - LaunchPad', $AppDataUser & "\BackupDB\", "SQLite (*.sql)|All (*.*)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST), '', $GUI) If Not @error Then $bSaveSettings = False $sTemp = '.open ' & StringReplace($SQLiteDB, '\', '/') & @CRLF $sTemp &= 'DROP TABLE IF EXISTS Buttons;' & @CRLF $sTemp &= 'DROP TABLE IF EXISTS Settings;' & @CRLF $sTemp &= '.read "' & StringReplace($sFileDialog, '\', '/') & '"' & @CRLF $sTemp &= '.exit' & @CRLF _SQLite_SQLiteExe($SQLiteDB, $sTemp, $row, $AppDataUser & '\Bin\sqlite3.exe') _RestartProgram() EndIf Case $idAbout _About() Case Else $i = _ArraySearch($aMyMatrix, $Msg) If $i <> -1 Then If $aTools[$i - 1][$vButton_Command] <> '' Then $dummy = Execute($aTools[$i - 1][$vButton_Command]) If @error Then ShellExecute($aTools[$i - 1][$vButton_Command]) ElseIf $aTools[$i - 1][$vButton_Command] = '' Then MsgBox($MB_OK, "LauchPad Execute Shortcut", "This shortcut doesn't have an Application associated.", 0, $GUI) EndIf EndIf $i = _ArraySearch($aAnimation, $Msg) If $i <> -1 Then If GUICtrlRead($Msg, 1) = 'Explode' Then $GUI_IN = 'AW_EXPLODE' $GUI_OUT = 'AW_IMPLODE' Else $GUI_IN = 'AW_' & StringReplace(GUICtrlRead($Msg, 1), ' ', '_') $GUI_OUT = StringReplace($GUI_IN, '_In', '_Out') EndIf _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIin = '" & $GUI_IN & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIout = '" & $GUI_OUT & "';") ; Need to add focus EndIf $i = _ArraySearch($idAddIcon, $Msg) If $i <> -1 Then _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('', '', '', '');") _RestartProgram() EndIf $i = _ArraySearch($idRemoveIcon, $Msg) If $i <> -1 Then If MsgBox($MB_YESNO, "LauchPad Removing Icon", "Are you sure you want to delete " & $aTools[$i][$vButton_Tip] & " shortcut?", 0, $GUI) = $IDYES Then _SQLite_LaunchPad($hSQLiteDB, 'DELETE FROM Buttons WHERE Button_ID = ' & $aTools[$i][$vButton_UniqueID] & ';') If StringInStr($aTools[$i][$vButton_IconPath], $AppDataUser & '\Icons') Then FileDelete($aTools[$i][$vButton_IconPath]) _RestartProgram() EndIf EndIf $i = _ArraySearch($idChangeIcon, $Msg) If $i <> -1 Then $aRet = _PickIconDlg($dll_icons) If Not @error Then If GUICtrlSetImage($aMyMatrix[$i + 1], $aRet[0], $aRet[1]) Then $aTools[$i][$vButton_IconPath] = $aRet[0] $aTools[$i][$vButton_IconNumber] = $aRet[1] If $aTools[$i][$vButton_UniqueID] <> '' Then _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Icon = '" & $aTools[$i][$vButton_IconPath] & "' WHERE Button_ID = " & $aTools[$i][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET IconNum = '" & $aTools[$i][$vButton_IconNumber] & "' WHERE Button_ID = " & $aTools[$i][$vButton_UniqueID] & ";") Else _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('', '" & $aTools[$i][$vButton_IconPath] & "', " & $aTools[$i][$vButton_IconNumber] & ", '');") _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) ReDim $aTools[UBound($aMyMatrix)][5] EndIf EndIf EndIf EndIf EndSwitch ; check if any size has changed If $iPreviousX <> ($aMyMatrix[0])[1] Or $iPreviousY <> ($aMyMatrix[0])[2] Then ; calculate the variations $iDeltaX = Abs($iPreviousX - ($aMyMatrix[0])[1]) $iDeltaY = Abs($iPreviousY - ($aMyMatrix[0])[2]) ; if both dimensions changed at the same time, the largest variation prevails over the other If $iDeltaX >= $iDeltaY Then ; keep the new number of columns ; calculate and set the correct number of lines accordingly _SubArraySet($aMyMatrix[0], 2, Ceiling((UBound($aMyMatrix) - 1) / ($aMyMatrix[0])[1])) Else ; otherwise keep the new number of rows ; calculate and set the correct number of columns accordingly _SubArraySet($aMyMatrix[0], 1, Ceiling((UBound($aMyMatrix) - 1) / ($aMyMatrix[0])[2])) EndIf ; set client area new sizes _WinSetClientSize($GUI, ($aMyMatrix[0])[1] * $iStep, ($aMyMatrix[0])[2] * $iStep) ; remember the new panel settings $iPreviousX = ($aMyMatrix[0])[1] $iPreviousY = ($aMyMatrix[0])[2] ; rearrange the controls inside the panel For $i = 0 To UBound($aMyMatrix) - 2 ; coordinates 1 based $col = Mod($i, $iPreviousX) + 1 ; Horizontal position within the grid (column) $row = Int($i / $iPreviousX) + 1 ; Vertical position within the grid (row number) $left = ($aMyMatrix[0])[5] + (((($aMyMatrix[0])[3] + ($aMyMatrix[0])[9]) * $col) - ($aMyMatrix[0])[9]) - ($aMyMatrix[0])[3] + ($aMyMatrix[0])[7] $top = ($aMyMatrix[0])[6] + (((($aMyMatrix[0])[4] + ($aMyMatrix[0])[10]) * $row) - ($aMyMatrix[0])[10]) - ($aMyMatrix[0])[4] + ($aMyMatrix[0])[8] GUICtrlSetPos($aMyMatrix[$i + 1], $left, $top) Next EndIf WEnd EndFunc ;==>_MainLoop ; Allow/Disallow specific borders resizing ; thanks to Danyfirex ; --------- ; https://www.autoitscript.com/forum/topic/201464-partially-resizable-window-how-solved-by-danyfirex-%F0%9F%91%8D/?do=findComment&comment=1445748 Func WM_NCHITTEST($hwnd, $iMsg, $iwParam, $ilParam) If $hwnd = $GUI Then Local $iRet = _WinAPI_DefWindowProc($hwnd, $iMsg, $iwParam, $ilParam) ; https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-nchittest If $iRet = $HTBOTTOM Or $iRet = $HTRIGHT Or $iRet = $HTBOTTOMRIGHT Then ; allowed resizing Return $iRet ; default process of border resizing Else ; resizing not allowed Return $HTCLIENT ; do like if cursor is in the client area EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTEST ; controls and process resizing operations in real time ; thanks to mikell ; ------ ; https://www.autoitscript.com/forum/topic/201464-partially-resizable-window-how-solved-by-danyfirex-%F0%9F%91%8D/?do=findComment&comment=1445754 Func WM_SIZING($hwnd, $iMsg, $wparam, $lparam) ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing Local $iCols = ($aMyMatrix[0])[1] Local $iRows = ($aMyMatrix[0])[2] Local $xClientSizeNew, $yClientSizeNew #cs $wparam The edge of the window that is being sized. $lparam A pointer to a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure. Return value Type: LRESULT #ce $wparam $aPos = WinGetPos($GUI) #cs Success : a 4 - element array containing the following information : $aArray[0] = X position $aArray[1] = Y position $aArray[2] = Width #ce Success : a 4 - element array containing the following information : $aPos2 = WinGetClientSize($GUI) #cs Success: a 2-element array containing the following information: $aArray[0] = Width of window's client area #ce Success: a 2-element array containing the following information: ; https://docs.microsoft.com/en-us/previous-versions//dd162897(v=vs.85) Local $sRect = DllStructCreate("Int[4]", $lparam) ; outer dimensions (includes borders) Local $left = DllStructGetData($sRect, 1, 1) Local $top = DllStructGetData($sRect, 1, 2) Local $Right = DllStructGetData($sRect, 1, 3) Local $bottom = DllStructGetData($sRect, 1, 4) ; border width Local $iEdgeWidth = ($aPos[2] - $aPos2[0]) / 2 Local $iHeadHeigth = $aPos[3] - $aPos2[1] - $iEdgeWidth * 2 Local $aEdges[2] $aEdges[0] = $aPos[2] - $aPos2[0] ; x $aEdges[1] = $aPos[3] - $aPos2[1] ; y $xClientSizeNew = $Right - $left - $aEdges[0] $xClientSizeNew = Round($xClientSizeNew / $iStep) * $iStep $yClientSizeNew = $bottom - $top - $aEdges[1] $yClientSizeNew = Round($yClientSizeNew / $iStep) * $iStep Switch $wparam Case $WMSZ_RIGHT ; calculate the new position of the right border DllStructSetData($sRect, 1, $left + $xClientSizeNew + $aEdges[0], 3) Case $WMSZ_BOTTOM ; calculate the new position of the bottom border DllStructSetData($sRect, 1, $top + $yClientSizeNew + $aEdges[1], 4) Case $WMSZ_BOTTOMRIGHT ; calculate the new position of both borders DllStructSetData($sRect, 1, $left + $xClientSizeNew + $aEdges[0], 3) DllStructSetData($sRect, 1, $top + $yClientSizeNew + $aEdges[1], 4) EndSwitch #cs If DllStructGetData($sRect, 1, 3) > @DesktopWidth Then ; $Right DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 3) - $iStep, 3) $xClientSizeNew -= $iStep EndIf If DllStructGetData($sRect, 1, 4) > @DesktopHeight Then ; $bottom DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 4), 4) $yClientSizeNew -= $iStep #ce If DllStructGetData($sRect, 1, 3) > @DesktopWidth Then ; $Right ; check if number of rows has changed If $iRows <> $yClientSizeNew / $iStep Then _SubArraySet($aMyMatrix[0], 2, $yClientSizeNew / $iStep) EndIf ; check if number of columns has changed If $iCols <> $xClientSizeNew / $iStep Then _SubArraySet($aMyMatrix[0], 1, $xClientSizeNew / $iStep) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZING ; set client area new sizes ; thanks to KaFu ; ---- ; https://www.autoitscript.com/forum/topic/201524-guicreate-and-wingetclientsize-mismatch/?do=findComment&comment=1446141 Func _WinSetClientSize($hwnd, $iW, $iH) Local $aWinPos = WinGetPos($hwnd) Local $sRect = DllStructCreate("int;int;int;int;") DllStructSetData($sRect, 3, $iW) DllStructSetData($sRect, 4, $iH) _WinAPI_AdjustWindowRectEx($sRect, _WinAPI_GetWindowLong($hwnd, $GWL_STYLE), _WinAPI_GetWindowLong($hwnd, $GWL_EXSTYLE)) WinMove($hwnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] + (DllStructGetData($sRect, 3) - $aWinPos[2]) - DllStructGetData($sRect, 1), $aWinPos[3] + (DllStructGetData($sRect, 4) - $aWinPos[3]) - DllStructGetData($sRect, 2)) EndFunc ;==>_WinSetClientSize ; ; #FUNCTION# ==================================================================================================================== ; Name...........: _GuiControlPanel ; Description ...: Creates a rectangular panel with adequate size to contain the required amount of controls ; and then fills it with the same controls by placing them according to the parameters ; Syntax.........: _GuiControlPanel($ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, $style, $exStyle, $xPos = 0, $yPos = 0, $xBorder, $yBorder, $xSpace = 1, $ySpace = 1, $Group = false, , $sGrpTitle = "") ; Parameters ....: $ControlType - Type of controls to be generated ("Button"; "Text"; ..... ; $nrPerLine - Nr. of controls per line in the matrix ; $nrOfLines - Nr. of lines in the matrix ; $ctrlWidth - Width of each control ; $ctrlHeight - Height of each control ; $Style - Defines the style of the control ; $exStyle - Defines the extended style of the control ; $xPanelPos - x Position of panel in GUI ; $yPanelPos - y Position of panel in GUI ; $xBorder - distance from lateral panel's borders to the matrix (width of left and right margin) default = 0 ; $yBorder - distance from upper and lower panel's borders to the matrix (width of upper and lower margin) default = 0 ; $xSpace - horizontal distance between the controls ; $ySpace - vertical distance between the controls ; $Group - if you want to group the controls (true or false) ; $sGrpTitle - title of the group (ignored if above is false) ; Return values .: an 1 based 1d array containing references to each control ; element [0] contains an 1d array containing various parameters about the panel ; Author ........: Gianni Addiego (Chimp) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _GuiControlPanel($ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, $style = -1, $exStyle = -1, $xPanelPos = 0, $yPanelPos = 0, $xBorder = 0, $yBorder = 0, $xSpace = 1, $ySpace = 1, $Group = False, $sGrpTitle = "") Local Static $sAllowedControls = "|Label|Input|Edit|Button|CheckBox|Radio|List|Combo|Pic|Icon|Graphic|" If Not StringInStr($sAllowedControls, '|' & $ControlType & '|') Then Return SetError(1, 0, "Unkown control") Local $PanelWidth = (($ctrlWidth + $xSpace) * $nrPerLine) - $xSpace + ($xBorder * 2) Local $PanelHeight = (($ctrlHeight + $ySpace) * $nrOfLines) - $ySpace + ($yBorder * 2) Local $hGroup If $Group Then If $sGrpTitle = "" Then $xPanelPos += 1 $yPanelPos += 1 $hGroup = GUICtrlCreateGroup("", $xPanelPos - 1, $yPanelPos - 7, $PanelWidth + 2, $PanelHeight + 8) Else $xPanelPos += 1 $yPanelPos += 15 $hGroup = GUICtrlCreateGroup($sGrpTitle, $xPanelPos - 1, $yPanelPos - 15, $PanelWidth + 2, $PanelHeight + 16) EndIf EndIf ; create the controls Local $aGuiGridCtrls[$nrPerLine * $nrOfLines + 1] Local $aPanelParams[14] = [ _ $ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, _ $xPanelPos, $yPanelPos, $xBorder, $yBorder, $xSpace, $ySpace, $PanelWidth, $PanelHeight, $hGroup] ReDim $idAddIcon[UBound($aGuiGridCtrls)] ReDim $idRemoveIcon[UBound($aGuiGridCtrls)] ReDim $idChangeIcon[UBound($aGuiGridCtrls)] For $i = 0 To $nrPerLine * $nrOfLines - 1 ; coordinates 1 based $col = Mod($i, $nrPerLine) + 1 ; Horizontal position within the grid (column) $row = Int($i / $nrPerLine) + 1 ; Vertical position within the grid (row) $left = $xPanelPos + ((($ctrlWidth + $xSpace) * $col) - $xSpace) - $ctrlWidth + $xBorder $top = $yPanelPos + ((($ctrlHeight + $ySpace) * $row) - $ySpace) - $ctrlHeight + $yBorder $text = $i + 1 ; "*" ; "." ; "(*)" ; create the control(s) $aGuiGridCtrls[$i + 1] = Execute("GUICtrlCreate" & $ControlType & "($text, $left, $top, $ctrlWidth, $ctrlHeight, $style, $exStyle)") If BitAND($exStyle, $WS_EX_ACCEPTFILES) = $WS_EX_ACCEPTFILES Then GUICtrlSetState($aGuiGridCtrls[$i + 1], $GUI_DROPACCEPTED) $idContextmenu = GUICtrlCreateContextMenu($aGuiGridCtrls[$i + 1]) $idAddIcon[$i] = GUICtrlCreateMenuItem("Add Icon", $idContextmenu) $idRemoveIcon[$i] = GUICtrlCreateMenuItem("Remove Icon", $idContextmenu) $idChangeIcon[$i] = GUICtrlCreateMenuItem("Change icon", $idContextmenu) Next If $Group Then GUICtrlCreateGroup("", -99, -99, 1, 1) ; close group $aGuiGridCtrls[0] = $aPanelParams Return $aGuiGridCtrls EndFunc ;==>_GuiControlPanel ; writes a value to an element of an array embedded in another array Func _SubArraySet(ByRef $aSubArray, $iElement, $vValue) $aSubArray[$iElement] = $vValue EndFunc ;==>_SubArraySet Func _ToggleGuiShowHide($hwnd, $bToggleGUI) If $bToggleGUI Then $bShowGUI = True DllCall($dllUser32, "int", "AnimateWindow", "hwnd", $hwnd, "int", 200, "long", Eval($GUI_IN)) ; show panel WinActivate($hwnd) Else $bShowGUI = False If Not $bFreezeWindow Then DllCall($dllUser32, "int", "AnimateWindow", "hwnd", $hwnd, "int", 200, "long", Eval($GUI_OUT)) ; hide panel EndIf EndFunc ;==>_ToggleGuiShowHide Func _Exit() Local $awPos If $bSaveSettings Then $awPos = WinGetPos($GUI) If $awPos[0] < 0 Then $awPos[0] = 0 If $awPos[1] < 0 Then $awPos[1] = 0 _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET LeftPos = " & $awPos[0] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET TopPos = " & $awPos[1] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET ButtonSize = " & $iStep & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET xColumns = " & ($aMyMatrix[0])[1] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIin = '" & $GUI_IN & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIout = '" & $GUI_OUT & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET Freeze = '" & $bFreezeWindow & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET StartUp = '" & $bStartUp & "';") EndIf _SQLite_Close($hSQLiteDB) _SQLite_Shutdown() EndFunc ;==>_Exit #Region --- Restart Program --- Func _RestartProgram() If @Compiled And StringRegExpReplace(FileGetShortName(@ScriptFullPath), "^.*\.", "") <> 'a3x' Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc ;==>_RestartProgram #EndRegion --- Restart Program --- Func _StartUpProgram($iStartup = True) If $iStartup And @Compiled And StringRegExpReplace(@ScriptFullPath, "^.*\.", "") <> 'a3x' Then FileCreateShortcut(@ScriptFullPath, @StartupDir & '\LaunchPad.lnk', $AppDataUser) ElseIf $iStartup Then FileCreateShortcut(@AutoItExe, @StartupDir & '\LaunchPad.lnk', $AppDataUser, FileGetShortName(@ScriptFullPath)) EndIf If Not $iStartup Then FileDelete(@StartupDir & '\LaunchPad.lnk') EndFunc ;==>_StartUpProgram Func _PickIconDlg($sFileName, $nIconIndex = 0, $hwnd = 0) Local $nRet, $aRetArr[2] $nRet = DllCall("shell32.dll", "int", "PickIconDlg", _ "hwnd", $hwnd, _ "wstr", $sFileName, "int", 1000, "int*", $nIconIndex) If Not $nRet[0] Then Return SetError(1, 0, -1) $aRetArr[0] = $nRet[2] $aRetArr[1] = $nRet[4] + 1 Return $aRetArr EndFunc ;==>_PickIconDlg Func _SQLite_LaunchPad($hwnd, $sqlCMD, $sqlExit = False) If Not _SQLite_Exec($hSQLiteDB, $sqlCMD) = $SQLITE_OK Then _ MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg() & @CRLF & @CRLF & $sqlCMD, 0, $GUI) If $sqlExit Then Exit -1 EndFunc ;==>_SQLite_LaunchPad ; Return an array which xMin[0], xMax[1], yMin[2], yMax[3] Func _GetVirtualScreen() ;~ 'Virtual Desktop sizes Local $SM_XVIRTUALSCREEN = 76 ; 'Virtual Left Local $SM_YVIRTUALSCREEN = 77 ; 'Virtual Top Local $SM_CXVIRTUALSCREEN = 78 ; 'Virtual Width Local $SM_CYVIRTUALSCREEN = 79 ; 'Virtual Height Dim $xyScreen[4] Local $posWin = WinGetPos($GUI) Dim $VirtualScreen[4] = [$SM_XVIRTUALSCREEN, $SM_CXVIRTUALSCREEN, $SM_YVIRTUALSCREEN, $SM_CYVIRTUALSCREEN] For $x = 0 To 3 $xTemp = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $VirtualScreen[$x]) If $x = 1 Then ;~ Note: $SM_CXVIRTUALSCREEN + $SM_XVIRTUALSCREEN = $RightSideScreen $xyScreen[$x] = ($xTemp[0] + $xyScreen[$x - 1]) - 1 Else $xyScreen[$x] = $xTemp[0] If $x = 3 Then $xyScreen[$x] -= 1 EndIf Next ;~ Note: The if statement below is to deal with multi monitors and undocked laptop move LaunchPad If (IsArray($posWin) And IsArray($xyScreen)) And ($posWin[0] > $xyScreen[1] Or $posWin[1] > $xyScreen[3]) Then $bSaveSettings = False WinMove($GUI, '', 0, 0) EndIf Return ($xyScreen) EndFunc ;==>_GetVirtualScreen Func _About() Local $sAboutText = 'LaunchPad you can easily create panels with buttons for starting applications on a Windows System.' $sAboutText &= @CRLF & @CRLF & 'Author: Chimp' & @CRLF $sAboutText &= 'Modify: Marcgforce, Danny35d' & @CRLF $sAboutText &= 'Credits: @KaFu, @Danyfirex, @mikell' GUISetState(@SW_DISABLE, $GUI) Local $AboutGUI = GuiCreate(' About LaunchPad' , 280, 160, Default, Default, $WS_CAPTION, Default, $GUI) GUISetBkColor (0xf8c848) GuiCtrlCreateLabel($sAboutText, 5, 10, 280, 100) GuiCtrlCreateLabel('____________________________________________', 10, 90, 260, 15, $SS_CENTER) ; separator $WebsiteLink = GuiCtrlCreateLabel('www.autoitscript.com/forum/topic/202048-button-deck/', 5, 105, 270, 20, $SS_CENTER) ; he he! GUICtrlSetCursor($WebsiteLink, 0) GUICtrlSetColor($WebsiteLink, 0x0000ff) Local $ok = GUICtrlCreateButton('OK', 10, 130, 70, 22, $BS_DEFPUSHBUTTON) GUISetState() While 1 $aboutMsg = GUIGetMsg() Select Case $aboutMsg = $GUI_EVENT_CLOSE ExitLoop Case $aboutMsg = $ok ExitLoop Case $aboutMsg = $WebsiteLink ShellExecute ('https://www.autoitscript.com/forum/topic/202048-button-deck/') EndSelect WEnd GUISetState(@SW_ENABLE, $GUI) GUIDelete($AboutGUI) Return EndFunc ;==>About Func Test() MsgBox(0, 0, ":)", 1) EndFunc ;==>Test  
  7. Like
    Danny35d got a reaction from Gianni in Button Deck   
    Hi Chimp, Nine and Marcforce very nice script.  Below are the changes I made on the script.
    Instead of Auto-hide after 5 secs now hide when GUI loose focus Removed Tray management of the deck Improve drag and drop Updated _RestartProgram() function to handle file with .a3x extension Added _GetVirtualScreen() function the handle better multi monitors and undocking laptop Added GUI animation and startup script when login Instead of saving shortcut and config into an ini file, now save to SQLite database Added way to export and import Lauchpad configurations Added About GUI Added and improve to Add, Remove buttons and change icon Improve how to get icons and execute files from extension .lnk  Added a way open the database for modification using 3rd party application called DB browser ; =============================================================================================================================== ; Title .........: LaunchPad ; Description ...: button deck to be used as an applications launcher (and not only) ; Author(s) .....: Chimp (Gianni Addiego) ; credits to @KaFu, @Danyfirex, @mikell (see comments for references) ; Modification ..: Marcgforce (drag and drop add, passing ini to links) ; Danny35d Replace passing ini for a SQLite DB, improve drag and drop, improve func called _RestartProgram ; to be able to execute file with the extension .a3x, added func called _GetVirtualScreen to better ; handle Multi monitors and undocking laptop, added GUI animation and Choice to startup when you login. ; URL ...........: https://www.autoitscript.com/forum/topic/202048-button-deck/ ; =============================================================================================================================== #NoTrayIcon #include <Misc.au3> #include <Array.au3> #include <Crypt.au3> #include <String.au3> #include <SQLite.au3> #include <WinAPI.au3> #include <SQLite.dll.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If _Singleton("LaunchPadApps", 2) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "An occurrence of LaunchPad is already running.") Exit EndIf ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) OnAutoItExitRegister('_Exit') ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing Global Const $WMSZ_LEFT = 1 Global Const $WMSZ_RIGHT = 2 Global Const $WMSZ_TOP = 3 Global Const $WMSZ_TOPLEFT = 4 Global Const $WMSZ_TOPRIGHT = 5 Global Const $WMSZ_BOTTOM = 6 Global Const $WMSZ_BOTTOMLEFT = 7 Global Const $WMSZ_BOTTOMRIGHT = 8 Global Enum $vButton_Tip = 0, $vButton_IconPath, $vButton_IconNumber, $vButton_Command, $vButton_UniqueID Global Const $AW_FADE_IN = 0x00080000 ;fade-in Global Const $AW_FADE_OUT = 0x00090000 ;fade-out Global Const $AW_SLIDE_IN_LEFT = 0x00040001 ;slide in from left Global Const $AW_SLIDE_OUT_LEFT = 0x00050002 ;slide out to left Global Const $AW_SLIDE_IN_RIGHT = 0x00040002 ;slide in from right Global Const $AW_SLIDE_OUT_RIGHT = 0x00050001 ;slide out to right Global Const $AW_SLIDE_IN_TOP = 0x00040004 ;slide-in from top Global Const $AW_SLIDE_OUT_TOP = 0x00050008 ;slide-out to top Global Const $AW_SLIDE_IN_BOTTOM = 0x00040008 ;slide-in from bottom Global Const $AW_SLIDE_OUT_BOTTOM = 0x00050004 ;slide-out to bottom Global Const $AW_DIAG_SLIDE_IN_TOP_LEFT = 0x00040005 ;diag slide-in from Top-left Global Const $AW_DIAG_SLIDE_OUT_TOP_LEFT = 0x0005000a ;diag slide-out to Top-left Global Const $AW_DIAG_SLIDE_IN_TOP_RIGHT = 0x00040006 ;diag slide-in from Top-Right Global Const $AW_DIAG_SLIDE_OUT_TOP_RIGHT = 0x00050009 ;diag slide-out to Top-Right Global Const $AW_DIAG_SLIDE_IN_BOTTOM_LEFT = 0x00040009 ;diag slide-in from Bottom-left Global Const $AW_DIAG_SLIDE_OUT_BOTTOM_LEFT = 0x00050006 ;diag slide-out to Bottom-left Global Const $AW_DIAG_SLIDE_IN_BOTTOM_RIGHT = 0x0004000a ;diag slide-in from Bottom-right Global Const $AW_DIAG_SLIDE_OUT_BOTTOM_RIGHT = 0x00050005 ;diag slide-out to Bottom-right Global Const $AW_EXPLODE = 0x00040010 ;explode Global Const $AW_IMPLODE = 0x00050010 ;implode Local Const $AppDataUser = @LocalAppDataDir & '\LaunchPad' Local Const $dll_icons = $AppDataUser & '\Bin\iconset.dll' Local $aAnimation = StringSplit('Explode|Fade In|Slide In Left|Slide In Right|Slide In Top|Slide In Bottom|Diag Slide In Top Left|Diag Slide In Top Right|Diag Slide In Bottom Left|Diag Slide In Bottom Right', '|', 2) If Not FileExists($AppDataUser) Then DirCreate($AppDataUser) If Not FileExists($AppDataUser & '\Bin') Then DirCreate($AppDataUser & '\Bin') If Not FileExists($AppDataUser & '\Icons') Then DirCreate($AppDataUser & '\Icons') If Not FileExists($AppDataUser & "\BackupDB") Then DirCreate($AppDataUser & "\BackupDB") If Not FileExists($AppDataUser & '\Bin\iconset.dll') Then FileInstall('.\Include\iconset.dll', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3.exe') Then FileInstall('.\Include\sqlite3.exe', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3.dll') Then FileInstall('.\Include\sqlite3.dll', $AppDataUser & '\Bin\') If Not FileExists($AppDataUser & '\Bin\sqlite3_x64.dll') Then FileInstall('.\Include\sqlite3_x64.dll', $AppDataUser & '\Bin\') #cs The following 2D array contains the settings that determine the behavior of each "Button" namely 4 parameters for each row (for each button); [n][0] the tooltip of the button [n][1] path of an icon or a file containing icons [n][2] the number of the icon (if the previous parameter is a collection) [n][3] AutoIt command(s) to be executed directly on button click (or also the name of a function) #ce Global $aTools[][] = [ _ ['Administrative Tools', 'SHELL32.dll', 177, 'run("explorer.exe shell:::{D20EA4E1-3957-11d2-A40B-0C5020524153}")', ''], _ ['Windows version', 'winver.exe', 1, 'run("explorer.exe shell:::{BB06C0E4-D293-4f75-8A90-CB05B6477EEE}")', ''], _ ; or "Run('winver.exe')" ['This computer', 'netcenter.dll', 6, 'run("explorer.exe shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")', ''], _ ['Devices and Printers', 'SHELL32.dll', 272, 'run("explorer.exe shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}")', ''], _ ['Folder options', 'SHELL32.dll', 210, 'run("explorer.exe shell:::{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}")', ''], _ ['Command Prompt', @ComSpec, 1, 'Run(@ComSpec)', ''], _ ['Internet Explorer', @ProgramFilesDir & '\Internet Explorer\iexplore.exe', 1, "Run(@ProgramFilesDir & '\Internet Explorer\iexplore.exe')", ''], _ ['Media Player', @ProgramFilesDir & '\Windows media player\wmplayer.exe', 1, "Run(@ProgramFilesDir & '\Windows media player\wmplayer.exe')", ''], _ ['File browser', @WindowsDir & '\explorer.exe', 1, "Run(@WindowsDir & '\explorer.exe')", ''], _ ['Notepad', @SystemDir & '\notepad.exe', 1, "Run(@SystemDir & '\notepad.exe')", ''], _ ['Wordpad', @SystemDir & '\write.exe', 1, "Run(@SystemDir & '\write.exe')", ''], _ ['Registry editor', @SystemDir & '\regedit.exe', 1, "ShellExecute('regedit.exe')", ''], _ ['Connect to', 'netcenter.dll', 19, 'run("explorer.exe shell:::{38A98528-6CBF-4CA9-8DC0-B1E1D10F7B1B}")', ''], _ ['Calculator', @SystemDir & '\Calc.exe', 1, "Run(@SystemDir & '\calc.exe')", ''], _ ['Control panel', 'control.exe', 1, 'run("explorer.exe shell:::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}")', ''], _ ['Users manager', @SystemDir & '\Netplwiz.exe', 1, "ShellExecute('Netplwiz.exe')", ''], _ ; {7A9D77BD-5403-11d2-8785-2E0420524153} ['Run', 'SHELL32.dll', 25, 'Run("explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}")', ''], _ ['Search files', 'SHELL32.dll', 135, 'run("explorer.exe shell:::{9343812e-1c37-4a49-a12e-4b2d810d956b}")', ''], _ ['On screen Magnifier', @SystemDir & '\Magnify.exe', 1, "ShellExecute('Magnify.exe')", ''], _ ['Paint', @SystemDir & '\mspaint.exe', 1, "Run(@SystemDir & '\mspaint.exe')", ''], _ ['Remote desktop', @SystemDir & '\mstsc.exe', 1, " Run('mstsc.exe')", ''], _ ['Resource monitoring', @SystemDir & '\resmon.exe', 1, "Run('resmon.exe')", ''], _ ['Device manager', 'SHELL32.dll', 13, 'Run("explorer.exe Shell:::{74246bfc-4c96-11d0-abef-0020af6b0b7a}")', ''], _ ['Audio', 'SndVol.exe', 1, 'Run("explorer.exe Shell:::{F2DDFC82-8F12-4CDD-B7DC-D4FE1425AA4D}")', ''], _ ; or 'run(@SystemDir & "\SndVol.exe")'] ['Task view', 'SHELL32.dll', 133, 'Run("explorer.exe shell:::{3080F90E-D7AD-11D9-BD98-0000947B0257}")', ''], _ ['Task Manager', @SystemDir & '\taskmgr.exe', 1, 'Send("^+{ESC}")', ''], _ ; "Run(@SystemDir & '\taskmgr.exe')"], _ ['On Screen Keyboard', 'osk.exe', 1, 'ProcessExists("osc.exe") ? False : ShellExecute("osk.exe")', ''], _ ; <-- ternary example ['... if Notepad is running Send F5 to it', 'SHELL32.dll', 167, ' WinExists("[CLASS:Notepad]") ? ControlSend("[CLASS:Notepad]", "", "", "{F5}") : MsgBox(16, ":(", "Notepad not found", 2)', ''] _ ; Check if Notepad is currently running ] ; Show desktop {3080F90D-D7AD-11D9-BD98-0000947B0257} ; Desktop Background {ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} ; IE internet option {A3DD4F92-658A-410F-84FD-6FBBBEF2FFFE} ; ['Notes', 'StikyNot.exe', 1, "ShellExecute('StikyNot')"], _ Global $GUI, $hSQLiteDB, $tmpVirtualScreen Global $bSaveSettings = True, $bShowGUI = True Global $SQLiteDB = $AppDataUser & '\Launchpad.sqlite' Local $sqlRow, $sqlColumn Local $SQLiteDBExists = FileExists($SQLiteDB) Global $sSQliteDll = _SQLite_Startup($AppDataUser & '\Bin\sqlite3.dll', False, 1) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _ "Not FOUND in " & $AppDataUser & '\Bin\') $bSaveSettings = False Exit -1 Else $hSQLiteDB = _SQLite_Open($SQLiteDB) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't open or create a permanent Database!" & @CRLF & @CRLF & $SQLiteDB) $bSaveSettings = False Exit -1 EndIf EndIf _SQLite_LaunchPad($hSQLiteDB, "CREATE TABLE IF NOT EXISTS Buttons(Name TEXT, Icon TEXT, IconNum INTEGER, Execute TEXT, Button_ID INTEGER PRIMARY KEY);") _SQLite_LaunchPad($hSQLiteDB, "CREATE TABLE IF NOT EXISTS Settings(LeftPos INTEGER, TopPos INTEGER, ButtonSize INTEGER, xColumns INTEGER, GUIin TEXT, GUIout TEXT, Freeze TEXT, StartUp TEXT);") If Not $SQLiteDBExists Then _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Settings VALUES(10, 10, 40, " & Ceiling(UBound($aTools) / 2) & ",'AW_EXPLODE', 'AW_IMPLODE', 'False', 'False');") For $x = 0 To UBound($aTools) - 1 $aTools[$x][$vButton_Command] = StringReplace($aTools[$x][$vButton_Command], "'", '"') _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('" & $aTools[$x][$vButton_Tip] & "','" & $aTools[$x][$vButton_IconPath] & "'," & $aTools[$x][$vButton_IconNumber] & ",'" & $aTools[$x][$vButton_Command] & "');") Next EndIf _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) _SQLite_QuerySingleRow($hSQLiteDB, "SELECT LeftPos FROM Settings;", $sqlRow) Global $iLeftPos = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT TopPos FROM Settings;", $sqlRow) Global $iTopPos = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT ButtonSize FROM Settings;", $sqlRow) Global $iStep = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT xColumns FROM Settings;", $sqlRow) Global $iNrPerLine = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT GUIin FROM Settings;", $sqlRow) Global $GUI_IN = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT GUIout FROM Settings;", $sqlRow) Global $GUI_OUT = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT Freeze FROM Settings;", $sqlRow) Global $bFreezeWindow = $sqlRow[0] _SQLite_QuerySingleRow($hSQLiteDB, "SELECT StartUp FROM Settings;", $sqlRow) Global $bStartUp = $sqlRow[0] If Not IsBool($bFreezeWindow) And $bFreezeWindow = 'True' Then $bFreezeWindow = True ElseIf Not IsBool($bFreezeWindow) And $bFreezeWindow = 'False' Then $bFreezeWindow = False EndIf If Not IsBool($bStartUp) And $bStartUp = 'True' Then $bStartUp = True ElseIf Not IsBool($bStartUp) And $bStartUp = 'False' Then $bStartUp = False EndIf Global $idAddIcon[1], $idRemoveIcon[1], $idChangeIcon[1] Global $iNrOfLines = Ceiling(UBound($aTools) / $iNrPerLine) Global $dllUser32 = DllOpen("user32.dll") $GUI = GUICreate('Launch Pad', 10, 10, $iLeftPos, $iTopPos, BitOR($WS_THICKFRAME, 0), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_ACCEPTFILES)) Global $GuiContextMenu = GUICtrlCreateContextMenu() Global $idFreezeWindow = GUICtrlCreateMenuItem("Freeze", $GuiContextMenu) Global $idSettings = GUICtrlCreateMenu("Settings", $GuiContextMenu, 1) Global $idDatabase = GUICtrlCreateMenu("Database", $idSettings) Global $idOpenDB = GUICtrlCreateMenuItem("Open DB", $idDatabase) Global $idExportDB = GUICtrlCreateMenuItem("Export DB", $idDatabase) Global $idImportDB = GUICtrlCreateMenuItem("Import DB", $idDatabase) Global $idStartUp = GUICtrlCreateMenuItem("StartUp", $idSettings) Global $idAnimation = GUICtrlCreateMenu("Animate", $GuiContextMenu, 1) GUICtrlCreateMenuItem("", $GuiContextMenu) Global $idAbout = GUICtrlCreateMenuItem("About", $GuiContextMenu) $aMyMatrix = _GuiControlPanel("Button", $iNrPerLine, $iNrOfLines, $iStep, $iStep, BitOR(0x40, 0x1000), -1, 0, 0, 0, 0, 0, 0, False, "") Global $iPreviousX = ($aMyMatrix[0])[1], $iPreviousY = ($aMyMatrix[0])[2] ReDim $idAddIcon[UBound($aMyMatrix)] ReDim $idRemoveIcon[UBound($aMyMatrix)] ReDim $idChangeIcon[UBound($aMyMatrix)] ReDim $aTools[UBound($aMyMatrix)][5] ; Be sure none of the array elements are NULL, otherwise _ArraySearch failed For $i = 0 To UBound($aMyMatrix) - 1 If $idAddIcon[$i] = '' Then $idAddIcon[$i] = 9999 If $idRemoveIcon[$i] = '' Then $idRemoveIcon[$i] = 9999 If $idChangeIcon[$i] = '' Then $idChangeIcon[$i] = 9999 Next For $i = 0 To UBound($aAnimation) - 1 $aAnimation[$i] = GUICtrlCreateMenuItem($aAnimation[$i], $idAnimation) Next For $i = 1 To UBound($aMyMatrix) - 1 GUICtrlSetResizing($aMyMatrix[$i], $GUI_DOCKALL) ; (2+32+256+512) so the control will not move during resizing If $i <= UBound($aTools) Then GUICtrlSetImage($aMyMatrix[$i], $aTools[$i - 1][$vButton_IconPath], $aTools[$i - 1][$vButton_IconNumber]) GUICtrlSetTip($aMyMatrix[$i], $aTools[$i - 1][$vButton_Tip]) EndIf Next _WinSetClientSize($GUI, ($aMyMatrix[0])[11], ($aMyMatrix[0])[12]) ; thanks to KaFu If $bFreezeWindow Then GUICtrlSetState($idFreezeWindow, $GUI_CHECKED) If $bStartUp Then GUICtrlSetState($idStartUp, $GUI_CHECKED) GUISetState() ; https://devblogs.microsoft.com/oldnewthing/20110218-00/?p=11453 GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_SIZING, "WM_SIZING") _MainLoop() _Exit() Func _MainLoop() Local $iDeltaX, $iDeltaY, $row, $col, $left, $top, $awPos, $iAnswer, $sTemp Local $hTimer, $sFileDialog, $sBackupName While 1 Sleep(10) $xyVirtualScreen = _GetVirtualScreen() If Not WinActive($GUI) And Not $bFreezeWindow And $bShowGUI Then _ToggleGuiShowHide($GUI, False) $aPos = MouseGetPos() $hTimer = TimerInit() While ($aPos[0] = $xyVirtualScreen[0] Or $aPos[1] = $xyVirtualScreen[2] Or $aPos[0] = $xyVirtualScreen[1] Or $aPos[1] = $xyVirtualScreen[3]) And Not $bFreezeWindow $aPos = MouseGetPos() If TimerDiff($hTimer) > 1000 Then _ToggleGuiShowHide($GUI, True) Sleep(10) WEnd $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED Local $iAnswer = $IDNO Local $ProposeLink = StringSplit(@GUI_DragFile, '\') $ProposeLink = StringRegExpReplace($ProposeLink[UBound($ProposeLink) - 1], '(.*)\..*', "$1") $i = _ArrayBinarySearch($aMyMatrix, @GUI_DropId) If $i <> -1 Then If $aTools[$i - 1][$vButton_Command] <> '' Then $iAnswer = MsgBox($MB_YESNO, "LauchPad Drag & Drop", "Are you sure you want to overwrite " & $aTools[$i - 1][$vButton_Tip] & " shortcut?", 0, $GUI) Else $iAnswer = $IDYES EndIf If $iAnswer = $IDYES Then $sTemp = '' Local $sReponse = InputBox("Icon name", "Give the shortcut a title", $ProposeLink) If @error <> 1 Or $sReponse <> '' Then $aTools[$i - 1][$vButton_Tip] = $sReponse $aTools[$i - 1][$vButton_IconNumber] = 1 $aTools[$i - 1][$vButton_IconPath] = $dll_icons $aTools[$i - 1][$vButton_Command] = @GUI_DragFile $sExt = StringRegExpReplace($aTools[$i - 1][$vButton_Command], "^.*\.", "") ; extraction of its extension Switch $sExt Case "doc", "docx", "odt" $aTools[$i - 1][$vButton_IconNumber] = 436 Case "xls", "xlsx", "ods" $aTools[$i - 1][$vButton_IconNumber] = 441 Case "pdf" $aTools[$i - 1][$vButton_IconNumber] = 400 Case "ppt", "pptx", "odp" $aTools[$i - 1][$vButton_IconNumber] = 431 Case "txt", "rtf" $aTools[$i - 1][$vButton_IconNumber] = 406 Case "msg" $aTools[$i - 1][$vButton_IconNumber] = 426 Case Else If $sExt = 'lnk' Then $aDetails = FileGetShortcut($aTools[$i - 1][$vButton_Command]) If IsArray($aDetails) Then $sTemp = $aTools[$i - 1][$vButton_Command] If $aDetails[4] <> '' Then $aTools[$i - 1][$vButton_Command] = $aDetails[4] Else $aTools[$i - 1][$vButton_Command] = $aDetails[0] EndIf EndIf EndIf If _WinAPI_ExtractIconEx($aTools[$i - 1][$vButton_Command], -1, 0, 0, 0) > 0 Then ; allows you to test if the file has one or more icon (s) Local $aIcon[3] = [64, 32, 16] For $a = 0 To UBound($aIcon) - 1 $aIcon[$a] = _WinAPI_Create32BitHICON(_WinAPI_ShellExtractIcon($aTools[$i - 1][$vButton_Command], 0, $aIcon[$a], $aIcon[$a]), 1) Next $aTools[$i - 1][$vButton_IconPath] = $AppDataUser & '\Icons\' & $aTools[$i - 1][$vButton_Tip] & '.ico' _WinAPI_SaveHICONToFile($aTools[$i - 1][$vButton_IconPath], $aIcon) For $a = 0 To UBound($aIcon) - 1 _WinAPI_DestroyIcon($aIcon[$a]) Next Else $aRet = _PickIconDlg($dll_icons) If Not @error Then If GUICtrlSetImage(@GUI_DropId, $aRet[0], $aRet[1]) Then $aTools[$i - 1][$vButton_IconPath] = $aRet[0] $aTools[$i - 1][$vButton_IconNumber] = $aRet[1] EndIf EndIf EndIf EndSwitch EndIf If $sTemp <> '' Then $aTools[$i - 1][$vButton_Command] = $sTemp If $aTools[$i - 1][$vButton_UniqueID] <> '' And $iAnswer = $IDYES Then _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Name = '" & $aTools[$i - 1][$vButton_Tip] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Execute = '" & $aTools[$i - 1][$vButton_Command] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Icon = '" & $aTools[$i - 1][$vButton_IconPath] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET IconNum = '" & $aTools[$i - 1][$vButton_IconNumber] & "' WHERE Button_ID = " & $aTools[$i - 1][$vButton_UniqueID] & ";") Else _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('" & $aTools[$i - 1][$vButton_Tip] & "', '" & $aTools[$i - 1][$vButton_IconPath] & "', " & $aTools[$i - 1][$vButton_IconNumber] & ", '" & $aTools[$i - 1][$vButton_Command] & "');") _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) ReDim $aTools[UBound($aMyMatrix)][5] EndIf If $iAnswer = $IDYES Then GUICtrlSetTip(@GUI_DropId, $aTools[$i - 1][$vButton_Tip]) GUICtrlSetImage(@GUI_DropId, $aTools[$i - 1][$vButton_IconPath], $aTools[$i - 1][$vButton_IconNumber]) EndIf EndIf EndIf Case $idFreezeWindow If BitAND(GUICtrlRead($idFreezeWindow), $GUI_UNCHECKED) = $GUI_UNCHECKED Then $bFreezeWindow = True GUICtrlSetState($idFreezeWindow, $GUI_CHECKED) Else $bFreezeWindow = False GUICtrlSetState($idFreezeWindow, $GUI_UNCHECKED) EndIf Case $idStartUp If BitAND(GUICtrlRead($idStartUp), $GUI_UNCHECKED) = $GUI_UNCHECKED Then $bStartUp = True _StartUpProgram($bStartUp) GUICtrlSetState($idStartUp, $GUI_CHECKED) Else $bStartUp = False _StartUpProgram($bStartUp) GUICtrlSetState($idStartUp, $GUI_UNCHECKED) EndIf Case $idOpenDB If Not FileExists($AppDataUser & '\SQLiteDatabaseBrowserPortable') Then If MsgBox($MB_YESNO, "LauchPad DB Browser", "DB Browser for SQLite Portable is needed to change settings or buttons." & @CRLF & _StringRepeat(' ', 30) & "Do you want to download DB Browser?", 0, $GUI) = $IDYES Then ShellExecute('https://portableapps.com/apps/development/sqlite_database_browser_portable') MsgBox($MB_OK, "LauchPad DB Browser", "Installing DB Browser for SQLite Portable" & @CRLF & @CRLF & _ '1) Press green button to download DB Browser' & @CRLF & @CRLF & '2) Execute the downloaded file' & @CRLF & @CRLF & _ '3) Press Next and Destination Folder is ' & $AppDataUser & @CRLF & @CRLF & '4) Press Install and then Finish', 0, $GUI) EndIf Else $dHash = _Crypt_HashFile($SQLiteDB, $CALG_MD5) ShellExecuteWait($AppDataUser & '\SQLiteDatabaseBrowserPortable\SQLiteDatabaseBrowserPortable.exe', $SQLiteDB) If $dHash <> _Crypt_HashFile($SQLiteDB, $CALG_MD5) Then $bSaveSettings = False _RestartProgram() EndIf EndIf Case $idExportDB $sBackupName = 'LaunchPad-' & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & '.sql' $sFileDialog = FileSaveDialog('Export DB - LaunchPad', $AppDataUser & "\BackupDB\", "SQLite (*.sql)", BitOR($FD_PATHMUSTEXIST, $FD_PROMPTOVERWRITE), $sBackupName, $GUI) If Not @error Then $sTemp = '.open ' & StringReplace($SQLiteDB, '\', '/') & @CRLF $sTemp &= '.once "' & StringReplace($sFileDialog, '\', '/') & '"' & @CRLF $sTemp &= '.dump' & @CRLF & '.exit' & @CRLF _SQLite_SQLiteExe($SQLiteDB, $sTemp, $row, $AppDataUser & '\Bin\sqlite3.exe') EndIf Case $idImportDB $sFileDialog = FileOpenDialog('Import DB - LaunchPad', $AppDataUser & "\BackupDB\", "SQLite (*.sql)|All (*.*)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST), '', $GUI) If Not @error Then $bSaveSettings = False $sTemp = '.open ' & StringReplace($SQLiteDB, '\', '/') & @CRLF $sTemp &= 'DROP TABLE IF EXISTS Buttons;' & @CRLF $sTemp &= 'DROP TABLE IF EXISTS Settings;' & @CRLF $sTemp &= '.read "' & StringReplace($sFileDialog, '\', '/') & '"' & @CRLF $sTemp &= '.exit' & @CRLF _SQLite_SQLiteExe($SQLiteDB, $sTemp, $row, $AppDataUser & '\Bin\sqlite3.exe') _RestartProgram() EndIf Case $idAbout _About() Case Else $i = _ArraySearch($aMyMatrix, $Msg) If $i <> -1 Then If $aTools[$i - 1][$vButton_Command] <> '' Then $dummy = Execute($aTools[$i - 1][$vButton_Command]) If @error Then ShellExecute($aTools[$i - 1][$vButton_Command]) ElseIf $aTools[$i - 1][$vButton_Command] = '' Then MsgBox($MB_OK, "LauchPad Execute Shortcut", "This shortcut doesn't have an Application associated.", 0, $GUI) EndIf EndIf $i = _ArraySearch($aAnimation, $Msg) If $i <> -1 Then If GUICtrlRead($Msg, 1) = 'Explode' Then $GUI_IN = 'AW_EXPLODE' $GUI_OUT = 'AW_IMPLODE' Else $GUI_IN = 'AW_' & StringReplace(GUICtrlRead($Msg, 1), ' ', '_') $GUI_OUT = StringReplace($GUI_IN, '_In', '_Out') EndIf _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIin = '" & $GUI_IN & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIout = '" & $GUI_OUT & "';") ; Need to add focus EndIf $i = _ArraySearch($idAddIcon, $Msg) If $i <> -1 Then _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('', '', '', '');") _RestartProgram() EndIf $i = _ArraySearch($idRemoveIcon, $Msg) If $i <> -1 Then If MsgBox($MB_YESNO, "LauchPad Removing Icon", "Are you sure you want to delete " & $aTools[$i][$vButton_Tip] & " shortcut?", 0, $GUI) = $IDYES Then _SQLite_LaunchPad($hSQLiteDB, 'DELETE FROM Buttons WHERE Button_ID = ' & $aTools[$i][$vButton_UniqueID] & ';') If StringInStr($aTools[$i][$vButton_IconPath], $AppDataUser & '\Icons') Then FileDelete($aTools[$i][$vButton_IconPath]) _RestartProgram() EndIf EndIf $i = _ArraySearch($idChangeIcon, $Msg) If $i <> -1 Then $aRet = _PickIconDlg($dll_icons) If Not @error Then If GUICtrlSetImage($aMyMatrix[$i + 1], $aRet[0], $aRet[1]) Then $aTools[$i][$vButton_IconPath] = $aRet[0] $aTools[$i][$vButton_IconNumber] = $aRet[1] If $aTools[$i][$vButton_UniqueID] <> '' Then _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET Icon = '" & $aTools[$i][$vButton_IconPath] & "' WHERE Button_ID = " & $aTools[$i][$vButton_UniqueID] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Buttons SET IconNum = '" & $aTools[$i][$vButton_IconNumber] & "' WHERE Button_ID = " & $aTools[$i][$vButton_UniqueID] & ";") Else _SQLite_LaunchPad($hSQLiteDB, "INSERT INTO Buttons (Name, Icon, IconNum, Execute) VALUES ('', '" & $aTools[$i][$vButton_IconPath] & "', " & $aTools[$i][$vButton_IconNumber] & ", '');") _SQLite_GetTable2d($hSQLiteDB, "SELECT * FROM Buttons;", $aTools, $sqlRow, $sqlColumn) _ArrayDelete($aTools, 0) ReDim $aTools[UBound($aMyMatrix)][5] EndIf EndIf EndIf EndIf EndSwitch ; check if any size has changed If $iPreviousX <> ($aMyMatrix[0])[1] Or $iPreviousY <> ($aMyMatrix[0])[2] Then ; calculate the variations $iDeltaX = Abs($iPreviousX - ($aMyMatrix[0])[1]) $iDeltaY = Abs($iPreviousY - ($aMyMatrix[0])[2]) ; if both dimensions changed at the same time, the largest variation prevails over the other If $iDeltaX >= $iDeltaY Then ; keep the new number of columns ; calculate and set the correct number of lines accordingly _SubArraySet($aMyMatrix[0], 2, Ceiling((UBound($aMyMatrix) - 1) / ($aMyMatrix[0])[1])) Else ; otherwise keep the new number of rows ; calculate and set the correct number of columns accordingly _SubArraySet($aMyMatrix[0], 1, Ceiling((UBound($aMyMatrix) - 1) / ($aMyMatrix[0])[2])) EndIf ; set client area new sizes _WinSetClientSize($GUI, ($aMyMatrix[0])[1] * $iStep, ($aMyMatrix[0])[2] * $iStep) ; remember the new panel settings $iPreviousX = ($aMyMatrix[0])[1] $iPreviousY = ($aMyMatrix[0])[2] ; rearrange the controls inside the panel For $i = 0 To UBound($aMyMatrix) - 2 ; coordinates 1 based $col = Mod($i, $iPreviousX) + 1 ; Horizontal position within the grid (column) $row = Int($i / $iPreviousX) + 1 ; Vertical position within the grid (row number) $left = ($aMyMatrix[0])[5] + (((($aMyMatrix[0])[3] + ($aMyMatrix[0])[9]) * $col) - ($aMyMatrix[0])[9]) - ($aMyMatrix[0])[3] + ($aMyMatrix[0])[7] $top = ($aMyMatrix[0])[6] + (((($aMyMatrix[0])[4] + ($aMyMatrix[0])[10]) * $row) - ($aMyMatrix[0])[10]) - ($aMyMatrix[0])[4] + ($aMyMatrix[0])[8] GUICtrlSetPos($aMyMatrix[$i + 1], $left, $top) Next EndIf WEnd EndFunc ;==>_MainLoop ; Allow/Disallow specific borders resizing ; thanks to Danyfirex ; --------- ; https://www.autoitscript.com/forum/topic/201464-partially-resizable-window-how-solved-by-danyfirex-%F0%9F%91%8D/?do=findComment&comment=1445748 Func WM_NCHITTEST($hwnd, $iMsg, $iwParam, $ilParam) If $hwnd = $GUI Then Local $iRet = _WinAPI_DefWindowProc($hwnd, $iMsg, $iwParam, $ilParam) ; https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-nchittest If $iRet = $HTBOTTOM Or $iRet = $HTRIGHT Or $iRet = $HTBOTTOMRIGHT Then ; allowed resizing Return $iRet ; default process of border resizing Else ; resizing not allowed Return $HTCLIENT ; do like if cursor is in the client area EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTEST ; controls and process resizing operations in real time ; thanks to mikell ; ------ ; https://www.autoitscript.com/forum/topic/201464-partially-resizable-window-how-solved-by-danyfirex-%F0%9F%91%8D/?do=findComment&comment=1445754 Func WM_SIZING($hwnd, $iMsg, $wparam, $lparam) ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing Local $iCols = ($aMyMatrix[0])[1] Local $iRows = ($aMyMatrix[0])[2] Local $xClientSizeNew, $yClientSizeNew #cs $wparam The edge of the window that is being sized. $lparam A pointer to a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure. Return value Type: LRESULT #ce $wparam $aPos = WinGetPos($GUI) #cs Success : a 4 - element array containing the following information : $aArray[0] = X position $aArray[1] = Y position $aArray[2] = Width #ce Success : a 4 - element array containing the following information : $aPos2 = WinGetClientSize($GUI) #cs Success: a 2-element array containing the following information: $aArray[0] = Width of window's client area #ce Success: a 2-element array containing the following information: ; https://docs.microsoft.com/en-us/previous-versions//dd162897(v=vs.85) Local $sRect = DllStructCreate("Int[4]", $lparam) ; outer dimensions (includes borders) Local $left = DllStructGetData($sRect, 1, 1) Local $top = DllStructGetData($sRect, 1, 2) Local $Right = DllStructGetData($sRect, 1, 3) Local $bottom = DllStructGetData($sRect, 1, 4) ; border width Local $iEdgeWidth = ($aPos[2] - $aPos2[0]) / 2 Local $iHeadHeigth = $aPos[3] - $aPos2[1] - $iEdgeWidth * 2 Local $aEdges[2] $aEdges[0] = $aPos[2] - $aPos2[0] ; x $aEdges[1] = $aPos[3] - $aPos2[1] ; y $xClientSizeNew = $Right - $left - $aEdges[0] $xClientSizeNew = Round($xClientSizeNew / $iStep) * $iStep $yClientSizeNew = $bottom - $top - $aEdges[1] $yClientSizeNew = Round($yClientSizeNew / $iStep) * $iStep Switch $wparam Case $WMSZ_RIGHT ; calculate the new position of the right border DllStructSetData($sRect, 1, $left + $xClientSizeNew + $aEdges[0], 3) Case $WMSZ_BOTTOM ; calculate the new position of the bottom border DllStructSetData($sRect, 1, $top + $yClientSizeNew + $aEdges[1], 4) Case $WMSZ_BOTTOMRIGHT ; calculate the new position of both borders DllStructSetData($sRect, 1, $left + $xClientSizeNew + $aEdges[0], 3) DllStructSetData($sRect, 1, $top + $yClientSizeNew + $aEdges[1], 4) EndSwitch #cs If DllStructGetData($sRect, 1, 3) > @DesktopWidth Then ; $Right DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 3) - $iStep, 3) $xClientSizeNew -= $iStep EndIf If DllStructGetData($sRect, 1, 4) > @DesktopHeight Then ; $bottom DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 4), 4) $yClientSizeNew -= $iStep #ce If DllStructGetData($sRect, 1, 3) > @DesktopWidth Then ; $Right ; check if number of rows has changed If $iRows <> $yClientSizeNew / $iStep Then _SubArraySet($aMyMatrix[0], 2, $yClientSizeNew / $iStep) EndIf ; check if number of columns has changed If $iCols <> $xClientSizeNew / $iStep Then _SubArraySet($aMyMatrix[0], 1, $xClientSizeNew / $iStep) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZING ; set client area new sizes ; thanks to KaFu ; ---- ; https://www.autoitscript.com/forum/topic/201524-guicreate-and-wingetclientsize-mismatch/?do=findComment&comment=1446141 Func _WinSetClientSize($hwnd, $iW, $iH) Local $aWinPos = WinGetPos($hwnd) Local $sRect = DllStructCreate("int;int;int;int;") DllStructSetData($sRect, 3, $iW) DllStructSetData($sRect, 4, $iH) _WinAPI_AdjustWindowRectEx($sRect, _WinAPI_GetWindowLong($hwnd, $GWL_STYLE), _WinAPI_GetWindowLong($hwnd, $GWL_EXSTYLE)) WinMove($hwnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] + (DllStructGetData($sRect, 3) - $aWinPos[2]) - DllStructGetData($sRect, 1), $aWinPos[3] + (DllStructGetData($sRect, 4) - $aWinPos[3]) - DllStructGetData($sRect, 2)) EndFunc ;==>_WinSetClientSize ; ; #FUNCTION# ==================================================================================================================== ; Name...........: _GuiControlPanel ; Description ...: Creates a rectangular panel with adequate size to contain the required amount of controls ; and then fills it with the same controls by placing them according to the parameters ; Syntax.........: _GuiControlPanel($ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, $style, $exStyle, $xPos = 0, $yPos = 0, $xBorder, $yBorder, $xSpace = 1, $ySpace = 1, $Group = false, , $sGrpTitle = "") ; Parameters ....: $ControlType - Type of controls to be generated ("Button"; "Text"; ..... ; $nrPerLine - Nr. of controls per line in the matrix ; $nrOfLines - Nr. of lines in the matrix ; $ctrlWidth - Width of each control ; $ctrlHeight - Height of each control ; $Style - Defines the style of the control ; $exStyle - Defines the extended style of the control ; $xPanelPos - x Position of panel in GUI ; $yPanelPos - y Position of panel in GUI ; $xBorder - distance from lateral panel's borders to the matrix (width of left and right margin) default = 0 ; $yBorder - distance from upper and lower panel's borders to the matrix (width of upper and lower margin) default = 0 ; $xSpace - horizontal distance between the controls ; $ySpace - vertical distance between the controls ; $Group - if you want to group the controls (true or false) ; $sGrpTitle - title of the group (ignored if above is false) ; Return values .: an 1 based 1d array containing references to each control ; element [0] contains an 1d array containing various parameters about the panel ; Author ........: Gianni Addiego (Chimp) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _GuiControlPanel($ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, $style = -1, $exStyle = -1, $xPanelPos = 0, $yPanelPos = 0, $xBorder = 0, $yBorder = 0, $xSpace = 1, $ySpace = 1, $Group = False, $sGrpTitle = "") Local Static $sAllowedControls = "|Label|Input|Edit|Button|CheckBox|Radio|List|Combo|Pic|Icon|Graphic|" If Not StringInStr($sAllowedControls, '|' & $ControlType & '|') Then Return SetError(1, 0, "Unkown control") Local $PanelWidth = (($ctrlWidth + $xSpace) * $nrPerLine) - $xSpace + ($xBorder * 2) Local $PanelHeight = (($ctrlHeight + $ySpace) * $nrOfLines) - $ySpace + ($yBorder * 2) Local $hGroup If $Group Then If $sGrpTitle = "" Then $xPanelPos += 1 $yPanelPos += 1 $hGroup = GUICtrlCreateGroup("", $xPanelPos - 1, $yPanelPos - 7, $PanelWidth + 2, $PanelHeight + 8) Else $xPanelPos += 1 $yPanelPos += 15 $hGroup = GUICtrlCreateGroup($sGrpTitle, $xPanelPos - 1, $yPanelPos - 15, $PanelWidth + 2, $PanelHeight + 16) EndIf EndIf ; create the controls Local $aGuiGridCtrls[$nrPerLine * $nrOfLines + 1] Local $aPanelParams[14] = [ _ $ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, _ $xPanelPos, $yPanelPos, $xBorder, $yBorder, $xSpace, $ySpace, $PanelWidth, $PanelHeight, $hGroup] ReDim $idAddIcon[UBound($aGuiGridCtrls)] ReDim $idRemoveIcon[UBound($aGuiGridCtrls)] ReDim $idChangeIcon[UBound($aGuiGridCtrls)] For $i = 0 To $nrPerLine * $nrOfLines - 1 ; coordinates 1 based $col = Mod($i, $nrPerLine) + 1 ; Horizontal position within the grid (column) $row = Int($i / $nrPerLine) + 1 ; Vertical position within the grid (row) $left = $xPanelPos + ((($ctrlWidth + $xSpace) * $col) - $xSpace) - $ctrlWidth + $xBorder $top = $yPanelPos + ((($ctrlHeight + $ySpace) * $row) - $ySpace) - $ctrlHeight + $yBorder $text = $i + 1 ; "*" ; "." ; "(*)" ; create the control(s) $aGuiGridCtrls[$i + 1] = Execute("GUICtrlCreate" & $ControlType & "($text, $left, $top, $ctrlWidth, $ctrlHeight, $style, $exStyle)") If BitAND($exStyle, $WS_EX_ACCEPTFILES) = $WS_EX_ACCEPTFILES Then GUICtrlSetState($aGuiGridCtrls[$i + 1], $GUI_DROPACCEPTED) $idContextmenu = GUICtrlCreateContextMenu($aGuiGridCtrls[$i + 1]) $idAddIcon[$i] = GUICtrlCreateMenuItem("Add Icon", $idContextmenu) $idRemoveIcon[$i] = GUICtrlCreateMenuItem("Remove Icon", $idContextmenu) $idChangeIcon[$i] = GUICtrlCreateMenuItem("Change icon", $idContextmenu) Next If $Group Then GUICtrlCreateGroup("", -99, -99, 1, 1) ; close group $aGuiGridCtrls[0] = $aPanelParams Return $aGuiGridCtrls EndFunc ;==>_GuiControlPanel ; writes a value to an element of an array embedded in another array Func _SubArraySet(ByRef $aSubArray, $iElement, $vValue) $aSubArray[$iElement] = $vValue EndFunc ;==>_SubArraySet Func _ToggleGuiShowHide($hwnd, $bToggleGUI) If $bToggleGUI Then $bShowGUI = True DllCall($dllUser32, "int", "AnimateWindow", "hwnd", $hwnd, "int", 200, "long", Eval($GUI_IN)) ; show panel WinActivate($hwnd) Else $bShowGUI = False If Not $bFreezeWindow Then DllCall($dllUser32, "int", "AnimateWindow", "hwnd", $hwnd, "int", 200, "long", Eval($GUI_OUT)) ; hide panel EndIf EndFunc ;==>_ToggleGuiShowHide Func _Exit() Local $awPos If $bSaveSettings Then $awPos = WinGetPos($GUI) If $awPos[0] < 0 Then $awPos[0] = 0 If $awPos[1] < 0 Then $awPos[1] = 0 _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET LeftPos = " & $awPos[0] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET TopPos = " & $awPos[1] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET ButtonSize = " & $iStep & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET xColumns = " & ($aMyMatrix[0])[1] & ";") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIin = '" & $GUI_IN & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET GUIout = '" & $GUI_OUT & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET Freeze = '" & $bFreezeWindow & "';") _SQLite_LaunchPad($hSQLiteDB, "UPDATE Settings SET StartUp = '" & $bStartUp & "';") EndIf _SQLite_Close($hSQLiteDB) _SQLite_Shutdown() EndFunc ;==>_Exit #Region --- Restart Program --- Func _RestartProgram() If @Compiled And StringRegExpReplace(FileGetShortName(@ScriptFullPath), "^.*\.", "") <> 'a3x' Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc ;==>_RestartProgram #EndRegion --- Restart Program --- Func _StartUpProgram($iStartup = True) If $iStartup And @Compiled And StringRegExpReplace(@ScriptFullPath, "^.*\.", "") <> 'a3x' Then FileCreateShortcut(@ScriptFullPath, @StartupDir & '\LaunchPad.lnk', $AppDataUser) ElseIf $iStartup Then FileCreateShortcut(@AutoItExe, @StartupDir & '\LaunchPad.lnk', $AppDataUser, FileGetShortName(@ScriptFullPath)) EndIf If Not $iStartup Then FileDelete(@StartupDir & '\LaunchPad.lnk') EndFunc ;==>_StartUpProgram Func _PickIconDlg($sFileName, $nIconIndex = 0, $hwnd = 0) Local $nRet, $aRetArr[2] $nRet = DllCall("shell32.dll", "int", "PickIconDlg", _ "hwnd", $hwnd, _ "wstr", $sFileName, "int", 1000, "int*", $nIconIndex) If Not $nRet[0] Then Return SetError(1, 0, -1) $aRetArr[0] = $nRet[2] $aRetArr[1] = $nRet[4] + 1 Return $aRetArr EndFunc ;==>_PickIconDlg Func _SQLite_LaunchPad($hwnd, $sqlCMD, $sqlExit = False) If Not _SQLite_Exec($hSQLiteDB, $sqlCMD) = $SQLITE_OK Then _ MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg() & @CRLF & @CRLF & $sqlCMD, 0, $GUI) If $sqlExit Then Exit -1 EndFunc ;==>_SQLite_LaunchPad ; Return an array which xMin[0], xMax[1], yMin[2], yMax[3] Func _GetVirtualScreen() ;~ 'Virtual Desktop sizes Local $SM_XVIRTUALSCREEN = 76 ; 'Virtual Left Local $SM_YVIRTUALSCREEN = 77 ; 'Virtual Top Local $SM_CXVIRTUALSCREEN = 78 ; 'Virtual Width Local $SM_CYVIRTUALSCREEN = 79 ; 'Virtual Height Dim $xyScreen[4] Local $posWin = WinGetPos($GUI) Dim $VirtualScreen[4] = [$SM_XVIRTUALSCREEN, $SM_CXVIRTUALSCREEN, $SM_YVIRTUALSCREEN, $SM_CYVIRTUALSCREEN] For $x = 0 To 3 $xTemp = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $VirtualScreen[$x]) If $x = 1 Then ;~ Note: $SM_CXVIRTUALSCREEN + $SM_XVIRTUALSCREEN = $RightSideScreen $xyScreen[$x] = ($xTemp[0] + $xyScreen[$x - 1]) - 1 Else $xyScreen[$x] = $xTemp[0] If $x = 3 Then $xyScreen[$x] -= 1 EndIf Next ;~ Note: The if statement below is to deal with multi monitors and undocked laptop move LaunchPad If (IsArray($posWin) And IsArray($xyScreen)) And ($posWin[0] > $xyScreen[1] Or $posWin[1] > $xyScreen[3]) Then $bSaveSettings = False WinMove($GUI, '', 0, 0) EndIf Return ($xyScreen) EndFunc ;==>_GetVirtualScreen Func _About() Local $sAboutText = 'LaunchPad you can easily create panels with buttons for starting applications on a Windows System.' $sAboutText &= @CRLF & @CRLF & 'Author: Chimp' & @CRLF $sAboutText &= 'Modify: Marcgforce, Danny35d' & @CRLF $sAboutText &= 'Credits: @KaFu, @Danyfirex, @mikell' GUISetState(@SW_DISABLE, $GUI) Local $AboutGUI = GuiCreate(' About LaunchPad' , 280, 160, Default, Default, $WS_CAPTION, Default, $GUI) GUISetBkColor (0xf8c848) GuiCtrlCreateLabel($sAboutText, 5, 10, 280, 100) GuiCtrlCreateLabel('____________________________________________', 10, 90, 260, 15, $SS_CENTER) ; separator $WebsiteLink = GuiCtrlCreateLabel('www.autoitscript.com/forum/topic/202048-button-deck/', 5, 105, 270, 20, $SS_CENTER) ; he he! GUICtrlSetCursor($WebsiteLink, 0) GUICtrlSetColor($WebsiteLink, 0x0000ff) Local $ok = GUICtrlCreateButton('OK', 10, 130, 70, 22, $BS_DEFPUSHBUTTON) GUISetState() While 1 $aboutMsg = GUIGetMsg() Select Case $aboutMsg = $GUI_EVENT_CLOSE ExitLoop Case $aboutMsg = $ok ExitLoop Case $aboutMsg = $WebsiteLink ShellExecute ('https://www.autoitscript.com/forum/topic/202048-button-deck/') EndSelect WEnd GUISetState(@SW_ENABLE, $GUI) GUIDelete($AboutGUI) Return EndFunc ;==>About Func Test() MsgBox(0, 0, ":)", 1) EndFunc ;==>Test  
  8. Like
    Danny35d got a reaction from MTChristy98 in Get the current date/time, including milliseconds   
    I can't remember who create this script but, I save it on my misc folder....

    While 1 ToolTip(@Hour & ':' & @Min & ':' & @Sec & ':' & _MSec()) Sleep(1) WEnd Exit Func _MSec() Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8)) $stSystemTime = 0 Return $sMilliSeconds EndFunc
  9. Thanks
    Danny35d got a reaction from RestrictedUser in Just Read encrypted file   
    This is an old article and you may have to update the UDF scripts to make work with the latest AutoIt.   Ini in Memory
  10. Like
    Danny35d got a reaction from Bilgus in Just Read encrypted file   
    This is an old article and you may have to update the UDF scripts to make work with the latest AutoIt.   Ini in Memory
  11. Like
    Danny35d got a reaction from PunkoHead in Get month from date   
    Once way is using StringSplit which create an array and then you can select the month.
     
    #include <Date.au3> ;~ Substract one month from the current month $newmonth = _DateAdd('M', -1, _NowCalcDate()) ;~ Write the new date If $newmonth <> 0 Then $Temp = StringSplit($newmonth, '/') $newmonth = $Temp[2] EndIf ConsoleWrite(@LF&@LF&$newmonth&@LF&@LF)  
  12. Like
    Danny35d got a reaction from meoit in Auto Assign drive letter   
    MsgBox(0, 'Free Letter', _GetFreeDriveLetter()) Func _GetFreeDriveLetter() For $x = 67 To 90 If DriveStatus(Chr($x) & ':\') = 'INVALID' Then Return(Chr($x) & ':') Next EndFunc
  13. Like
    Danny35d got a reaction from meoit in How to detect unused drive letters?   
    Here is another method

    MsgBox(0, 'Free drive letter ', _GetFreeDriveLetter()) Func _GetFreeDriveLetter() For $x = 67 To 90 If DriveStatus(Chr($x) & ':\') = 'INVALID' Then Return(Chr($x) & ':') Next EndFunc
  14. Like
    Danny35d got a reaction from Autoyt443 in Service start/stop Tool   
    An example script of cascading combo box.
    #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ; Create GUI GUICreate("Example Cascading ComboBox", 400, 296) $Combo1 = GUICtrlCreateCombo("", 2, 2, 396, 296) GUICtrlSetData($Combo1, "123|456|789|0") $Combo2 = GUICtrlCreateCombo("", 2, 30, 396, 296) GUISetState(@SW_SHOW) Global $cb1 = _GUICtrlComboBox_GetEditText($Combo1) Do $Msg = GUIGetMsg() Switch $Msg Case $Combo1 $cb1 = _GUICtrlComboBox_GetEditText($Combo1) _GUICtrlComboBox_ResetContent($Combo2) If $cb1 = "123" Then GUICtrlSetData($Combo2, "ABC|DEF") If $cb1 = "456" Then GUICtrlSetData($Combo2, "GHI|JKL") Case $Combo2 MsgBox($MB_SYSTEMMODAL, 'Information', 'ComboBox Selected Item: ' & _GUICtrlComboBox_GetEditText($Combo2)) EndSwitch Until $Msg = $GUI_EVENT_CLOSE GUIDelete()  
  15. Like
    Danny35d got a reaction from pranaynanda in Service start/stop Tool   
    To make it work with different machine add an Edit control and another button to reload the services.
    Then modify the _populate() function to pass the computer name into it so would read the services from the remote computer.
    Func _populate($strComputerName = 'localhost') Global $Services = ObjGet("winmgmts:\\" & $strComputerName & "\root\cimv2") Global $ServicesList = $Services.ExecQuery("SELECT * FROM Win32_Service") If IsObj($ServicesList) then _GUICtrlListView_BeginUpdate($ListView1) _GUICtrlListView_BeginUpdate($ListView2) _GUICtrlListView_DeleteAllItems($ListView1) _GUICtrlListView_DeleteAllItems($ListView2) For $Services in $ServicesList if $Services.State = "Running" Then GUICtrlCreateListViewItem( $Services.DisplayName & "|" & $Services.Name & "|" & $Services.State , $ListView1) Else GUICtrlCreateListViewItem( $Services.DisplayName & "|" & $Services.Name & "|" & $Services.State , $ListView2) EndIf Next _GUICtrlListView_EndUpdate($ListView1) _GUICtrlListView_EndUpdate($ListView2) EndIf EndFunc Also instead of using Net Stop or Net Start use the command line called SC which allow you to control services on remote computers.
    SC \\ServerName start "Service Name" SC \\ServerName stop "Service Name" Note:
           When I ran your script on my computer the functions called _selectAll() and _UnselectAll() didn't work.  You need to declare $ListView1 and $ListView2 as Global variables.
  16. Like
    Danny35d got a reaction from JCEF in Need Serialnumber of Computer   
    Yes it is possible. The script below will give you an array with all the computer information.
    #include <Array.au3> #include <File.au3> Local $GhostInfo RunWait(@ComSpec & ' /c Ghost32.exe -lockinfo > ' & @TempDir & '\GhostInfo.txt', @WorkingDir, @SW_HIDE) $CountLines = _FileCountLines(@TempDir & '\GhostInfo.txt') For $x = 3 To $CountLines $Line = FileReadLine(@TempDir & '\GhostInfo.txt', $x) If $Line <> '' Then If StringInStr($Line, 'not supported') <> 0 Then $Line = '' $GhostInfo &= StringReplace(StringStripWS(StringMid($Line, StringInStr($Line, '"')), 3), '"', '') & '|' EndIf Next $GhostInfo = StringSplit(StringTrimRight($GhostInfo, 1), '|') _ArrayDisplay($GhostInfo, 'Ghost32 LockInfo') GhostInfo[0] = Array Size
    GhostInfo[1] = Manufacturer
    GhostInfo[2] = Product Name
    GhostInfo[3] = Version
    GhostInfo[4] = Serial Number
    GhostInfo[5] = UUID
    GhostInfo[6] = Manufacturer & Product Name Combined
    GhostInfo[7] = PIII Id
  17. Like
    Danny35d got a reaction from Dschingis in Timer to Prevent Screensaver   
    I use the script below to avoid the screen saver, it move the mouse every 60 seconds.


    #Include <WinAPI.au3> #include <Constants.au3> $start = TimerInit() While 1 If TimerDiff($start) > 60000 Then _WinAPI_Mouse_Event($MOUSEEVENTF_MOVE) $start = TimerInit() EndIf WEnd
  18. Like
    Danny35d got a reaction from CoffeeBean in Problems with @ComSpec, 'net user' and DriveMapAdd   
    You forgot the space between the /k and the single quote.
    RunWait (@ComSpec &'/k' & $cmd) should beRunWait (@ComSpec &'/k ' & $cmd)
  19. Like
    Danny35d got a reaction from erorgeboown in RoboCopy GUI   
    I know there are several robocopy wrappers out in the internet but, you may have to pay to get all the functionality working, like CopyRite XP or the freewares that I found doesn't include all robocopy switches. So I combine the three wrappers I like the most and I create my own version of RoboCopyGUI. You will need robocopy.exe from Windows Server 2003 Resource Kit Tools.

    Thanks to Holger for GUI Menu with icons and color and Big_Daddy for marqee style progress control

    NOTE: I only tested on Windows XP Sp2 and using AutoIt 3.2.0.1 also, marquee style progress only work on Windows XP.

    Previews downloads: 418
    RobocopyGUI.zip
    Edit:
    10/01/2006 - v1.0.0.6
    - Fix help file, when robocopyGUI start help file open. Also fix help file to open with any default browser.

    10/01/2006 - v1.0.0.5
    - Add checkbox, match destination folder to source folder.
    - Fix _FixDate() function, now work with any international date format not just with US date format.
    - Fix when selecting a root directory like C:\ as a Source or Target path robocopy won't work.
    - Fix when selecting console options normal or maximized robocopy won't work.
    - Fix FileSelectFolder didn't work under WinPe or Bartpe. To make it work be sure you have the following files at I386\System32 folder, the script will register the dlls for you.

    Browseui.dll
    Regsvr32.exe
    Shdocvw.dll
    Shell32.dll
    07/17/2006 - v1.0.0.4 - Fix Save, now Prompt to overwrite file before saving.
    - Fix Load & Save, script didn't Load or Save the console states(Hide, Normal, Maximum).

    07/09/2006 - v1.0.0.3
    - Add Recent File at the file menu. Keeping track of the last 5 open files.

    07/08/2006 - v1.0.0.2
    - Modify creating .cmd or .bat files by adding robocopy.exe path to the batch file.
    - Modify UDF _ChenkEnvPath() to also search for robocopy.exe at the Temp folder.

    07/07/2006 - v1.0.0.1
    - Fix Load & Save, script didn't Load or Save the values of $Switches[n]
    - Add MHz improvement by making the script search the system variable for Robocopy.exe

    07/06/2006 - v1.0.0.0
    Release date
×
×
  • Create New...