Jump to content

Recommended Posts

Posted (edited)

Hi folks, new release 0.3.0 - 2026-01-20ย published ๐ŸŽ‰ .
All relevant changes can be found in the CHANGELOG.

Wish you all a pleasant day ๐Ÿ˜ , from @WildByDesign, myself, and the other contributors .

Best regards
Sven

----------------

Maybe you want to put the CHANGELOG link in your initial post #1 of the thread @WildByDesign?

Edited by SOLVE-SMART

==> AutoIt related: ๐Ÿ”—ย Organization AutoIt Community,ย ๐Ÿ”— GitHub, ๐Ÿ”— Discord Server, ๐Ÿ”—ย Cheat Sheet,ย ๐Ÿ”—ย autoit-webdriver-boilerplate

Spoiler

๐ŸŒย Au3Forums

๐ŸŽฒ AutoIt (en) Cheat Sheet

๐Ÿ“Š AutoIt limits/defaults

๐Ÿ’Ž Code Katas: [...] (comming soon)

๐ŸŽญ Collection of GitHub users with AutoIt projects

๐Ÿžย False-Positives

๐Ÿ”ฎย Me on GitHub

๐Ÿ’ฌย Opinion about new forum sub category

๐Ÿ“‘ย UDF wiki list

โœ‚ย VSCode-AutoItSnippets

๐Ÿ“‘ย WebDriver FAQs

๐Ÿ‘จโ€๐Ÿซย WebDriver Tutorial (coming soon)

Posted
1 hour ago, WildByDesign said:

I have had some success with the drag cursor. Not quite confident enough about doing a commit yet because I need to test it more.ย _WinAPI_SetSystemCursor seems to be the only way I could get it done smoothly.

There is also theย GUISetCursor(6, 1, $hGui) function.
I had the idea to use the (obsolete=>see MouseGetCursor help remarks) ICON cursor and replace that with _WinAPI_SetSystemCursor and use that with GuiSetCursor to enable that icon for the gui, if that works (untested).
GuiSetCursor with the override parameter should atleast avoid setting the SystemCursor for all cursors used in the gui (normal, hand,...).

Posted (edited)
44 minutes ago, Kanashius said:

I had the idea to use the (obsolete=>see MouseGetCursor help remarks) ICON cursor and replace that with _WinAPI_SetSystemCursor and use that with GuiSetCursor to enable that icon for the gui, if that works (untested).

That's a great idea. And many times, when MS refers to something as obsolete, they usually still leave traces behind and such obsolete feature can often still work for legacy purposes. But in this case, it doesn't seem to work. I tried it right now and it didn't work for me.

One thing that I recall from my Immersive UX (AutoIt) project is that for File Explorer and Explorer++, during a drag operation a window appears with theย SysDragImage class name. But I have no idea how that works to create from AutoIt.

Also, my attempts withย _GUICtrlTreeView_CreateDragImage all failed. The help file example didn't work and I tried all examples from the forum and none of them worked either. Maybe it just doesn't work on Win10/11, but I am not sure.

There is something that I can do, along with whatever cursor change we make. I can show a tooltip that follows the mouse movement during the drag to show the destination as it changes over top of folders before the user releases the mouse button.

EDIT: The ListView variant for creating the drag image (_GUICtrlListView_CreateDragImage) from the help file also seems to do nothing.ย 

Edited by WildByDesign
Posted

I've got the tracking tooltips working great for the drag and drop. It changes the destination folder depending on where the cursor is hovering over.

I was checking outย _GUIToolTip_SetTitleย and noticed that you can have an icon showing:

[optional] Set to one of the values below:.
    $TTI_NONE (0) - No icon [default]
    $TTI_INFO (1) - Information icon
    $TTI_WARNING (2) - Warning icon
    $TTI_ERROR (3) - Error Icon
    $TTI_INFO_LARGE (4) - Large Information Icon
    $TTI_WARNING_LARGE (5) - Large Warning Icon
    $TTI_ERROR_LARGE (6) - Large Error Icon
