Jump to content

Search the Community

Showing results for tags 'launchpad'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. This roundup of "virtual keyboards" (https://www.buttoncommander.com/en/input-devices/difference-between-hotkeyboard-devices-and-keyboard-devices/) inspired me to create this simple "LaunchPad" script. with this script you can easily create panels with buttons for starting programs, but not only, you can also associate macros, shortcuts, functions with the buttons ... In short, the $aTools 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) (see the script for some examples of use) If you have ideas for new records for that array you are encouraged to post it here (thanks) You can easily change the buttons dimensions and the shape of the initial deck by changing the $iStep and $iNrPerLine variables in the script (deck is resizeable as well) Credits: This script makes use of some useful snippets kindly provided by @KaFu, @Danyfirex and @mikell (see the comments in the script for references) Tips (or ready made modifications) for improvements are as always welcome. have fun ; =============================================================================================================================== ; 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) ; =============================================================================================================================== #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> ; <WinAPISysWin.au3> #include <SendMessage.au3> #include <WinAPIFiles.au3> ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) ; 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 #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 Const $aTools[][] = [ _ ['Settings', 'SHELL32.dll', 177, 'run("explorer.exe shell:::{D20EA4E1-3957-11d2-A40B-0C5020524153}")'], _ ; 'Test()'], _ ; call a function 'Test()' ['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' & @CRLF & '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 $iStep = 38 ; button size Global $iNrPerLine = 2 Global $iNrOfLines = Ceiling(UBound($aTools) / $iNrPerLine) Global $GUI = GUICreate('LaunchPad', 10, 10, 20, 20, BitOR($WS_THICKFRAME, 0), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) Global $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] 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 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 While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 ; end Exit Case Else For $i = 1 To UBound($aMyMatrix) - 1 If $Msg = $aMyMatrix[$i] Then If $i <= UBound($aTools) Then $dummy = Execute($aTools[$i - 1][3]) EndIf EndIf Next 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] 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)") 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 Test() MsgBox(0, 0, ":)", 1) EndFunc ;==>Test
×
×
  • Create New...