Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/20/2020 in all areas

  1. Thanks Melba23 for your suggestion. So we did exchange a couple of PM's with Jpm and he already fixed everything for the next Beta / Release
    2 points
  2. Paul, you're welcome I just tried a little context menu inside _ArrayDisplay to choose the way of sorting, it seems to give good results. Lets have a look at the results first, then the personal modifications made to ArrayDisplayInternals.au3 code. Test script : #include <Array.au3> Global $aSortTest[12][1] = [["0x0B"], ["0x020"], ["0x0C"], ["0x03"], ["0x01"], ["0x0A"], _ ["0x0FF"], ["0x030"], ["0x04"], ["0x0E"], ["0x0D"], ["0x02"]] _ArrayDisplay($aSortTest) The pic above is your case : you need to choose the Numeric sort to be able to sort correctly a column of handles, pointers or any hex number starting with 0x In the pic above, we see it's very different if we want to sort the "Row" column. It needs a Natural sort to be correctly sorted because it is composed of letters ("Row ") and numbers. I suppose this is the main reason why Dev's forced the Natural sort in ArrayDisplay (when the default way of sorting in GuiListView.au3 is a Numeric sort +++) . Maybe if this Row column had only been composed of numeric elements (like the Excel column numerotation) then Dev's would have kept the original default Numeric sort found in GuiListView.au3... maybe Here is the code change in _ArrayDisplay, it's certainly optimizable but it may give ideas to users who want to tweak their own version of ArrayDisplayInternals.au3 1) Creation of a context menu associated to the listview (lines to be inserted after the listview has been created) ; Create ListView context menu (so user can choose the kind of sort he wants) Local $idContext_Menu = GUICtrlCreateContextMenu($idListView) Local $idContext_0 = GUICtrlCreateMenuItem("String sort", $idContext_Menu) Local $idContext_1 = GUICtrlCreateMenuItem("Numeric sort", $idContext_Menu) Local $idContext_2 = GUICtrlCreateMenuItem("Natural sort <<<", $idContext_Menu) ; default (keeps compatibility with old scripts) Local $iSort_Desired = 2, $iSort_Actual = -1 ; 0 = String sort, 1 = Numeric Sort, 2 = Natural sort 2) Inside the While... Wend loop, 3 Case added (Case $idContext_0 ... Case $idContext_1 ... Case $idContext_2) Case $idContext_0 ; String sort (chosen by user in context menu) $iSort_Desired = 0 GUICtrlSetData($idContext_0, "String sort <<<") GUICtrlSetData($idContext_1, "Numeric sort") GUICtrlSetData($idContext_2, "Natural sort") Case $idContext_1 ; Numeric sort (chosen by user in context menu) $iSort_Desired = 1 GUICtrlSetData($idContext_0, "String sort") GUICtrlSetData($idContext_1, "Numeric sort <<<") GUICtrlSetData($idContext_2, "Natural sort") Case $idContext_2 ; Natural sort (chosen by user in context menu) $iSort_Desired = 2 GUICtrlSetData($idContext_0, "String sort") GUICtrlSetData($idContext_1, "Numeric sort") GUICtrlSetData($idContext_2, "Natural sort <<<") 3) Inside the While... Wend loop, modifications made in Case $idListView code : Case $idListView ; left click on listview column header => sort If $iSort_Desired <> $iSort_Actual Then ; note that $iSort_Actual = -1 at 1st passage DllCallbackFree($__g_aArrayDisplay_SortInfo[2]) __ArrayDisplay_RegisterSortCallBack($idListView, $iSort_Desired, True, "__ArrayDisplay_SortCallBack") $iSort_Actual = $iSort_Desired EndIf ; Kick off the sort callback __ArrayDisplay_SortItems($idListView, GUICtrlGetState($idListView)) 4) Original line #448 to be deleted because it was placed outside the While... Wend loop (eventual sorts are now registered / unregistered within the While... Wend loop, inside the Case $idListView as shown just above) #448 __ArrayDisplay_RegisterSortCallBack($idListView, 2, True, "__ArrayDisplay_SortCallBack") 5) Original lines #598 et #599 amended to convert strings to numbers when "0x" is found at the beginning of the string. These 2 lines are originally already included inside a test where the user choosed voluntarily a Numeric sort. In case you're afraid that a string starting with "0x" is not a valid hex number, then you can use guinness _IsHex() function, found in this link, where he checks the string with a Regex expression '^0x[[:xdigit:]]+$' If StringIsInt($sVal1) Or StringIsFloat($sVal1) Or StringLeft($sVal1, 2) = "0x" Then $sVal1 = Number($sVal1) If StringIsInt($sVal2) Or StringIsFloat($sVal2) Or StringLeft($sVal2, 2) = "0x" Then $sVal2 = Number($sVal2) 6) As discussed in this link , original line #560 has to be moved "just below" the 2 lines below it. This will make the sort arrow visible when you click on a column header in ArrayDisplay It will also correct the value found in the variable $hHeader and in the array element $__g_aArrayDisplay_SortInfo[10] This is fixed in trac ticket #3791 ;~ Local Const $LVM_GETHEADER = (0x1000 + 31) ; 0x101F Local $hHeader = HWnd(GUICtrlSendMsg($hWnd, 0x101F, 0, 0)) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) 7) Finally, DllCallbackFree should be added before both GuiDelete($hGUI) as discussed in this link : DllCallbackFree($__g_aArrayDisplay_SortInfo[2]) GUIDelete($hGUI) Hope I didn't miss something important. If Mods think it's better to upload (or not) the complete amended ArrayDisplayInternals.au3 somewhere (for test or whatever) I'll do it. I just thought it could be a bit dangerous to share it fully here, because all these tweaks are very new. Dinner time Edit : 11/21/2020 Parts 1) and 2) in the code above can be scripted differently, to get a shorter code based on menu radioitems. 1) Creation of a context menu associated to the listview (lines to be inserted after the listview has been created) ; Create ListView context menu (so user can choose the kind of sort he wants) Local $idContext_Menu = GUICtrlCreateContextMenu($idListView) Local $idContext_0 = GUICtrlCreateMenuItem("String sort", $idContext_Menu, -1, 1) ; menuradioitem Local $idContext_1 = GUICtrlCreateMenuItem("Numeric sort", $idContext_Menu, -1, 1) ; menuradioitem Local $idContext_2 = GUICtrlCreateMenuItem("Natural sort", $idContext_Menu, -1, 1) ; menuradioitem GUICtrlSetState(-1, 1) ; $GUI_CHECKED = 1 (Natural sort is the default, to keep compatibility) Local $iSort_Desired = 2, $iSort_Actual = -1 ; 0 = String sort, 1 = Numeric Sort, 2 = Natural sort 2) Inside the While... Wend loop, 3 Case added (Case $idContext_0 ... Case $idContext_1 ... Case $idContext_2) Case $idContext_0 ; String sort (chosen by user in context menu) $iSort_Desired = 0 Case $idContext_1 ; Numeric sort (chosen by user in context menu) $iSort_Desired = 1 Case $idContext_2 ; Natural sort (chosen by user in context menu) $iSort_Desired = 2 This will display a context menu based on menu radio items : Thanks to lemony & Malkey in this post from 2008 (I discovered it right now !)
    2 points
  3. Hello everyone, I started this project alone in May 2020 as project in my spare time at work, I'm working for a IT company that started opening their services to residential customers few months ago and now my position in the company kind of drifted in the doom and gloom world of repetitive tasks like: Reinstallation + Configuration of Windows 10. The procedure is very repetitive and I started feeling like being a robot which is the main reason I started this project. ==============================FAQ================================== 1. Q: Do you want this project to be accomplished with the usage of AutoIt ONLY or 3rd party tools / Scripts (BATCH / POWERSHELL / VB) ? A: No, if I cannot find a way using AutoIt to accomplish a task I will move to my Plan B which consist of automating an 3rd party tool to accomplish the affected task until a solution is found. 2. Q: What do I get from helping/collaborating in this project? A: I will personally take the responsibility to mention you in the credits of this project. 3. Q: If I have more questions, can I ask? A: Certainly! feel free to ask any questions related to this project! 4. Q: What is the main goal of this project? A: Automating Windows 10 configuration without user interaction needed (as much as possible) ______________________________________________________________________________________________________________________________ Current progression of the project (more will be added in future) « Blue = Info || Yellow = Unfinished/Untested || Purple = Could be better || Green = Done ||Red = Not Yet Started » ***Very early Stage *** Connect Network Attached Storage(NAS) (Work but missing configuration in GUI - AutoIt only) Download & Install up to 600+ softwares (Tested & Working - using 3rd party tool + 50/50 Powershell/AutoIt) Auto prediction of Apps name of text typed inside input (Tested & Working - AutoIt Only) Change OEM Informations (Tested & Working - AutoIt) Disable hibernation (Tested & Working - AutoIt only) Change Computer Name (Work but require testing - AutoIt only) Show Computer Information and Smart status on GUI (Tested & Working - AutoIt Only) Change .pdf / .pdfxml from Edge to Adobe Reader DC (Tested & Working - using 3rd party tool) Change Edge to Google Chrome as Default Browser (Tested & Working - using 3rd party tool) Windows Updater (Seems to work but require further testing - AutoIt only) Install Office 365 / 2013 + Activation (To Do) Add L2TP VPN Configuration for Windows Built-in VPN (To Do) Save / Load tasks configuration profile in (.ini file) to avoid repeating same configuration twice (In progress - AutoIt Only) (EXPERIMENTAL) Install Apps from Microsoft Store with UIAutomation UDF made by @junkew(Work if you know what your doing) P.S: Installing Apps from Microsoft Store will require usage of UIA spy tool made by @LarsJ which you can download & learn how to use it on UIA Spy Tool thread. *** If this project interest you, Reply here This will greatly help me to see if you'd like this project to become real *** ______________________________________________________________________________________________________________________________ Best Regards, ~WilliamasKumeliukas
    1 point
  4. Gianni

    Button Deck

    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
    1 point
  5. This would go into the "args" portion of your DesiredCapabilities string Can't really help you with your other issue.
    1 point
  6. @ADream No idea on the zoom question. You'll need to research yourself. Have you tried something like this before performing the click? _WD_ExecuteScript($sSession, "arguments[0].scrollIntoView(false);", '{"' & $_WD_ELEMENT_ID & '":"' & $oElement2 & '"}')
    1 point
  7. Danp2

    _IE Button Click

    Add some ConsoleWrite commands so that you can see what is being found, if a match is located, etc.
    1 point
  8. NassauSky, No, but I can guess why you are having the problem. Once you are working with the GUIListViewEx UDF everything you do to the ListView must be done using the UDF functions - if you are deleting and recreating elements of the ListView using standard functions then the UDF does not "know" what is in the ListView and you will very likely get an error similar to the one you saw. As explained in the guide that i wrote and which is part of the download, if you want to clear and reload the ListView you need to do as follows: Then the UDF knows what is currently in the ListView and will not get confused and show an error when it is asked to edit a cell that it does not think exists. M23
    1 point
  9. NassauSky, If you want to run your own functions for doubleclicks on specific columns you can do so by setting the $iMode parameter in the _GUIListViewEx_SetEditStatus function to 9 as explained in the header for that function within the UDF. Here is a short example to show it working: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" ; Create GUI $hGUI = GUICreate("LVEx Example", 320, 320) $cListView = GUICtrlCreateListView("Tom|Dick|Harry", 10, 10, 300, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($cListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) _GUICtrlListView_SetColumnWidth($cListView, 0, 93) _GUICtrlListView_SetColumnWidth($cListView, 1, 93) _GUICtrlListView_SetColumnWidth($cListView, 2, 93) ; Create array and fill listview Global $aLV_List[10] For $i = 0 To UBound($aLV_List) - 1 If Mod($i, 5) Then $aLV_List[$i] = "Tom " & $i & "|Dick " & $i & "|Harry " & $i Else $aLV_List[$i] = "Tom " & $i & "||Harry " & $i EndIf GUICtrlCreateListViewItem($aLV_List[$i], $cListView) Next ; Initiate LVEx $iLV_Index = _GUIListViewEx_Init($cListView, $aLV_List) ; Column 2 - editable as normal _GUIListViewEx_SetEditStatus($iLV_Index, "2") ; Column 1 - run function MsgBox_1 _GUIListViewEx_SetEditStatus($iLV_Index, "1", 9, _MsgBox_1) ; Column 0 - run function MsgBox_0 _GUIListViewEx_SetEditStatus($iLV_Index, "0", 9, _MsgBox_0) ; Register messages _GUIListViewEx_MsgRegister() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIListViewEx_EventMonitor() WEnd Func _MsgBox_1($hLV, $iIndexLV, $iRow, $iCol) MsgBox($MB_SYSTEMMODAL, "Column 1 clicked", "Row = " & $iRow) EndFunc Func _MsgBox_0($hLV, $iIndexLV, $iRow, $iCol) MsgBox($MB_SYSTEMMODAL, "Column 0 clicked", "Row = " & $iRow) EndFunc Lines #29-34 do the magic! Please ask if you have any further questions. M23
    1 point
  10. Danny35d

    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
    1 point
  11. Something like this? #include <ad.au3> Global $sUser = @UserName _AD_Open() Global $sProperties = "aa,mail,xx,physicalDeliveryOfficeName,department,pwdLastSet,yy" Global $aUserData = _AD_GetObjectProperties($sUser, $sProperties) _ArrayDisplay($aUserData, "Without unset properties") Global $aProperties = StringSplit($sProperties, ",") For $i = 1 To $aProperties[0] $bFound = False For $j = 1 To $aUserData[0][0] If $aUserData[$j][0] = $aProperties[$i] Then $bFound = True ExitLoop EndIf Next If $bFound = False Then _ArrayAdd($aUserData, $aProperties[$i]) $aUserData[0][0] = $aUserData[0][0] + 1 EndIf Next _ArrayDisplay($aUserData, "With unset properties") _ArraySort($aUserData, 0, 1, 0) _ArrayDisplay($aUserData, "With unset properties - sorted")
    1 point
  12. So where is the github project ?
    1 point
  13. I came across a few discussions recently where people were complaining about how the error message for a compiled script gives a line number that is different from the interpreter, and generally not helpful. A while back I created this super janky hack because I had few compiled scripts that would unexpectedly crash, and needed sometimes to figure out the line number. So, here it is. You just start it, it runs in the background, and if any .exe error messages should come up, it replaces the line number on the fly. If you blink you might miss it. Ctrl-Shift q to exit. There are a couple assumptions made, 1. Include statements should be at the top of the file. 2. The source file must be in the same directory as the .exe 3. The Autoit compiler must be installed. I’ve only tested it with my files and standard autoit includes, there may be a few holes I’m not aware of, so let me know what problems are found. #pragma compile(Console, True) HotKeySet("^+q", "exitfunc") ConsoleWrite("ErrMsgHack Starting... Ctrl-Shift-q to Quit" & @CRLF) ToolTip("Ctrl-Shift-q To Quit") Sleep(2000) ToolTip("") WinActivate("[TITLE:AutoIt Error]","") Local $hErrWin, $hRefWin, $fhInput, $fhOutput Local $sErrorText, $sSourceFile, $sOutFileName Local $iErrLineNo, $iRefLineNo, $iLinesRead While True If WaitForExeError() Then If CreateRefFile() Then CompileAndRunRefFile() WaitForRefExeError() CalculateOffset() UpdateExeError() EndIf EndIf WEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func WaitForExeError() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $hErrWin=WinWaitActive("[TITLE:AutoIt Error]","") $sErrorText=ControlGetText($hErrWin,"",65535) If StringInStr($sErrorText, ".exe") Then $iErrLineNo=StringSplit($sErrorText," ",2)[1] $sSourceFile=StringSplit($sErrorText,'"',2)[1] $sSourceFile=StringReplace($sSourceFile, ".exe", ".au3") $sErrorText=StringSplit($sErrorText,"Error:",1)[2] Return True Else Sleep(2000) Return False EndIf EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func CreateRefFile() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Local $sLine="" , $bIncludeFound=False $sOutFileName="_E_FD_" $fhInput=FileOpen($sSourceFile) $fhOutput=FileOpen($sOutFileName &".au3",2) If $fhInput=-1 Then Return False While True $sLine=FileReadLine($fhInput) If @error=-1 Then ExitLoop $sLine=StringStripWS($sLine,8) If StringLeft($sline,8)="#include" Then FileWriteLine($fhOutput, $sLine) $bIncludeFound=True ElseIf $sline="" Then Else ExitLoop EndIf WEnd If Not $bIncludeFound Then Return False FileWriteLine($fhOutput, "[[[") FileClose($fhOutput) Return True EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func CompileAndRunRefFile() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RunWait(@ProgramFilesDir &"\AutoIt3\Aut2Exe\Aut2exe.exe /in "& $sOutFileName &".au3") Run($sOutFileName &".exe") WinWaitNotActive($hErrWin,"", 5) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func WaitForRefExeError() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $hRefWin=WinWaitActive("[TITLE:AutoIt Error]","") $sText=ControlGetText($hRefWin,"",65535) $iRefLineNo=StringSplit($sText," ",2)[1] ControlSend($hRefWin, "","","{ENTER}") Sleep(100) FileDelete($sOutFileName &".au3") FileDelete($sOutFileName &".exe") EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func CalculateOffset() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Local $iCnt=$iRefLineNo, $bInComment=False, $sLine="" $iLinesRead=0 FileClose($fhInput) $fhInput=FileOpen($sSourceFile) While True $sLine=FileReadLine($fhInput) If @error=-1 Then ExitLoop $sLine=StringStripWS($sLine,8) $iLinesRead+=1 $stok=StringLeft($sLine,3) If $stok="#cs" Then $bInComment=True ElseIf $stok="#ce" Then $bInComment=False EndIf If $sLine="" Or StringLeft($sLine,1)="#" Or StringLeft($sLine,1)=";" Or StringRight($sLine, 1)="_" Or $bInComment Then Else If $iCnt=$iErrLineNo Then ExitLoop EndIf $iCnt+=1 EndIf WEnd EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func UpdateExeError() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If $iRefLineNo>$iErrLineNo Then $sErrorText="Error is in #include file(s) Line "& $iErrLineNo &"):"& @CRLF & @CRLF &"Error:"& $sErrorText Else $sErrorText="Line " &" "& $iLinesRead &" (File "& $sSourceFile &"):"& @CRLF & @CRLF &"Error:"& $sErrorText EndIf ControlSetText($hErrWin,"",65535, $sErrorText) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func ExitFunc() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ConsoleWrite("ErrMsgHack Unloading..." & @CRLF) Exit EndFunc Here’s a video that demonstrates the way I use it.: https://youtu.be/qA-DKqwt5Ss If you prefer no real time error message boxes but instead errors displayed on the console, take a look at (minimally tested, using libs from others) ..
    1 point
  14. ptrex

    VLC Media Player

    VLC Media Player Many times I have seen attemps to get the famous VLC Payer into AU3. I seemed always to crash the GUI when using the VLC ActiveX object ? Before running the script download and install the VLC Player opt("GUIOnEventMode", 1) #include <GUIConstantsEX.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> ;VLCPlaylistMode Const $VLCPlayListInsert = 1 Const $VLCPlayListReplace = 2 Const $VLCPlayListAppend = 4 Const $VLCPlayListGo = 8 Const $VLCPlayListInsertAndGo = 9 Const $VLCPlayListReplaceAndGo = 10 Const $VLCPlayListAppendAndGo = 12 Const $VLCPlayListCheckInsert = 16 ; Initialize error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; ---------------------------------- Declare objects ------------------------------- $oVLC = ObjCreate("VideoLAN.VLCPlugin.1") ; -------------------------------------------- Main Gui --------------------------------- $hGui = GuiCreate("VLC Viewer", 500, 390,-1, -1, Bitor($WS_OVERLAPPEDWINDOW,$WS_VISIBLE, $WS_CLIPSIBLINGS)) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIeventClose") $bSelect = GUICtrlCreateButton("Select ... ", 10, 20, 70) GUICtrlSetOnEvent(-1, "_SelectFile") ;$oVLC_Object = GUICtrlCreateObj ($hGui, 10, 70 , 700 , 460) ;GUICtrlSetStyle ( $oVLC_Object, $WS_VISIBLE ) ;GUICtrlSetResizing ($oVLC_Object,$GUI_DOCKAUTO) ; $GUI_DOCKAUTO Auto Resize Object GuiSetState() $size = WinGetPos("[active]") While 1 Sleep(100) WEnd Func _SelectFile () $File = FileOpenDialog("Select a movie File ", @MyDocumentsDir & "", "Images (*.flv;*.swf;*.wmv;*.avi;*.*)", 1) If @error Then MsgBox(4096,"","No File chosen ...") Return Else Sleep(100) _StartPlay($File) EndIf EndFunc Func _StartPlay($hFile) With $oVLC ;.AddTarget ($hFile, Default, $VLCPlayListInsert, 0) .MRL = $hFile .AutoLoop = 0 ;False .AutoPlay = 0 ;False .Visible = 1 ;True .Play () .Volume = 50 EndWith EndFunc Func GUIeventClose() Exit EndFunc ;==>GUIeventClose ;This is custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc The only way to get it run without crashing is NOT to use the "GUICtrlCreateObj". The VLC Player creates some kind of own GUI and Control when calling the Object. This make it hard of course to attach the Control to the parent window. Some Movie flexdrainwit.zip Enjoy !! Regards, ptrex
    1 point
×
×
  • Create New...