Quote

As of Windows XP SP2 and later, $iIcon can contain an HICON value. Any value greater than 3 is assumed to be an HICON.

Here is the code for the function from the GuiToolTip.au3 UDF:

Func _GUIToolTip_SetTitle($hTool, $sTitle, $iIcon = 0)
    Local $tBuffer = $__g_tTTBuffer
    DllStructSetData($tBuffer, "Text", $sTitle)
    Local $iRet = __GUICtrl_SendMsg($hTool, $TTM_SETTITLEW, $iIcon, $tBuffer)

    Return $iRet <> 0
EndFunc   ;==>_GUIToolTip_SetTitle

ย 

Does anyone know if this could be used to display a custom icon somehow?

For example, if we could display a specific file type icon or something related to what is being dragged.

Posted
2 minutes ago, Kanashius said:

Yes, you can use GDIPlus to create a HICON:ย _GDIPlus_HICONCreateFromBitmap ( $hBitmap )

Does the UDF have an index of icons stored? That could be very helpful.

Posted (edited)
9 hours ago, SOLVE-SMART said:

Maybe you want to put the CHANGELOG link in your initial post #1 of the thread @WildByDesign?

Great suggestion. I've added the changelog and a link that always goes to the latest release.

Edited by WildByDesign
Posted (edited)

ย Another solution for the cursor would be:ย GUISetCursor(16, 1, $hGui) together with a child-gui, moving along the cursor position.
I wrote an example here:
Just left click drag inside the window (and adjust the $sPathArrowDrag at the top).

#include <WindowsConstants.au3>
#include <WinAPIConv.au3>
#include <WinAPISysWin.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>


Global $sPathArrowDrag = "ArrowDrag.png", $iArrowSize = 30, $bDragging = False

Local $hGui = GUICreate("", 800, 600)
GUISetState(@SW_SHOW, $hGui)
GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUIRegisterMsg($WM_PAINT, "WM_PAINT")

Local $hGuiArrowDrag = GUICreate("", $iArrowSize, $iArrowSize, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_TRANSPARENT), $hGui) ; BitOR($WS_EX_MDICHILD, $WS_EX_TRANSPARENT)
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($sPathArrowDrag)
Local $hBitmap = _GDIPlus_ImageResize($hImage, $iArrowSize, $iArrowSize, 7)
_GDIPlus_ImageDispose($hImage)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGuiArrowDrag)
GUISetState(@SW_HIDE, $hGuiArrowDrag)


While 1
    If GUIGetMsg()=-3 Then
        _GDIPlus_BitmapDispose($hBitmap)
        _GDIPlus_Shutdown()
        Exit
    EndIf
WEnd

Func WM_MOUSEMOVE($hWnd, $iMsg, $wParam, $lParam)
    If $hWnd=$hGui Then
        If BitAND($wParam, 0x0001) Then
            If Not $bDragging Then
                $bDragging = True
                GUISetState(@SW_SHOW, $hGuiArrowDrag)
                GUISetCursor(16, 1, $hGui)
            EndIf
            Local $x = _WinAPI_LoWord($lParam), $y = _WinAPI_HiWord($lParam)
            Local $arPos = WinGetPos($hGui)
            Local $iDiff = $arPos[3] - _WinAPI_GetClientHeight($hGui)
            WinMove($hGuiArrowDrag, "", $arPos[0]+$x+2, $arPos[1]+$y+$iDiff-2)
        Else
            If $bDragging Then
                $bDragging = False
                GUISetState(@SW_HIDE, $hGuiArrowDrag)
                GUISetCursor(2, 0, $hGui)
            EndIf
        EndIf
    EndIf
EndFunc

Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
    If $hWnd<>$hGui Then Return -1 ; HTTRANSPARENT
EndFunc

Func WM_PAINT($hWnd, $msg, $wParam, $lParam)
    If $hWnd=$hGuiArrowDrag Then
        _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW)
        _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
        _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE)
    EndIf
EndFunc

