Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/21/2025 in all areas

  1. This is a UDF to use a Listview or Treeview as a File/Folder Explorer. You can also fine the TreeListExplorer UDF on Github. It allows to create a system, where a root folder can be set and that synchronizes all attached Tree or Listviews. So it is possible to attach multiple views to one system. Additionally, it is possible to add an Input Control as a View to show the current folder. When pressing {ENTER}, the system opens the path provided by the input. The following functions are available: ; #CURRENT# ===================================================================================================================== ; __TreeListExplorer_StartUp ; __TreeListExplorer_Shutdown ; __TreeListExplorer_CreateSystem ; __TreeListExplorer_DeleteSystem ; __TreeListExplorer_AddView ; __TreeListExplorer_RemoveView ; __TreeListExplorer_OpenPath ; __TreeListExplorer_Reload ; __TreeListExplorer_GetPath ; __TreeListExplorer_GetRoot ; __TreeListExplorer_GetSelected ; __TreeListExplorer_SetRoot ; =============================================================================================================================== When creating a System, a callback function can be provided to be called, when the root folder or the current folder changes. When adding a View, callback functions for single/double click at an item as well as a loading callback can be added. Example view: The Code for the Example to get a quick overview: If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs. I did a complete rework of this UDF (2025/03/02). Now it is easier to use and does not need external UDFs anymore. This also removes a lot of bugs, that were in the old version. It is also possible to freely select if folders and/or files should be visible in any view. Changelog: Version 1.0.0 (Old Version) Version 2.0.0 (New Version after rework) Version 2.1.0 - Rename $sCallbackOnSelect to $sCallbackOnClick - Add an additional callback $sCallbackOnSelectionChange, that is called whenever the Tree-/ListView item selection changes Version 2.2.0 - Improve loading speed for TreeView folders when expanding Version 2.3.0 - Fix some bugs where folders did not correctly expand/collapse when clicking them (when the root folder is not "" => shows all drives) - Fix some documentation - Add a method for reloading (__TreeListExplorer_Reload) the current folder (ListView/TreeView) or all folders (TreeView) - Remove the reload parameter from the __TreeListExplorer_OpenPath method (Replaced with __TreeListExplorer_Reload). - Other small internal changes Version 2.4.0 - Add the possibility to handle file/folder selections better - Files/Folders keep selected when reloading - The currently selected File/Folder can be checked with __TreeListExplorer_GetSelected - File selection is synchronized between all Tree-/Listviews, Folder selection only between ListViews (TreeView folder selection changes the current folder and expands it) - fixed minor issues Version 2.5.0 - Disabled TreeList expand with a single click and changed it to a double click - Selection is now synchronized for all files/folders between all views (Tree-/ListView) - The Selection callback is now moved from __TreeListExplorer_AddView to __TreeListExplorer_CreateSystem and only fires ones per change for the system and not for every view (as it was before) - All callbacks were changed to pass the selected folder and some additional information is now provided (clicked index/item, the loading path,...) - Small performance improvements - Some internal restructuring Version 2.5.1 - Fixed: selection not working for drives Version 2.6.0 - Added support for icons of all file extensions for TreeViews and ListViews. Version 2.7.0 - Input controls are now possible as a view. They show the current folder and when pressing {ENTER} inside, the system tries to open the path show in the input. - Changed the behavior of the treeview when clicking items. They now change the current folder, but are not expanded. This changes the folder in the ListView, when clicking a folder in the TreeView. Version 2.7.1 - Clicking on the Bitmap of a TreeView item is now registered as a click (not just the text like before) - Fixed a missing selection update when clicking on a TreeView item Version 2.7.2 - Add parameter for setting the (file-/folder-)icon size on startup Version 2.8.0 - TreeView selection is now triggering the select event and the $sSelect corresponds to the selected folder/file. NOTE: __TreeViewExplorer_GetSelected will be empty, if the selection is a folder in a treeview - Selection handling was improved, especially the synchronization between TreeView and ListView - Add keyboard navigation to the listview - Fixed a bug, where the icon index was sent as event (GuIGetMsg), when an item was clicked (happens without the udf message handling, so it needed a workaround: suppress the default autoit handler for mouseclicks) Version 2.8.1 - Fixed a bug, where the select callback was sometimes not send correctly Version 2.9.0 - Fixed bug for TreeViews, where folders were shown as expandable, when having only files but no folders, even if showing files was turned of - rework how treeviews are filled/updated/expanded (folders that are expanded will stay expanded on reload) - add the possibility to set a depth limit for the treeview (Example: Drive selection with $sRoot="" and $iMaxDepth=0) - Fixed bug for Arrow selection in the ListView to not trigger a click event anymore - When the open folder or the selection changed, the TreeView checks, if it still exists (=> treeview updates, if a folder was deleted) Version 2.9.1 - Workaround for a Bug in the GuiTreeView UDF (until it is fixed), causing random control deletions instead of TreeView item deletions Version 2.9.3 - Fixed custom icon size when extracting icons Version 2.9.4 - Improved display quality for some icons (Thanks WildByDesign for the work on that) - Fixed an issue, where cached file icons for individual files were shown as a folder Version 2.9.5 - Improved display quality for some icons (When resource files are defined in the registry, the one with the size greater or equal to the required icon size will be choosen) Version 2.10.0 - Added the possibility to filter ListViews/TreeViews with a callback function. This callbackfunction is called for every file/folder and only if it returns True, will they be added to the view. - Added the possibility to set $bNavigate for ListViews when adding them. This enables or disables the possibility to navigate through folders with doubleclicks in a ListView (and add/removes the ".." folder at the top, which enables the user to navigate to the parent folder) Special thanks to @WildByDesign for a lot of testing to help improving this UDF. TreeListExplorer.au3 TreeListExplorer-Example.au3
    1 point
  2. No, it is much more than that. If you use Opt("MustDeclareVars", True), you must use Local/Global. I always highly recommend using this option as it will save you lots of "hard to find" bugs when your scripts get larger.
    1 point
  3. Local ist default within functions, yes. Why do I (and many other folks here) use "local" explicit? Because otherwise you would get warnings when you run Au3Check. #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y These 👆 directives lead you to use "Local" in functions and "Global" outside functions. But it's not mandatory - more a styleguide thingy I would say 🤝 . Yes you can do this, no problem. In my experience it's better to give a UI some time to render and load completely. For a human is 100 ms not much and I guess you don't need a guicker test execution. I am curious which key combination will work. Best of luck. Best regards Sven
    1 point
  4. Another way to skin the cat : #include <WinAPISysWin.au3> #include <GUIConstants.au3> Global $hGUI = GUICreate("Parent", 350, 300, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_COMPOSITED)) GUISetBkColor(0xC0FFEE) Global $idTime = GUICtrlCreateLabel("", 0, 0, 350, 100, $SS_CENTER + $SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor(-1, 0xA0) GUICtrlSetFont(-1, 60, 800) GUISetState() _WinAPI_SetLayeredWindowAttributes($hGUI, 0xC0FFEE) Global $hGUI2 = GUICreate("Child", 100, 30, 125, 100, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) Global $idButton = GUICtrlCreateButton("Test", 0, 0, 100, 30) WinSetTrans($hGUI2, "", 120) GUISetState() ShowTime() AdlibRegister(ShowTime, 1000) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton ConsoleWrite("button was pressed" & @CRLF) EndSwitch WEnd Func ShowTime() GUICtrlSetData($idTime, @HOUR & ":" & @MIN & ":" & @SEC) EndFunc ;==>_ShowTime And make the button partially transparent...
    1 point
  5. Use child GUI: ... Global Const $SC_DRAGMOVE = 0xF012 Global $iW = 300, $iH = 100, $hHBitmap Global $hGUI = GUICreate("Parent", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)), _ $hGUI_Child = GUICreate("", 30, 20, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) Global $hButton = GUICtrlCreateButton("Test", 0, 0, 30, 20) GUICtrlSetBkColor($hButton, 0x000000) GUICtrlSetColor($hButton, 0x00FF00) GUISetBkColor(0x123456, $hGUI_Child) _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0x123456) GUISetState(@SW_SHOW, $hGUI_Child) GUISetState(@SW_SHOW, $hGUI) ...
    1 point
  6. If you look into the UDF: ; #FUNCTION# ==================================================================================================================== ; Name ..........: __TreeListExplorer_CreateSystem ; Description ...: Create a new TLE System. This is used to manage the views by settings the root folder, the current folder,... ; Multiple views (TreeView/ListView) can be added, all managed by this system. ; Syntax ........: __TreeListExplorer_CreateSystem($hGui[, $sRootFolder = ""[, $sCallbackFolder = Default[, $sCallbackSelect = Default ; [, $iMaxDepth = Default[, $iLineNumber = @ScriptLineNumber]]]]]) ; Parameters ....: $hGui - the window handle for all views used by this system. ; $sRootFolder - [optional] the root folder as string. Default is "", making the drive overview the root ; $sCallbackFolder - [optional] callback function as string. Using Default will not call any function. ; $sCallbackSelect - [optional] callback function as string. Using Default will not call any function. ; $iMaxDepth - [optional] the max depth, to which TreeViews are limited. Default = No limit. ; $iLineNumber - [optional] linenumber of the function call. Default is @ScriptLineNumber. ; (Automatic, no need to change; only used for error messages) ; Return values .: The system handle $hSystem, used by the other functions ; Author ........: Kanashius ; Modified ......: ; Remarks .......: When $sRootFolder = "", there is no root directory, enabling all drives to be accessed. Otherwise the User can ; only select child folders of the root folder. ; The $sCallbackFolder calls the provided function, which must have 4 parameters ($hSystem, $sRoot, $sFolder, $sSelected) and ; is called, when the root folder or the current folder changes. If the parameter number is wrong an error ; message will be written to the console at runtime (using $iLineNumber to find it better). ; $sCallbackSelect must be a function with 4 parameters ($hSystem, $sRoot, $sFolder, $sSelected) ; and is called, when an item in the Tree-/ListView is selected (Mouse/Keyboard) ; If $iMaxDepth is set, it is not possible to go deeper then that depth (Example: Drive selection with $sRoot="" and $iMaxDepth=0). ; ListViews are not limited by $iMaxDepth. ; ; Errors: ; 1 - Parameter is invalid (@extended 1 - $hGui, 3 - $sCallbackFolder, 4 - $sCallbackSelect, 5 - $iLineNumber) ; 2 - Setting WinProc for $hGui failed ; 3 - TLE system could not be added to map ; 4 - TLE system ID could not be converted to TLE system handle ; 5 - $sRootFolder is invalid and could not be set (try __TreeListExplorer_SetRoot for details) ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __TreeListExplorer_CreateSystem($hGui, $sRootFolder = "", $sCallbackFolder = Default, $sCallbackSelect = Default, $iMaxDepth = Default, $iLineNumber = @ScriptLineNumber) Then you can see, that a lot of parameters are optional. So you can just not define them. If no parameter is defined, the one written in the Function definition is used. So: $sCallbackFolder = Default means, that the parameter is optional, so if it is not defined when the function is called, it is "Default". In the UDF description you can read, that Default means, nothing will be called ($sCallbackFolder - [optional] callback function as string. Using Default will not call any function.). The only problem is, if there are multiple optional parameters, but you only want one of them. If it is not the first, you have to provide values for the parameters before that. Some programming languages (for example python) let you name optional parameters like _CoolFunction(optionalParameter10="Something"), but that is not the case in AutoIt. In AutoIt you have to look at the documentation of the function to find out, what the value is, when you do not define it and use that. So a call would look like: ; Create TLE system for the right side Global $hTLESystemRight = __TreeListExplorer_CreateSystem($hGUI_1, "", Default, "_selectCallback") If @error Then ConsoleWrite("__TreeListExplorer_CreateSystem failed: "&@error&":"&@extended&@crlf) ; Add Views to TLE system: ShowFolders=True, ShowFiles=True __TreeListExplorer_AddView($hTLESystemRight, $hTreeViewRight, True, True) If @error Then ConsoleWrite("__TreeListExplorer_AddView $hTreeView failed: "&@error&":"&@extended&@crlf)
    1 point
  7. Sorry. I thought your request was against forum rules. It is not obvious to help with so little information. As we do not have your Zed editor, it is quite hard for us to know what is wrong and what could solve your issue. Maybe you could use menu / context menu to activate the keymap screen ? Or maybe the sequence of key pressed/released is not exactly what you described ? ps. when you post code, please use the method shown in the link. Thanks.
    1 point
  8. argumentum

    Shared Folders

    #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <APIShellExConstants.au3> #include <WinAPIShellEx.au3> _CheckFolderShareStatus("R:\Temp") ; for illustration purposes only Func _CheckFolderShareStatus($sFolder) Local $tSHFILEINFO = DllStructCreate($tagSHFILEINFO) _WinAPI_ShellGetFileInfo($sFolder, $SHGFI_ATTRIBUTES, 0, $tSHFILEINFO) Local $iAttributes = DllStructGetData($tSHFILEINFO, "Attributes") If BitAND($iAttributes, $SFGAO_SHARE) Then ConsoleWrite("Attributes = 0x" & Hex($iAttributes) & "; Shared!" & @LF) Return True Else ConsoleWrite("Attributes = 0x" & Hex($iAttributes) & "; NOT Shared!" & @LF) Return False EndIf EndFunc ;==>_CheckFolderShareStatus Edit: added Au3Check parameters to make sure that the variables are declared. In SciTE, that line will help the coder ( you or me ) to have a better coded script.
    1 point
  9. Sure. #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $SC_DRAGMOVE = 0xF012 Global $iW = 300, $iH = 100, $hHBitmap Global $hGUI = GUICreate("Parent", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState(@SW_SHOW, $hGUI) _GDIPlus_Startup() Global $hBrush = _GDIPlus_BrushCreateSolid(0xD80000A0) Global $hFormat = _GDIPlus_StringFormatCreate() Global $hFamily = _GDIPlus_FontFamilyCreate("Impact") Global $hFont = _GDIPlus_FontCreate($hFamily, 60) Global $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) _GDIPlus_StringFormatSetAlign($hFormat, 0) Global $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") _ShowTime() AdlibRegister("_ShowTime", 1000) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE AdlibUnRegister("_ShowTime") _WinAPI_DeleteObject($hHBitmap) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() GUIDelete() Func _ShowTime() _GDIPlus_GraphicsClear($hGfx, 0x00000000) _GDIPlus_GraphicsDrawStringEx($hGfx, @HOUR & ":" & @MIN & ":" & @SEC, $hFont, $tLayout, $hFormat, $hBrush) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_BitmapDisplayTransparentInGUI($hHBitmap, $hGUI) _WinAPI_DeleteObject($hHBitmap) EndFunc Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hGUI _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch EndFunc ;==>_WM_LBUTTONDOWN Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc
    1 point
  10. GaryFrost

    Text effects UDF

    Unless he requests Jon to re-active his fileman area that is what you'll get. I believe the latest 1.93 Here's the last zip I had downloaded Sept 2005 text_effects_1.9.3.zip
    1 point
×
×
  • Create New...