Maybe this help :)
This could also be extended to include the destination (the tooltip you mentioned).
But the cursor should be remade in the target resolution to avoid blur through scaling (grey instead of black lines).

Edited by Kanashius
Posted (edited)
12 hours ago, Kanashius said:

ย Another solution for the cursor would be:ย GUISetCursor(16, 1, $hGui) together with a child-gui, moving along the cursor position.
I wrote an example here:
Just left click drag inside the window (and adjust the $sPathArrowDrag at the top).

12 hours ago, Kanashius said:

This could also be extended to include the destination (the tooltip you mentioned).

This is a great idea. Your example works very well and the child GUI moves around smoothly without any flicker which is great.

I have an idea to extend your suggestion. The idea would be to keep the regular cursor beside (corner maybe) of your child GUI and have the child GUI load/display the icon for the file/folder being moved.

I would have to come up with an idea for what icon to show when multiple files are being dragged.

Anyway, I am having trouble loading the correct icon. I'm loading the icons from the ListView imagelist at the moment.

$hIcon = _GUIImageList_GetIcon($hListImgList, $iListDragIndex, 0)
_GUIToolTip_SetTitle($hToolTip3, 'File Operation', $hIcon)

*ย $iListDragIndex comes fromย $LVN_BEGINDRAG which runs theย _ListGetSelections() which basically grabs the index of any selected listview items with:ย $aListDragItems = _GUICtrlListView_GetSelectedIndices($g_hListView, True)

Everything is working, except for the fact that the icons being loaded into the tooltip are not matching. At the moment, I am just testing this with dragging one file at a time to ensure it works first before I do multiple. I know for certain that the index number is correct because that is used to pull the file name and path. I tried adding +12 to offset the index number and it worked for some of the icons. Some were showing correctly. Yet, most icons were still not showing the right one. So clearly there is much more to this that I am not understanding yet.

I also understand that your UDF keeps an index of icons as well. But I'm not sure how to match up the right icon to the index number or if it can even be used that way. Obviously, the icons used are a smaller size. But I'm trying to get that working first. Then once I understand it, getting larger icons would likely be better. Something similar to the way that yourย __TreeListExplorer__FileGetIconIndex($sPath) function works would be fantastic. I'm just not sure how (or if) I can use that.

EDIT: From what I understand, you store the icon index numbers in a map:ย $__TreeListExplorer__Data.mIcons

I'm not certain if I can access that but also not certain how exactly to match up the right ListView index to the right index in the map.

Edited by WildByDesign
Posted (edited)
27 minutes ago, WildByDesign said:

Anyway, I am having trouble loading the correct icon. I'm loading the icons from the ListView imagelist at the moment.

The index referred in the _GUIImageList_... function is NOT the ListViewItem index. Think of the GUIImageList as a different array, where the images are stored and accessed/added/removed.
My UDF loads the images and stores them there and the position (index), where the icon was stored, for a given extension (or specific filepath) is stored in the $__TreeListExplorer__Data.mIcons map. So I can later look into that map to see, if the extension already has an icon loaded to use that (e.g. return the index of the icon in the guiimagelist matching the extension/path), or otherwise to load it.

Maybe I should change the loading of icons to allow for multiple icon sizes... This could be useful to allow treeviews/listviews to have different icon sizes.ย ๐Ÿค”
Then the function could also be used by your application.

If you want the icon index of a ListView item, you can useย _GUICtrlListView_GetItemImage ( $hWnd, $iIndex [, $iSubItem = 0] ). You can also request theย _GUICtrlListView_GetImageList ( $hWnd, $iImageList ) for a specific ListView.

Edited by Kanashius
Posted (edited)

Here is an example extending your child GUI idea:

EDIT: Icon would likely need to be bigger but this is just an example.

EDIT2: I made the mistake of keeping the tooltip icon in there. That should not be there, of course.

drag2.png

You would need to change that ArrowDrag.png image to some sort of file type icon. In my screenshot, I just used my avatar icon to test quickly.ย 

#include <GuiToolTip.au3>
#include <APIGdiConstants.au3>
#include <WindowsNotifsConstants.au3>
#include <WindowsStylesConstants.au3>
#include <WinAPIProc.au3>
#include <WinAPITheme.au3>
#include <WindowsConstants.au3>
#include <WinAPIConv.au3>
#include <WinAPISysWin.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>

; DPI awareness
DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2)

Global $sPathArrowDrag = "ArrowDrag.png", $iArrowSize = 30, $bDragging = False
Global $hToolTip3
Global $isDarkMode = _WinAPI_ShouldAppsUseDarkMode()

Local $hGui = GUICreate("", 800, 600)
GUISetBkColor(0x202020)

$hToolTip3 = _GUIToolTip_Create(0)
_GUIToolTip_SetMaxTipWidth($hToolTip3, 400)

_GUIToolTip_AddTool($hToolTip3, $hGui, " ", $hGui)
_GUIToolTip_SetTitle($hToolTip3, 'File Operation', $TTI_INFO_LARGE)
_GUIToolTip_Deactivate($hToolTip3)


GUISetState(@SW_SHOW, $hGui)
GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUIRegisterMsg($WM_PAINT, "WM_PAINT")

_themeTooltips()


Local $hGuiArrowDrag = GUICreate("", $iArrowSize, $iArrowSize, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_TRANSPARENT), $hGui) ; BitOR($WS_EX_MDICHILD, $WS_EX_TRANSPARENT)
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($sPathArrowDrag)
Local $hBitmap = _GDIPlus_ImageResize($hImage, $iArrowSize, $iArrowSize, 7)
_GDIPlus_ImageDispose($hImage)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGuiArrowDrag)

GUISetState(@SW_HIDE, $hGuiArrowDrag)


While 1
    If GUIGetMsg()=-3 Then
        _GDIPlus_BitmapDispose($hBitmap)
        _GDIPlus_Shutdown()
        _GUIToolTip_Destroy($hToolTip3)
        Exit
    EndIf
WEnd

Func WM_MOUSEMOVE($hWnd, $iMsg, $wParam, $lParam)
    If $hWnd=$hGui Then
        If BitAND($wParam, 0x0001) Then
            If Not $bDragging Then
                $bDragging = True
                GUISetState(@SW_SHOW, $hGuiArrowDrag)
                _GUIToolTip_Activate($hToolTip3)
                _GUIToolTip_TrackActivate($hToolTip3, True, $hGui, $hGui)
                ;GUISetCursor(16, 1, $hGui)
            EndIf
            Local $x = _WinAPI_LoWord($lParam), $y = _WinAPI_HiWord($lParam)
            Local $arPos = WinGetPos($hGui)
            Local $iDiff = $arPos[3] - _WinAPI_GetClientHeight($hGui)
            ;WinMove($hGuiArrowDrag, "", $arPos[0]+$x+2, $arPos[1]+$y+$iDiff-2)
            WinMove($hGuiArrowDrag, "", $arPos[0]+$x-10, $arPos[1]+$y+$iDiff-20)
            Local $aPosTool3 = MouseGetPos()
            _GUIToolTip_TrackPosition($hToolTip3, $aPosTool3[0], $aPosTool3[1])
            _GUIToolTip_UpdateTipText($hToolTip3, $hGui, $hGui, "Move to New Destination")
        Else
            If $bDragging Then
                $bDragging = False
                GUISetState(@SW_HIDE, $hGuiArrowDrag)
                _GUIToolTip_TrackActivate($hToolTip3, False, $hGui, $hGui)
                _GUIToolTip_Deactivate($hToolTip3)
                ;GUISetCursor(2, 0, $hGui)
            EndIf
        EndIf
    EndIf
EndFunc

Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
    If $hWnd<>$hGui Then Return -1 ; HTTRANSPARENT
EndFunc

Func WM_PAINT($hWnd, $msg, $wParam, $lParam)
    If $hWnd=$hGuiArrowDrag Then
        _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW)
        _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
        _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE)
    EndIf
EndFunc

Func _themeTooltips()
    Local $aData = _WinAPI_EnumProcessWindows(0, False)

    For $i = 1 To $aData[0][0]
        If $aData[$i][1] = "tooltips_class32" Then
            If $isDarkMode Then
                _WinAPI_SetWindowTheme($aData[$i][0], 'DarkMode_Explorer', 'ToolTip')
            Else
                _WinAPI_SetWindowTheme($aData[$i][0], 'Explorer', 'ToolTip')
            EndIf
        EndIf
    Next
EndFunc

Func _WinAPI_ShouldAppsUseDarkMode()
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)
    Local $fnShouldAppsUseDarkMode = 132
    Local $aResult = DllCall('uxtheme.dll', 'bool', $fnShouldAppsUseDarkMode)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_ShouldAppsUseDarkMode

ย 

Edited by WildByDesign
Posted
23 minutes ago, Kanashius said:

The index referred in the _GUIImageList_... function is NOT the ListViewItem index. Think of the GUIImageList as a different array, where the images are stored and accessed/added/removed.

That explains the randomness of what I was seeing. :)

23 minutes ago, Kanashius said:

My UDF loads the images and stores them there and the position (index), where the icon was stored, for a given extension (or specific filepath) is stored in the $__TreeListExplorer__Data.mIcons map. So I can later look into that map to see, if the extension already has an icon loaded to use that (e.g. return the index of the icon in the guiimagelist matching the extension/path), or otherwise to load it.

Maybe I should change the loading of icons to allow for multiple icon sizes... This could be useful to allow treeviews/listviews to have different icon sizes.ย ๐Ÿค”
Then the function could also be used by your application.

That is brilliant engineering from you, as always. You think so many steps ahead and plan incredibly well.

Adapting the function to load multiple icon sizes would be great. If it adds more to the resources usage of the running process, maybe it could be optional where the person using your UDF could specify which icon sizes to load. Either way, that would be very beneficial.

26 minutes ago, Kanashius said:

If you want the icon index of a ListView item, you can useย _GUICtrlListView_GetItemImage ( $hWnd, $iIndex [, $iSubItem = 0] ). You can also request theย _GUICtrlListView_GetImageList ( $hWnd, $iImageList ) for a specific ListView.

I didn't even noticeย _GUICtrlListView_GetItemImage yet or try it. But that sounds like it would solve my current problem and work for now until you've updated the UDF. Thank you. :)

ย 

So it seems like using your child GUI idea could work well. We would certainly have much more flexibility with it to customize it however we need to. I could add the text to it as well without the need for using a tracking tooltip (which they can flicker a bit).

When the child GUI hovers over a legitimate drop target (directory) we could even make (temporarily) the child GUI icon partially transparent if we need to for better visibility of the drop folders under it. Lots of possibilities.

For example, here is how File Explorer and Explorer++ show it:

drag3.png

It doesn't show the cursor, but its near the bottom (center) of the icon. So when you drag it around it is difficult to see which folder you are about to drop the files into. But we could solve that in our implementation by adding some transparency to the icon when it's over valid drop target directories, and if you move away to a non-valid drop target, we can make the icon opaque again.

One thing that I notice about the child GUI example is that it doesn't go off of the parent GUI area. So this would not allow, for example, drag and drop from Files Au3 to the desktop or File Explorer. But that is not a priority right now. Something for later in time. Lots more to do first. :)

Posted

If anyone wants to test out the drag and drop tooltips, you can test theย drag-drop-tooltipsย branch that I just submitted a PR for. There is no worry for file loss or anything because I don't intend to implement the actual file moving/copying until everything is 100% perfect with the output of the drag and drop.

It will show ConsoleWrite's for what would be moved and to where the destination would be. Along with the tooltips as well during the cursor movement.ย  There is still a lot more to do, of course. But the tooltips and ConsoleWrite's should help for testing this functionality.

@Kanashiusย Even if we end up going with your child GUI idea, the structure is in place now for updating the text in the child GUI related to the drag and drop.

Posted (edited)

I will have a look at the pull request as soon as I have the time to.

I also would suggest, when we are talking about the copy/move actions, to have a undo and redo button. A store for file movement actions (like a database or at least a INI, JSON, whatever file) would be nice to have when it comes to undo your last actions.

But this would be another GitHub issue and I would create one to discuss this feature on GitHub and linked here.

My 2 Cents ๐Ÿ˜… . Best regards, Sven.

Edited by SOLVE-SMART

==> AutoIt related: ๐Ÿ”—ย Organization AutoIt Community,ย ๐Ÿ”— GitHub, ๐Ÿ”— Discord Server, ๐Ÿ”—ย Cheat Sheet,ย ๐Ÿ”—ย autoit-webdriver-boilerplate

Spoiler

๐ŸŒย Au3Forums

๐ŸŽฒ AutoIt (en) Cheat Sheet

๐Ÿ“Š AutoIt limits/defaults

๐Ÿ’Ž Code Katas: [...] (comming soon)

๐ŸŽญ Collection of GitHub users with AutoIt projects

๐Ÿžย False-Positives

๐Ÿ”ฎย Me on GitHub

๐Ÿ’ฌย Opinion about new forum sub category

๐Ÿ“‘ย UDF wiki list

โœ‚ย VSCode-AutoItSnippets

๐Ÿ“‘ย WebDriver FAQs

๐Ÿ‘จโ€๐Ÿซย WebDriver Tutorial (coming soon)

Posted

Update: I added some Pull Requests comments and ask for resolving them.

This can be done by add your statement to the comments and click "Resolve conversation" or by (better ๐Ÿ˜…) add a commit with the fixes/additions etc. Than youย click "Resolve conversation".

Best regards
Sven

Btw.: I only write this here, because maybe others are interested into the approval process, too.ย A proper code reviews often lead to comments, which often improves the code and the developer experience and knowledge in the long term.

==> AutoIt related: ๐Ÿ”—ย Organization AutoIt Community,ย ๐Ÿ”— GitHub, ๐Ÿ”— Discord Server, ๐Ÿ”—ย Cheat Sheet,ย ๐Ÿ”—ย autoit-webdriver-boilerplate

Spoiler

๐ŸŒย Au3Forums

๐ŸŽฒ AutoIt (en) Cheat Sheet

๐Ÿ“Š AutoIt limits/defaults

๐Ÿ’Ž Code Katas: [...] (comming soon)

๐ŸŽญ Collection of GitHub users with AutoIt projects

๐Ÿžย False-Positives

๐Ÿ”ฎย Me on GitHub

๐Ÿ’ฌย Opinion about new forum sub category

๐Ÿ“‘ย UDF wiki list

โœ‚ย VSCode-AutoItSnippets

๐Ÿ“‘ย WebDriver FAQs

๐Ÿ‘จโ€๐Ÿซย WebDriver Tutorial (coming soon)

Posted

ย ย 

Hi folks โœŒ๏ธ , new release 0.4.0 - 2026-01-22ย published ๐ŸŽ‰ .
All relevant changes can be found in the CHANGELOGย file.

Have a pleasant day ๐Ÿ˜ย .
Best regards fromย @WildByDesign, myself, and the other contributors.

==> AutoIt related: ๐Ÿ”—ย Organization AutoIt Community,ย ๐Ÿ”— GitHub, ๐Ÿ”— Discord Server, ๐Ÿ”—ย Cheat Sheet,ย ๐Ÿ”—ย autoit-webdriver-boilerplate

Spoiler

๐ŸŒย Au3Forums

๐ŸŽฒ AutoIt (en) Cheat Sheet

๐Ÿ“Š AutoIt limits/defaults

๐Ÿ’Ž Code Katas: [...] (comming soon)

๐ŸŽญ Collection of GitHub users with AutoIt projects

๐Ÿžย False-Positives

๐Ÿ”ฎย Me on GitHub

๐Ÿ’ฌย Opinion about new forum sub category

๐Ÿ“‘ย UDF wiki list

โœ‚ย VSCode-AutoItSnippets

๐Ÿ“‘ย WebDriver FAQs

๐Ÿ‘จโ€๐Ÿซย WebDriver Tutorial (coming soon)

Posted

File Management Features & Help Needed

First of all, Files Au3 belongs to all of us. It belongs to the AutoIt community. Any ideas, contributions, opinions and everything in between are all welcome. Even the name Files Au3 is up for debate at some point in the future if a better name comes along.

I may open a thread in the Help area of the forum and link to this post/thread because not many users likely check this Files Au3 thread.

I have completed most of the logic needed for the drag and drop between TreeView/ListView, TreeView/TreeView and ListView/ListView. Essentially providing what we need to copy/move (and from where) and the destination of where it needs to go. So I wanted to try to start planning ideas and get opinions on the actual file management (copy/move/rename/delete/etc.). There is no drag and drop support outside of Files Au3 at the moment and that would be more of a long term goal.

My own personal ideas and suggestions:

  • Run the file management functionality from a separate process to improve performance and not impact GUI
  • Separately spawned process should make elevation (when necessary) easier
  • We would want to keep the main GUI process unelevated
  • This will allow showing progress dialogs and so on
  • Have the file management functionality process spawn from the main script/process
    • The idea here would be to have one single compiled binary in the end (avoid multiple binaries)
    • Single binary (script) would then spawn whatever separate processes required (since we don't have multi-thread)
    • Process would likely be spawn via command line arguments
    • We would need to pass along source files and destination, etc.
  • This would likely need help from someone well versed in IPC (Inter-Process Communication)
  • We likely need to useย _WinAPI_MoveFileExย andย _WinAPI_CopyFileExย to have callback support for progress dialog
    • Need help from someone well versed in those two functions
  • ListView drag supports multiple selections and the list of files/folders is stored in:ย $aListDragItems
  • TreeView drag is single item (folder only) and is stored in:ย $sTreeDragItem
  • Copy, Paste, and Delete are not implemented yet but that is the easier part

Anyway, these are just my ideas and current thoughts. Everything is open for debate.

Posted
4 hours ago, WildByDesign said:

This would likely need help from someone well versed in IPC (Inter-Process Communication)

I think the easiest solution would be:
1. TCPListen => try ports until one is found, that is open
2. Start the application to copy and provide the TCP-Port through the commandline
3. Communicate through the connection. Main loop in the main programm can check for new messages to update progress. The copy process can send updates and listen for changes (pause/cancel/...) in its loop.

I like the idea with multiple processes for this.

Posted

I made some improvements and simplifications to the drag and drop code inย PR # 17ย to make it more consolidated as to which files need to go to which destination.

Whether the source or destination is TreeView or ListView, the following is always the same now:

$aDragSource - array containing source files to copy or move
$sDragDest - string containing folder destination

When you test a drag and drop onto either the ListView or TreeView, it will run the following:

_MsgExample($aDragSource, $sDragDest)

That just simply shows a nice message box that shows the files from the array (source files) and the destination directory. The idea is to give an idea of what we can pass on to whatever function or spawned process to follow through with the copying of moving of files.

So for any function that we create to do that, we need to be able to pass an array ($aDragSource) and destination string ($sDragDest).

14 hours ago, Kanashius said:

I think the easiest solution would be:
1. TCPListen => try ports until one is found, that is open
2. Start the application to copy and provide the TCP-Port through the commandline
3. Communicate through the connection. Main loop in the main programm can check for new messages to update progress. The copy process can send updates and listen for changes (pause/cancel/...) in its loop.

This sounds great but unfortunately it is not something that I have any experience with.

14 hours ago, Kanashius said:

I like the idea with multiple processes for this.

Thanks. I think that this is the only way to go given the limitations of AutoIt. I suppose we could even spawn a hidden command prompt or something to do the file moving and monitor the output but I would personally prefer to keep everything 100% AutoIt.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...