Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/15/2020 in all areas

  1. INTERIM VERSION 11 Mar 21 A bug in the x64 implementation of some the library TreeView functions meant that some replacement working functions were added to the UDF. Now the Beta TreeView library (from 15.3) has been modified, these functions are no longer required, but they will remain until the modified library is formally released. However, other changes in the Beta mean that the replacement functions will not work under it - don't you just love compatibility problems! So here is an interim release with a modified replacement function so that it will function with Release and Beta versions under both x32 and x64 - I hope! New UDF and examples in zip below. Previous version descriptions: ChangeLog.txt I was fed up with using the native FileOpenDialog and FileSelectFolder which appeared anywhere on the screen in seemingly random sizes and often allowed users to select files from other than the path desired. So I decided to write my own version of an Explorer-type treeview and here it is: ChooseFileFolder. What are the main advantages of this UDF over the normal dialogs? Common format for both file and folder selection. Ability to size and place the dialog where you want it rather than how Windows last left it. Ability to select (and delete) multiple items - even from different folders or drives. You can also select both files and folders from the same tree Ability to preselect items. And there is also a function to allow you to use an existing treeview in your own GUI to display the folder tree - no need to have a dialog at all. Here is a zip file with the UDF and several example scripts: ChooseFileFolder.zip As usual happy to take feedback and, preferably, plaudits. M23
    1 point
  2. Because WM_NOTIFY messages are sent to the parent window. So use GUIRegisterMsg20(_WinAPI_GetParent($hTV), $WM_NOTIFY, WM_NOTIFY)
    1 point
  3. MouseClick is not your best strategy to automate something. What exactly are you trying to do ? Probably there is a better solution.
    1 point
  4. LarsJ

    Using DllCall() in UIASpy

    UI Automation TreeWalker objects and DllCall() functions have absolutely nothing to do with each other. The purpose of the DllCall() functions is to implement compact and fast versions of the _GUICtrlTreeView_ and _GUICtrlListView_ functions. The line you've copied is one of three lines: DllStructSetData( $tItem, "hItem", $hChild ) DllCall( "user32.dll", "lresult", "SendMessageW", "hwnd", $hTV, "uint", $TVM_GETITEMW, "wparam", 0, "struct*", $tItem ) $iIdx = DllStructGetData( $tItem, "Param" ) - 100000 It's a compact and fast version of _GUICtrlTreeView_GetItemParam(). The message sent by SendMessage is handled by the Windows operating system (not AutoIt). Based on the information provided with the message, the operating system returns the treeview item param in the $tItem struct. To list all controls in a window, you would typically use a recursive procedure like this: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=y Opt( "MustDeclareVars", 1 ) #include "UIA_Constants.au3" ; Array index offset relative to UIA_ControlTypeIds = -50000 Global Const $aUIControls = [ _ "Button", "Calendar", "CheckBox", "ComboBox", "Edit", "Hyperlink", "Image", "ListItem", "List", "Menu", _ "MenuBar", "MenuItem", "ProgressBar", "RadioButton", "ScrollBar", "Slider", "Spinner", "StatusBar", "Tab", "TabItem", _ "Text", "ToolBar", "ToolTip", "Tree", "TreeItem", "Custom", "Group", "Thumb", "DataGrid", "DataItem", _ "Document", "SplitButton", "Window", "Pane", "Header", "HeaderItem", "Table", "TitleBar", "Separator", "SemanticZoom", _ "AppBar" ] Global $oUIAutomation Example() Func Example() ; Create UI Automation object $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; Chrome condition Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) ; Find pane control Local $pPane1, $oPane1 $oDesktop.FindFirst( $TreeScope_Children, $pCondition0, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF & @CRLF ) ; List all automation elements of a window ; in a hierarchical structure like a treeview. ListDescendants( $oPane1 ) ;ListDescendants( $oPane1, 2 ) ; Only two levels EndFunc ; List all child elements of parent Func ListDescendants( $oParent, $iLevels = 0, $iLevel = 0 ) If Not IsObj( $oParent ) Then Return If $iLevels And $iLevel = $iLevels Then Return ; Create RawViewWalker object Local $pRawViewWalker, $oRawViewWalker $oUIAutomation.RawViewWalker( $pRawViewWalker ) $oRawViewWalker = ObjCreateInterface( $pRawViewWalker, $sIID_IUIAutomationTreeWalker, $dtag_IUIAutomationTreeWalker ) If Not IsObj( $oRawViewWalker ) Then Return ConsoleWrite( "$oRawViewWalker ERR" & @CRLF ) ; Get first child element Local $pUIElement, $oUIElement $oRawViewWalker.GetFirstChildElement( $oParent, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) Local $sIndent = "" For $i = 0 To $iLevel - 1 $sIndent &= " " Next Local $iControl, $sElement While IsObj( $oUIElement ) $oUIElement.GetCurrentPropertyValue( $UIA_ControlTypePropertyId, $iControl ) $oUIElement.GetCurrentPropertyValue( $UIA_NamePropertyId, $sElement ) ConsoleWrite( $sIndent & $aUIControls[$iControl-50000] & ( $sElement ? ": " & $sElement : "" ) & @CRLF ) ListDescendants( $oUIElement, $iLevels, $iLevel + 1 ) $oRawViewWalker.GetNextSiblingElement( $oUIElement, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) WEnd EndFunc Output of your original post (before I added my post) displayed in Chrome: $oUIAutomation OK $oDesktop OK $pCondition0 OK $oPane1 OK Document: Using DllCall() in UIASpy - AutoIt General Help and Support - AutoIt Forums Custom Custom Custom Custom Hyperlink: AutoIt Logo Image: AutoIt Logo List ListItem Hyperlink: Existing user? Sign In   Text: Existing user? Sign In   Custom Text: ? ListItem Hyperlink: Sign Up Text: Sign Up Custom Custom Custom Custom Custom Edit: Search... Button Custom Text: ? List Custom ListItem Hyperlink: Browse Text: Browse List ListItem Hyperlink: Forums Text: Forums ListItem Hyperlink: Downloads Text: Downloads ListItem Hyperlink: Calendar Text: Calendar ListItem Hyperlink: Forum Rules Text: Forum Rules ListItem Hyperlink: Wiki Text: Wiki ListItem Hyperlink: AutoIt Resources Text: AutoIt Resources Custom Text: ? ListItem Hyperlink: FAQ Text: FAQ ListItem Hyperlink: Our Picks Text: Our Picks Custom Table Custom Custom List ListItem Hyperlink: All Activity Text: ? Text: Text: All Activity List ListItem Hyperlink: Home Custom Text: ? Text: Home Custom Text: ? ListItem Hyperlink: AutoIt v3 Text: AutoIt v3 Custom Text: ? ListItem Hyperlink: AutoIt Help and Support Text: AutoIt Help and Support Custom Text: ? ListItem Hyperlink: AutoIt General Help and Support Text: AutoIt General Help and Support Custom Text: ? ListItem Text: Using DllCall() in UIASpy Custom Hyperlink List ListItem Custom Custom Custom Document Document Custom Custom Custom Custom Custom Custom: mulesoft.com Hyperlink: Download Now - RESTful API Text: Download Now - RESTful API Custom Hyperlink: Great Practices Around How To Plan, Design, Build, Manage and Share Your APIs. mulesoft.com Text: Great Practices Around How To Plan, Design, Build, Manage and Share Your APIs. mulesoft.com Hyperlink: OPEN Text: OPEN Custom Document Document Custom Custom Custom Text: ? Hyperlink: Sign in to follow this Text: Sign in to follow this Text:    Custom Hyperlink: Followers Text: Followers Hyperlink: 1 Text: 1 Custom Custom Hyperlink: rmckay Image: rmckay Custom: Using DllCall() in UIASpy Table Text: Using DllCall() in UIASpy Custom Text: By Hyperlink: rmckay Text: rmckay Text: , Edit: 04/13/2020 08:40 PM Text: Monday at 08:40 PM Text: in Hyperlink: AutoIt General Help and Support Text: AutoIt General Help and Support Custom: List ListItem Hyperlink: dllcall() Custom Text: dllcall() Custom ListItem Hyperlink: uiautomation Custom Text: uiautomation Custom List Custom Custom Custom Hyperlink Document Custom Custom Hyperlink: rmckay Text: rmckay List ListItem Text: Seeker ListItem Hyperlink: rmckay Image: rmckay ListItem Text: Active Members ListItem Hyperlink: 0 Custom Text: ? Text: 0 ListItem Text: 33 posts Custom Custom Custom List ListItem Hyperlink: Share this post Custom Text: ? Custom Hyperlink: Posted Text: Posted Edit: 04/13/2020 08:40 PM Text: Monday at 08:40 PM Text: Text: (edited) Custom Table Custom Text: I'm trying to understand the use of TreeWalker and DllCall()s.  My ultimate goal is to use TreeWalker to list all children of webpages.  I've been working through the files for UIASpy to understand the logic.  After a weeks worth of searching for examples I'm still stuck on the reason for the repeated use of DllCalls in most of the functions.  Here is an example - the function 'UIASpy_CheckWindows()' (located in UIASpy_Elements.au3) is called from file UIASpy_Gui.au3.  In the function the following DllCall is used: Edit Hyperlink: DllCall Text: DllCall Text: ( Text: Text: "user32.dll" Text: , Text: Text: "lresult" Text: , Text: Text: "SendMessageW" Text: , Text: Text: "hwnd" Text: , Text: Text: $hTV Text: , Text: Text: "uint" Text: , Text: Text: $TVM_GETITEMW Text: , Text: Text: "wparam" Text: , Text: Text: 0 Text: , Text: Text: "struct*" Text: , Text: Text: $tItem Text: Text: ) Custom Text: I understand that the function 'SendMessageW' in 'user32.dll' sends a message to the window $hTV.  The message is '$TVM_GETNEXTITEM' and '$tItem' is a struct with additional information - Microsoft Doc - Hyperlink: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessagew Text: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessagew Text: .  The window $hTV is created in UIASpy_Gui.au3 and that's where I get lost.  Is there code in UIASpy_Gui.au3 that handles this message?  I don't know what to look for.  This procedure - Function called that contains DllCall (SendMessage) is repeatedly used.  Thanks in advance. Text: Edited Edit: 04/13/2020 08:42 PM Text: Monday at 08:42 PM Text: by rmckay Custom: Text: Typo Custom Custom List Hyperlink Custom Custom: Create an account or sign in to comment Text: Create an account or sign in to comment Custom Text: You need to be a member in order to leave a comment Table Custom: Create an account Text: Create an account Custom Text: Sign up for a new account in our community. It's easy! Hyperlink: Register a new account Text: Register a new account Custom: Sign in Text: Sign in Custom Text: Already have an account? Sign in here. Hyperlink: Sign In Now Text: Sign In Now Table Table Table Custom Hyperlink: GO TO TOPIC LISTING Text: GO TO TOPIC LISTING Custom Text: ? Separator List ListItem Hyperlink: Share on LinkedIn Custom Text: ? ListItem Hyperlink: Share on Twitter Custom Text: ? ListItem Hyperlink: Share on Facebook Custom Text: ? ListItem Hyperlink: Share on Reddit Custom Text: ? List ListItem Custom: Similar Content Text: Similar Content List ListItem Custom Hyperlink: rmckay Image: rmckay Table Hyperlink: Retrieve items from combo box with FindAll() Text: Retrieve items from combo box with FindAll() Text: By Hyperlink: rmckay Text: rmckay Custom: Text: Hello, Custom: Text: I'm trying to set a value in a combo box on a Chrome web page.  I've checked that the Chrome://accessibility is on and have checked to see that it's working with one of @LarsJ's scripts.  I've... ListItem Custom Hyperlink: rmckay Image: rmckay Table Hyperlink: Need help with $UIA_NativeWindowHandlePropertyId Text: Need help with $UIA_NativeWindowHandlePropertyId Text: By Hyperlink: rmckay Text: rmckay Custom: Text: Hello, Custom: Text: I'm trying to automate the settings of combo boxes in a program. The combo boxes are child windows of two different windows.  They have the similar but different titles so I can locate... ListItem Custom Hyperlink: rmckay Image: rmckay Table Hyperlink: Using SetValue() on Slider Control Text: Using SetValue() on Slider Control Text: By Hyperlink: rmckay Text: rmckay Custom: Text: I'm trying to set the slider in a window using RangeValuePattern.SetValue().  The window is used to set the start point for replaying market data in the app NinjaTrader 8. When using the Action window in Inspect.exe I can set a value and the slider responds.  When I run a script that selects the slider and uses .SetValue() with the same value the slider does not move.  I've tried giving... ListItem Custom Hyperlink: Earthshine Image: Earthshine Table Hyperlink: Fun with TreeWalkers Text: Fun with TreeWalkers Text: By Hyperlink: Earthshine Text: Earthshine Custom: Text: So, I made this console app--using TreeWalkers of course to walk the UI Tree-- that starts at the root and looks for enabled, active controls--and in piping that to a file, I got this (edited, lots of controls in that list), above. LOL, so, those commands that are stored in memory are control elements! Sweet. this UIAutomation stuff is awesome. @junkew got me into this, blame his... ListItem Custom Hyperlink: souldjer777 Image: souldjer777 Table Hyperlink: SetFocus on list item - Don't know what I'm doing wrong Text: SetFocus on list item - Don't know what I'm doing wrong Text: By Hyperlink: souldjer777 Text: souldjer777 Custom: Text: Good Morning, Custom: Text: I'm trying to use the code I had previously to select an item from a list. I believe I want to "setfocus". However, I'm getting and error and I believe it's my code. I don't know what Global... ListItem Custom Custom Custom Document Document Custom Custom Custom Custom Custom Custom: mulesoft.com Hyperlink: Modern Design Techniques Text: Modern Design Techniques Custom Hyperlink: Great Practices Around How To Plan, Design, Build, Manage and Share Your APIs. Text: Great Practices Around How To Plan, Design, Build, Manage and Share Your APIs. Custom: mulesoft.com Hyperlink: mulesoft.com Text: mulesoft.com Hyperlink: OPEN Text: OPEN Custom Document Document Custom List ListItem Hyperlink: All Activity Text: ? Text: Text: All Activity List ListItem Hyperlink: Home Custom Text: ? Text: Home Custom Text: ? ListItem Hyperlink: AutoIt v3 Text: AutoIt v3 Custom Text: ? ListItem Hyperlink: AutoIt Help and Support Text: AutoIt Help and Support Custom Text: ? ListItem Hyperlink: AutoIt General Help and Support Text: AutoIt General Help and Support Custom Text: ? ListItem Text: Using DllCall() in UIASpy Custom Custom List ListItem Hyperlink: Theme Text: Theme Custom Text: ? ListItem Hyperlink: Privacy Policy Text: Privacy Policy ListItem Hyperlink: Contact Us Text: Contact Us Custom Custom Hyperlink: Powered by Invision Community Text: Powered by Invision Community TitleBar MenuBar: System MenuItem: System Button: Minimize Button: Maximize Button: Close Pane: Google Chrome Pane Button: Minimize Button: Maximize Button: Restore Button: Close Pane Pane Pane Tab TabItem: Using DllCall() in UIASpy - AutoIt General Help and Support - AutoIt Forums Button: Close TabItem: Accessibility Internals Button: Close Button: New Tab Pane Button: Back Button: Forward Button: Reload Custom Pane MenuItem: View site information Custom Edit: Address and search bar Pane Button: Bookmark this tab Custom Custom: Extensions Button: Blank New Tab Page Separator Pane Button: Current user Button: Chrome Pane Pane Document: Using DllCall() in UIASpy - AutoIt General Help and Support - AutoIt Forums Custom Custom Custom Custom Hyperlink: AutoIt Logo Image: AutoIt Logo List ListItem Hyperlink: Existing user? Sign In   Text: Existing user? Sign In   Custom Text: ? ListItem Hyperlink: Sign Up Text: Sign Up Custom Custom Custom Custom Custom Edit: Search... Button Custom Text: ? List Custom ListItem Hyperlink: Browse Text: Browse List ListItem Hyperlink: Forums Text: Forums ListItem Hyperlink: Downloads Text: Downloads ListItem Hyperlink: Calendar Text: Calendar ListItem Hyperlink: Forum Rules Text: Forum Rules ListItem Hyperlink: Wiki Text: Wiki ListItem Hyperlink: AutoIt Resources Text: AutoIt Resources Custom Text: ? ListItem Hyperlink: FAQ Text: FAQ ListItem Hyperlink: Our Picks Text: Our Picks Custom Table Custom Custom List ListItem Hyperlink: All Activity Text: ? Text: Text: All Activity List ListItem Hyperlink: Home Custom Text: ? Text: Home Custom Text: ? ListItem Hyperlink: AutoIt v3 Text: AutoIt v3 Custom Text: ? ListItem Hyperlink: AutoIt Help and Support Text: AutoIt Help and Support Custom Text: ? ListItem Hyperlink: AutoIt General Help and Support Text: AutoIt General Help and Support Custom Text: ? ListItem Text: Using DllCall() in UIASpy Custom Hyperlink List ListItem Custom Custom Custom Document Document Custom Custom Custom Custom Custom Custom: mulesoft.com Hyperlink: Download Now - RESTful API Text: Download Now - RESTful API Custom Hyperlink: Great Practices Around How To Plan, Design, Build, Manage and Share Your APIs. mulesoft.com Text: Great Practices Around How To Plan, Design, Build, Manage and Share Your APIs. mulesoft.com Hyperlink: OPEN Text: OPEN Custom Document Document Custom Custom Custom Text: ? Hyperlink: Sign in to follow this Text: Sign in to follow this Text:    Custom Hyperlink: Followers Text: Followers Hyperlink: 1 Text: 1 Custom Custom Hyperlink: rmckay Image: rmckay Custom: Using DllCall() in UIASpy Table Text: Using DllCall() in UIASpy Custom Text: By Hyperlink: rmckay Text: rmckay Text: , Edit: 04/13/2020 08:40 PM Text: Monday at 08:40 PM Text: in Hyperlink: AutoIt General Help and Support Text: AutoIt General Help and Support Custom: List ListItem Hyperlink: dllcall() Custom Text: dllcall() Custom ListItem Hyperlink: uiautomation Custom Text: uiautomation Custom List Custom Custom Custom Hyperlink Document Custom Custom Hyperlink: rmckay Text: rmckay List ListItem Text: Seeker ListItem Hyperlink: rmckay Image: rmckay ListItem Text: Active Members ListItem Hyperlink: 0 Custom Text: ? Text: 0 ListItem Text: 33 posts Custom Custom Custom List ListItem Hyperlink: Share this post Custom Text: ? Custom Hyperlink: Posted Text: Posted Edit: 04/13/2020 08:40 PM Text: Monday at 08:40 PM Text: Text: (edited) Custom Table Custom Text: I'm trying to understand the use of TreeWalker and DllCall()s.  My ultimate goal is to use TreeWalker to list all children of webpages.  I've been working through the files for UIASpy to understand the logic.  After a weeks worth of searching for examples I'm still stuck on the reason for the repeated use of DllCalls in most of the functions.  Here is an example - the function 'UIASpy_CheckWindows()' (located in UIASpy_Elements.au3) is called from file UIASpy_Gui.au3.  In the function the following DllCall is used: Edit Hyperlink: DllCall Text: DllCall Text: ( Text: Text: "user32.dll" Text: , Text: Text: "lresult" Text: , Text: Text: "SendMessageW" Text: , Text: Text: "hwnd" Text: , Text: Text: $hTV Text: , Text: Text: "uint" Text: , Text: Text: $TVM_GETITEMW Text: , Text: Text: "wparam" Text: , Text: Text: 0 Text: , Text: Text: "struct*" Text: , Text: Text: $tItem Text: Text: ) Custom Text: I understand that the function 'SendMessageW' in 'user32.dll' sends a message to the window $hTV.  The message is '$TVM_GETNEXTITEM' and '$tItem' is a struct with additional information - Microsoft Doc - Hyperlink: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessagew Text: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessagew Text: .  The window $hTV is created in UIASpy_Gui.au3 and that's where I get lost.  Is there code in UIASpy_Gui.au3 that handles this message?  I don't know what to look for.  This procedure - Function called that contains DllCall (SendMessage) is repeatedly used.  Thanks in advance. Text: Edited Edit: 04/13/2020 08:42 PM Text: Monday at 08:42 PM Text: by rmckay Custom: Text: Typo Custom Custom List Hyperlink Custom Custom: Create an account or sign in to comment Text: Create an account or sign in to comment Custom Text: You need to be a member in order to leave a comment Table Custom: Create an account Text: Create an account Custom Text: Sign up for a new account in our community. It's easy! Hyperlink: Register a new account Text: Register a new account Custom: Sign in Text: Sign in Custom Text: Already have an account? Sign in here. Hyperlink: Sign In Now Text: Sign In Now Table Table Table Custom Hyperlink: GO TO TOPIC LISTING Text: GO TO TOPIC LISTING Custom Text: ? Separator List ListItem Hyperlink: Share on LinkedIn Custom Text: ? ListItem Hyperlink: Share on Twitter Custom Text: ? ListItem Hyperlink: Share on Facebook Custom Text: ? ListItem Hyperlink: Share on Reddit Custom Text: ? List ListItem Custom: Similar Content Text: Similar Content List ListItem Custom Hyperlink: rmckay Image: rmckay Table Hyperlink: Retrieve items from combo box with FindAll() Text: Retrieve items from combo box with FindAll() Text: By Hyperlink: rmckay Text: rmckay Custom: Text: Hello, Custom: Text: I'm trying to set a value in a combo box on a Chrome web page.  I've checked that the Chrome://accessibility is on and have checked to see that it's working with one of @LarsJ's scripts.  I've... ListItem Custom Hyperlink: rmckay Image: rmckay Table Hyperlink: Need help with $UIA_NativeWindowHandlePropertyId Text: Need help with $UIA_NativeWindowHandlePropertyId Text: By Hyperlink: rmckay Text: rmckay Custom: Text: Hello, Custom: Text: I'm trying to automate the settings of combo boxes in a program. The combo boxes are child windows of two different windows.  They have the similar but different titles so I can locate... ListItem Custom Hyperlink: rmckay Image: rmckay Table Hyperlink: Using SetValue() on Slider Control Text: Using SetValue() on Slider Control Text: By Hyperlink: rmckay Text: rmckay Custom: Text: I'm trying to set the slider in a window using RangeValuePattern.SetValue().  The window is used to set the start point for replaying market data in the app NinjaTrader 8. When using the Action window in Inspect.exe I can set a value and the slider responds.  When I run a script that selects the slider and uses .SetValue() with the same value the slider does not move.  I've tried giving... ListItem Custom Hyperlink: Earthshine Image: Earthshine Table Hyperlink: Fun with TreeWalkers Text: Fun with TreeWalkers Text: By Hyperlink: Earthshine Text: Earthshine Custom: Text: So, I made this console app--using TreeWalkers of course to walk the UI Tree-- that starts at the root and looks for enabled, active controls--and in piping that to a file, I got this (edited, lots of controls in that list), above. LOL, so, those commands that are stored in memory are control elements! Sweet. this UIAutomation stuff is awesome. @junkew got me into this, blame his... ListItem Custom Hyperlink: souldjer777 Image: souldjer777 Table Hyperlink: SetFocus on list item - Don't know what I'm doing wrong Text: SetFocus on list item - Don't know what I'm doing wrong Text: By Hyperlink: souldjer777 Text: souldjer777 Custom: Text: Good Morning, Custom: Text: I'm trying to use the code I had previously to select an item from a list. I believe I want to "setfocus". However, I'm getting and error and I believe it's my code. I don't know what Global... ListItem Custom Custom Custom Document Document Custom Custom Custom Custom Custom Custom: mulesoft.com Hyperlink: Modern Design Techniques Text: Modern Design Techniques Custom Hyperlink: Great Practices Around How To Plan, Design, Build, Manage and Share Your APIs. Text: Great Practices Around How To Plan, Design, Build, Manage and Share Your APIs. Custom: mulesoft.com Hyperlink: mulesoft.com Text: mulesoft.com Hyperlink: OPEN Text: OPEN Custom Document Document Custom List ListItem Hyperlink: All Activity Text: ? Text: Text: All Activity List ListItem Hyperlink: Home Custom Text: ? Text: Home Custom Text: ? ListItem Hyperlink: AutoIt v3 Text: AutoIt v3 Custom Text: ? ListItem Hyperlink: AutoIt Help and Support Text: AutoIt Help and Support Custom Text: ? ListItem Hyperlink: AutoIt General Help and Support Text: AutoIt General Help and Support Custom Text: ? ListItem Text: Using DllCall() in UIASpy Custom Custom List ListItem Hyperlink: Theme Text: Theme Custom Text: ? ListItem Hyperlink: Privacy Policy Text: Privacy Policy ListItem Hyperlink: Contact Us Text: Contact Us Custom Custom Hyperlink: Powered by Invision Community Text: Powered by Invision Community Pane
    1 point
  5. CrshOverride, Welcome to the AutoIt forums. I am delighted that you find my UDF useful - and sorry that you appear to have run into some problems using it. But I do not understand the problem that you have with the GUI closing when you return from the _CFF_Embed call - the UDF does nothing to close the main GUI at that point, all it does is delete the TreeView content which can be restored without problem. In fact the Example_3 script in the UDF zip shows 3 embedded TreeViews operating within the main GUI which remains open until it is deliberately closed by the user. I attach a simple example showing how I would use the function, check the results and the GUI content and loop until everything is good ( which means: a file selected + some content in the input + checkbox NOT checked). And you are correct that when the _CFF_Embed function is running the main GUI [X] is ignored - you need to end the function using {ESC} before the main GUI becomes active again. I can easily add something to the function to look for that event and return immediately setting a suitable @error value which will allow the user to exit the script. I have added some suggested code in the example script - but of course it does not work at the moment as the current UDF does not return the @error value! Here is the example script: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ChooseFileFolder.au3> $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xC4C4C4) $cTV = GUICtrlCreateTreeView(250, 10, 200, 400) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20) $cCheckbox = GUICtrlCreateCheckbox("Test", 10, 100, 200, 20) $cLoad = GUICtrlCreateButton("Load Tree", 10, 190, 80, 30) GUISetState() ; Register UDF message handler _CFF_RegMsg() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cLoad While 1 $sRet = _CFF_Embed($cTV) ; THIS DOES NOT WORK WITH THE CURRENT UDF - IT IS A SUGGESTION FOR HOW IT MIGHT BE INCORPORATED ; Check for $GUI_EVENT_CLOSE detected by the function If @error = 99 Then ; Specific error code detected- so the user can exit directly Exit EndIf ; END OF SUGGESTION ; Now do your validation If $sRet = "" Then MsgBox($MB_SYSTEMMODAL, "Ooops!", "No file selected!") ; In each of these fail cases the tree reopens ElseIf GUICtrlRead($cInput) = "" Then MsgBox($MB_SYSTEMMODAL, "Ooops!", "No base input selected!") ElseIf GUICtrlRead($cCheckbox) = $GUI_CHECKED Then MsgBox($MB_SYSTEMMODAL, "Ooops!", "Checkbox was checked!") Else ; All good so carry on ExitLoop EndIf WEnd If MsgBox($MB_SYSTEMMODAL + $MB_YESNO, "All good!", "Close GUI?") = $IDYES Then Exit EndIf EndSwitch WEnd I hope this helps - if not then I have to assume there is something in your code which is closing your GUI - so can you please post your script, or a simplified version of it so that I can take a look. M23
    1 point
  6. So at least an option, because a user should not mess with UDF code )). I did the change on my side, but what will happen now once you updated the UDF, how should i replace it? I will have to make my changes again. But i think if user specified $hParent he expect it to be attached to this window, otherwise i don't see a reason for this parameter, if you want to be able to handle the parent window, do not use this parameter. Thanks, will test it...
    1 point
  7. Really helpful udf, just was looking for something like that. Just few notes... If $hParent set, you should disable the window. If $hParent Then WinSetState($hParent, '', @SW_DISABLE) EndIf and enable it before GUIDelete: If $hParent Then WinSetState($hParent, '', @SW_ENABLE) EndIf And what about icons for the items? And i suggest to add expansion for checked items (if checkboxes used) that stored in subfolders. I mean when using: _CFF_SetPreCheck($aCheckList, False) _CFF_Choose('Select:', 300, 400, -1, -1, $sRoot, Default, 16, -1, $hParent)
    1 point
  8. Melba23

    MrUdinov

    If you keep asking for help to automate sites containing pirated videos you cannot expect to last long here. Take a month off to consider if you wish to remain a member here as any further attempts to automate that site will result in your permanent removal from the community. M23 P.S. Seems a long time since we needed to do something like this - what a pity someone had to force our hand.
    1 point
  9. As a pending Question to melba I hope you won't mind me bringing up this Question as it isn't directly related to the UDF @OP (not yet anyways) but if you expand the "C:\Users\Public" directory when using kosamja's example posted here it seems impossible to expand folders under that Dir To start i have replaced this line: If Not FileExists($sTreeViewItemPath) Then Return SetError(3, 0, False) With If Not FileExists($sTreeViewItemPath) Then If StringInStr($sTreeViewItemPath, "Public ") Then $sTreeViewItemPath = StringReplace($sTreeViewItemPath, "Public ", "") If Not FileExists($sTreeViewItemPath) Then Return SetError(3, 0, False) EndIf EndIf Which turns those folders to become available as seen but still not expandable yet! As I'm not sure what try next, TIA for any ideas Deye Edit : I wasn't paying attention to whats for it in _AddFolderContentToTreeView() Partly Fixed by replacing: If Not FileExists($sParentTreeViewItemPath) Then Return SetError(2, 0, False) with: If Not FileExists($sParentTreeViewItemPath) Then If StringInStr($sParentTreeViewItemPath, "Public ") Then $sParentTreeViewItemPath = StringReplace($sParentTreeViewItemPath, "Public ", "") If Not FileExists($sParentTreeViewItemPath) Then Return SetError(2, 0, False) EndIf EndIf pending : to rid the extra Public Account Pictures dir Thanks
    1 point
  10. is it possible with ChooseFileFolder to start adding new items immediately after clicking +, like in example in page 15 (https://www.autoitscript.com/forum/topic/125293-choosefilefolder-new-version-16-feb-17/?do=findComment&comment=1431811)? ---------------------------------------------------------------------------------- Edited page 15 example to work without objects, but still too slow... File and Folder TreeView.au3
    1 point
  11. kosamja, That is very impressive code: "Bravo"!!! If it is yours, then would you mind If I looked to see how I might rewrite the UDF to use it. If not, then can you please let me know where you found it so I can ask the author. M23
    1 point
  12. kosamja, Thanks for letting me know you still have problems with the UDF in x64 - it worked fine in my machine and so I thought I had cracked it. The code you posted is very different from the UDF and so is incompatible with it - I will keep searching for a solution within the code I have. M23 Edit: See below.
    1 point
  13. tested, result (ChooseFileFolder_Example_1.au3): this works correctly: Treeview Explorer.au3
    1 point
  14. xtcislove, Sorry it has taken so long, but I managed to reproduce the effect you were seeing above on another x64 machine and pinpoint the problem - which I believe I have now solved. Here is an amended version of the UDF - can you please test it and see if it solves the problem for you too: ChooseFileFolder_Mod.au3 By the way, this Beta code also contains a whole slew of other amendments which I have been waiting to release - I put them all together to se if they would play nicely once all inserted and so far they do. So do not be alarmed if some things appear a little different - all I am interested in at the moment is getting the UDF to work correctly under x64. M23
    1 point
  15. @Melba23 Any tip for ListViews? Ps: Why should i care? Porn is normal
    1 point
  16. xtcislove, In the end it was not the struct at all, but a number of occasions where the x64 handle of the TreeView item was being truncated to an x32 value by various AutoIt functions so that it was no longer valid. Please try this altered version of the UDF and see if it works for you under x64 when the #AutoIt3Wrapper_UseX64=y directive is used: M23
    1 point
  17. xtcislove, I have found the problem - the main struct in the UDF WM_NOIFY handler is not returning the correct data. Now comes the hard part - getting the struct correct! M23
    1 point
  18. xtcislove, Thanks for that - it sounds like it could well be a similar problem. I will be investigating the CFF problem further over the weekend - I will keep an eye open for any ListView problems at the same time. M23
    1 point
  19. xtcislove, Something like this was brought up once, but I never got to the bottom of it as I did not have an x64 machine on which to test. Plus the reporting member was banned soon afterwards and others could run the code without problem. I have just tried the code on my x64 laptop and I get a similar problem - either no subfolders/files or several iterations of them! I will investigate further - it certainly is linked to the #AutoIt3Wrapper_UseX64=y directive as it works fine without it. M23
    1 point
  20. Sorry i edited my posts: Edit 3: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> #include <Array.au3> #include <ChooseFileFolder.au3> Local $sRet, $aRet Global $sRootFolder = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", Default, -1)) $sRet = _CFF_RegMsg() If Not $sRet Then MsgBox(16, "Failure!", "Handler not registered") Exit EndIf $sRet = _CFF_Choose("Ex 9 - Multiple files and folders", 300, 500, -1, -1, "", Default, 0 + 16, -1) If $sRet Then $aRet = StringSplit($sRet, "|") $sRet = "" For $i = 1 To $aRet[0] $sRet &= $aRet[$i] & @CRLF Next MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "Ex 9 - Multiple files and folders", "Selected:" & @CRLF & @CRLF & $sRet) Else MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "Ex 9", "No Selection") EndIf Does NOT work from scite or if compiled. #include <File.au3> #include <Array.au3> #include <ChooseFileFolder.au3> Local $sRet, $aRet Global $sRootFolder = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", Default, -1)) $sRet = _CFF_RegMsg() If Not $sRet Then MsgBox(16, "Failure!", "Handler not registered") Exit EndIf $sRet = _CFF_Choose("Ex 9 - Multiple files and folders", 300, 500, -1, -1, "", Default, 0 + 16, -1) If $sRet Then $aRet = StringSplit($sRet, "|") $sRet = "" For $i = 1 To $aRet[0] $sRet &= $aRet[$i] & @CRLF Next MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "Ex 9 - Multiple files and folders", "Selected:" & @CRLF & @CRLF & $sRet) Else MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "Ex 9", "No Selection") EndIf Works if compiled and if run from scite Edit: @Melba23 I see its a known issue with x64. but it reads like you implemented a fix already?
    1 point
  21. Hi Melba, i'm new to AutoIt but i've to say, I really like it more and more. Trying it out, I came across your script "ChooseFileFolder". I wonder if it's possible to adjust your script without too much effort so that it lists the icons of the folders and files as well (inbetween checkbox and filename). A little example of a TreeView with Icons by a script from Yashied: Thank you for your great scripts Slevin
    1 point
  22. Hi Melba, No matter what I have tried It was just impossible using _GUICtrlTreeView_InsertItem (@ adding\keeping the hierarchy of the letters in check) Any how, by amending in a few lines as shown in this part Its now resolved to add drives (as last on the parent root ) .. without need for redrawing @ calling this function alone on refresh Thanks again Deye
    1 point
  23. Melba, The last mode you had posted doesn't seem to react on doing a refresh Neither show any new drive after plugging a pen drive when doing a refresh right after I came out with this so far A new drive should show up when plugging in a pen drive or deleted when unplugged, pointing the refresh to this function Func _CFF_ReCheck_Drives($cTV, ByRef $sDrives, ByRef $aAll_Drives) Local $hTV, $cItem, $hItem, $aAll_Drives_ReCheck = DriveGetDrive("ALL") Local $bNative_TV = True If IsHWnd($cTV) Then $bNative_TV = False $hTV = $cTV Else $hTV = GUICtrlGetHandle($cTV) EndIf ; Removing drives that are no longer connected For $i = 1 To $aAll_Drives[0] _ArraySearch($aAll_Drives_ReCheck, $aAll_Drives[$i]) If @error = 6 Then _GUICtrlTreeView_Delete($hTV, _GUICtrlTreeView_FindItem($hTV, $aAll_Drives[$i], "", 0)) Next ; inserting new drives that are not currently listed in the treeview For $i = 1 To $aAll_Drives_ReCheck[0] If _GUICtrlTreeView_FindItem($hTV, $aAll_Drives_ReCheck[$i], "", 0) Then $hItem = _GUICtrlTreeView_FindItem($hTV, $aAll_Drives_ReCheck[$i], "", 0) ContinueLoop EndIf _GUICtrlTreeView_InsertItem($hTV, StringUpper($aAll_Drives_ReCheck[$i]), 0, $hItem) _GUICtrlTreeView_SetChildren($hTV, $hItem, 1) Next $aAll_Drives = $aAll_Drives_ReCheck $sDrives = $aAll_Drives EndFunc Will stop by later to see if anything new arises Thanks Deye
    1 point
  24. Deye, Sorry, I did realise that you had posted code above (which I have still not inspected) - here is my Beta which uses the __CFF_Refresh function called programmatically to toggle a "discard/retain existing selection during refresh" flag, while still allowing the same function to be called via a HotKey for the actual refresh (I must say I am quite pleased with that little trick!): And a new example script showing the function in action - just check the console to see whether the items will be retained or discarded during the refresh: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "ChooseFileFolder_Deye.au3" ; Set HotKey (Ctrl-R) for refresh HotKeySet("^r", "_CFF_Refresh") _CFF_RegMsg() $vRet = _CFF_Refresh(1) ConsoleWrite("Retain: " & $vRet & @CRLF) ; Basic _Choose dialog $sRet = _CFF_Choose ("Basic Test", 1, 1, -1, -1, "", "", 0, 50) ConsoleWrite($sRet & " - " & @error & " - " & @extended & @CRLF) $vRet = _CFF_Refresh(0) ConsoleWrite("Retain: " & $vRet & @CRLF) ; Combo _Choose dialog $sRet = _CFF_Choose ("Combo Test", 1, 1, -1, -1, "||c", "", 0, 50) ConsoleWrite($sRet & " - " & @error & " - " & @extended & @CRLF) $vRet = _CFF_Refresh(1) ConsoleWrite("Retain: " & $vRet & @CRLF) ; Checkbox _Choose dialog $sRet = _CFF_Choose ("Checkbox Test", 1, 1, -1, -1, "", "", 0, -1) ConsoleWrite($sRet & " - " & @error & " - " & @extended & @CRLF) $vRet = _CFF_Refresh(0) ConsoleWrite("Retain: " & $vRet & @CRLF) ; Create GUI for _Embed test $hGUI = GUICreate("Embed Test", 500, 500) $cTreeView = GUICtrlCreateTreeView(10, 10, 200, 200) $cReturn = GUICtrlCreateButton("Return", 400, 10, 80, 30) $cList = GUICtrlCreateList("", 10, 300, 200, 150) $cRefresh = GUICtrlCreateDummy() GUISetState() ; _Embed $sRet = _CFF_Embed ($cTreeView, "", "*", 0, $cReturn, $cList, $cRefresh) ConsoleWrite($sRet & " - " & @error & " - " & @extended & @CRLF) $vRet = _CFF_Refresh(1) ConsoleWrite("Retain: " & $vRet & @CRLF) $sRet = _CFF_Embed ($cTreeView, "", "*", 0, $cReturn, $cList, $cRefresh) ConsoleWrite($sRet & " - " & @error & " - " & @extended & @CRLF) Let me know what you think. And please take note of this warning in the __CFF_Refresh header: ; NOTE: When using Ctrl-Return the CTRL key MUST be kept pressed until the refresh splash screen appears ; This is particularly true when treeview checkboxes are enabled I found that the added code was slowing the UDF when new branches were being filled and if I actioned a Ctrl-"Return" refresh immediately there was a possibility of the button event happening after a short delay, with the result that the Ctrl key was no longer pressed at that point - and so the UDF assumed that I wanted to "Return" and promptly did so! M23
    1 point
  25. Deye, Have a play with this Beta and see what you think: A quick example script - either press the "Return" button with Ctrl pressed or use the HotKey to refresh the drives available: As I anticipated, you will lose any previously selected items, which I feel is reasonable as you could be refreshing the tree and now no longer have access to certain drives. Let me know what you think - and comments from others are always welcome too. M23
    1 point
  26. Melba, I think that will just be good enough for what I need As you already suggested it may not be all possible to keep the list intact while adding - removing Root folders .. at least Not by a quick fix (for now.. ) Thanks
    1 point
  27. m00, Thanks. I think I have it working now but I will look at your changes with interest. Glad you got what you wanted as an interim - I will try and give you a more polished UDF in a while. M23
    1 point
  28. Thank you. I am now trying to show only folders (with their parents) that contain .jpg files. Also, I would like folders that contain .jpg files to be emphasized: preferably in color, or bolded. Is this possible with ChooseFileFolder? Here is my code: _CFF_Choose('Jpeg dirs on H: drive',Default,Default,Default,Default,'h:','*.jpg||$RECYCLE.BIN',2) Your expand when needed makes a big difference!
    1 point
  29. c.haslam, Just use the Exclude_Folders section of the $sMask parameter - something like this: $sRet = _CFF_Choose("Select a file", 300, 500, Default, Default, "M:\", "*.*||$RECYCLE.BIN") This is explained in the _CFF_Choose function header. There are always worth a read when the UDF author has gone to the trouble to write them! M23
    1 point
  30. NEW VERSION 16 Feb 17 New: When using checkboxes and only files are to be returned, only files will display checkboxes. However, if any item is prechecked all items will display checkboxes to indicate the full path - but as before checked folders will only be returned if the UDF has been instructed to do so (+ 16 added to the $iDisplay parameter). New UDF and examples in first post. M23
    1 point
  31. Apzo

    SQLite3 on WIndows 10

    This one worked for me: http://www.sqlite.org/2016/sqlite-dll-win32-x86-3110100.zip should be the good one. Regards, Apzo.
    1 point
  32. Sorry, forgot to mention that I found that GUICtrlCreateTreeView was causing problem while trying to make something similar to example 8 of ChooseFileFolder, I dont know if GUICtrlCreateTreeView is reason of my problems with ChooseFileFolder. This works for me: ; www.autoitscript.com/forum/topic/183381-delayed-guictrltreeview-get-index/ ; www.autoitscript.com/forum/topic/100583-treeview-expand-event/ ; www.autoitscript.com/forum/topic/111457-selective-folders-selection/ ; www.autoitscript.com/forum/topic/80327-filebrowser-with-treeview/ ; www.autoitscript.com/forum/topic/144469-solved-dynamic-directory-treeview/ #NoTrayIcon #RequireAdmin #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #Include <GuiTreeView.au3> #Include <File.au3> Opt("WinWaitDelay", 0) Opt("MouseClickDelay", 0) Opt("MouseClickDownDelay", 0) Opt("MouseClickDragDelay", 0) Opt("SendKeyDelay", 0) Opt("SendKeyDownDelay", 0) Opt("WinTitleMatchMode", 3) Opt('GUIOnEventMode', 1) Opt('GUICloseOnEsc' , 1) Global $CheckBoxCount = 0 Global $CheckedItems = '' Global $hGUI = GUICreate("Select files and folders", 530, 400, -1, -1) Global $hTreeView = _GUICtrlTreeView_Create($hGUI, 0, 0, 530, 370, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_CHECKBOXES)) Global $button = GUICtrlCreateButton("Show checked", 0, 370, 90, 30, $SS_Center) GUISetBkColor(0xCECECE) GUICtrlSetOnEvent($button, '_Checked') GUISetOnEvent($GUI_EVENT_CLOSE, '_AllExit') $hImage = _GUIImageList_Create(16, 16, 5, 2) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 54) _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW, $hGUI) $aDrives = DriveGetDrive('FIXED') If IsArray($aDrives) Then For $i = 1 To $aDrives[0] If DriveStatus($aDrives[$i]) = 'READY' Then $Root = _GUICtrlTreeView_AddChild($hTreeView, '', StringUpper($aDrives[$i]), 0) _GUICtrlTreeView_SetChildren($hTreeView, $Root, True) EndIf Next EndIf $aDrives = DriveGetDrive('REMOVABLE') If IsArray($aDrives) Then For $i = 1 To $aDrives[0] If DriveStatus($aDrives[$i]) = 'READY' Then $Root = _GUICtrlTreeView_AddChild($hTreeView, '', StringUpper($aDrives[$i]), 0) _GUICtrlTreeView_SetChildren($hTreeView, $Root, True) EndIf Next EndIf While 1 Sleep(1000) WEnd Func _AllExit() GUIDelete($hGUI) Exit EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hTreeView Switch $iCode Case $NM_CLICK $aPos = GUIGetCursorInfo($hGUI) $ObjectClicked = _GUICtrlTreeView_HitTest($hTreeView, $aPos[0], $aPos[1]) $cItem = _GUICtrlTreeView_HitTestItem($hTreeView, $aPos[0], $aPos[1]) If $ObjectClicked = '16' Then If _GUICtrlTreeView_GetExpanded($hTreeView, $cItem) = True Then ControlTreeView($hGUI, "", $hTreeView, "Collapse", $cItem) Else $sSelectedPath = StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $cItem), "|", "\") If _GUICtrlTreeView_GetChildCount($hTreeView, $cItem) <= 0 Then _SearchFolder($cItem, $sSelectedPath) EndIf EndIf ElseIf $ObjectClicked = '64' Then If _GUICtrlTreeView_GetChecked($hTreeView, $cItem) = False Then ; checked $CheckBoxCount = $CheckBoxCount + 1 $sSelectedPath = StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $cItem), "|", "\") If not StringInStr($sSelectedPath, '\') Then $sSelectedPath = $sSelectedPath & '\' $CheckedItems = $CheckedItems & $sSelectedPath & @CRLF Else ; unchecked $CheckBoxCount = $CheckBoxCount - 1 $sSelectedPath = StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $cItem), "|", "\") If not StringInStr($sSelectedPath, '\') Then $sSelectedPath = $sSelectedPath & '\' $CheckedItems = StringReplace($CheckedItems, $sSelectedPath & @CRLF, '') EndIf EndIf Case $NM_DBLCLK $aPos = GUIGetCursorInfo($hGUI) $ObjectClicked = _GUICtrlTreeView_HitTest($hTreeView, $aPos[0], $aPos[1]) $cItem = _GUICtrlTreeView_HitTestItem($hTreeView, $aPos[0], $aPos[1]) If $ObjectClicked = '2' or $ObjectClicked = '4' Then If _GUICtrlTreeView_GetExpanded($hTreeView, $cItem) = True Then ControlTreeView($hGUI, "", $hTreeView, "Collapse", $cItem) Else $sSelectedPath = StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $cItem), "|", "\") If _GUICtrlTreeView_GetChildCount($hTreeView, $cItem) <= 0 Then _SearchFolder($cItem, $sSelectedPath) EndIf EndIf EndIf Case $TVN_SELCHANGINGA, $TVN_SELCHANGINGW Return 1 Case $NM_SETFOCUS Return 1 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _SearchFolder($cParent, $sPath) $aFolderList = _FileListToArray($sPath, "*", $FLTA_FOLDERS) If IsArray($aFolderList) Then For $i = 1 To $aFolderList[0] $hItem = _GUICtrlTreeView_AddChild($hTreeView, $cParent, $aFolderList[$i], 0) _GUICtrlTreeView_SetChildren($hTreeView, $hItem, True) Next EndIf $aFileList = _FileListToArray($sPath, "*", $FLTA_FILES) If IsArray($aFileList) Then For $i = 1 To $aFileList[0] _GUICtrlTreeView_AddChild($hTreeView, $cParent, $aFileList[$i], 1, 1) Next EndIf If _GUICtrlTreeView_GetChildCount($hTreeView, $cParent) <= 0 Then _GUICtrlTreeView_SetChildren($hTreeView, $cParent, False) EndIf EndFunc Func _Checked() If $CheckBoxCount = '0' Then MsgBox(0, '', 'Nothing checked.') Return Else $FileList = '' $FolderList = '' $BurnList = StringSplit($CheckedItems, @LF) For $i = 1 to $BurnList[0] - 1 $path = StringStripCR($BurnList[$i]) If StringInStr(FileGetAttrib($path), "D") = 0 Then ; File $FileList = $FileList & $path & @CRLF Else ; Folder $FolderList = $FolderList & $path & @CRLF EndIf Next If $FileList <> '' Then MsgBox(0,'Checked files',$FileList) If $FolderList <> '' Then MsgBox(0,'Checked folders',$FolderList) EndIf EndFunc Treeview Explorer.au3
    1 point
  33. Nikolas92, Good to hear - but it should not make a difference so I will still take a look once at the code once I get a moment to myself after our houseguests have gone. M23
    1 point
  34. I tested it with example 8 from Example File 1 on windows 10 enterprise x64 (default settings). I compiled script for 64 bit. #NoTrayIcon #RequireAdmin #include "ChooseFileFolder.au3" Local $sRet, $aRet ; Register handlers $sRet = _CFF_RegMsg() If Not $sRet Then MsgBox(16, "Failure!", "Handler not registered") Exit EndIf ; Choose multiple files/folders using checkboxes - all checked items returned $sRet = _CFF_Choose("Ex 8 - Multiple checkboxes", 300, 500, -1, -1, "", Default, 0 + 16, -1) If $sRet Then $aRet = StringSplit($sRet, "|") $sRet = "" For $i = 1 To $aRet[0] $sRet &= $aRet[$i] & @CRLF Next MsgBox(0, "Ex 8 - Multiple checkboxes", "Selected:" & @CRLF & @CRLF & $sRet) Else MsgBox(0, "Ex 8", "No Selection") EndIf
    1 point
  35. Hi, Thanks it's just what i'm looking for !! I added some details in it : - Press "Enter" to close the editbox - Editbox follow the listview when you change its position. #include <GuiConstants.au3> #include <GuiEdit.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPI.au3> Opt("GuiCloseOnESC", 0) Global $hEdit, $hDC, $hBrush, $Item = -1, $SubItem = 0 Global $Style = BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT) $hGUI = GUICreate("ListView Subitems edit in place", 370, 280) $hNM_DBCLK = GUICtrlCreateDummy() $hEN_KILLFOCUS = GUICtrlCreateDummy() $hListView = _GUICtrlListView_Create($hGUI, "test1|test2", 32, 35, 300, 214) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_AUTOARRANGE,$LVS_EX_FULLROWSELECT,$LVS_EX_DOUBLEBUFFER,$LVS_EX_SUBITEMIMAGES)) For $i = 1 To 10 _GUICtrlListView_AddItem($hListView, "Item " & $i) _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 1) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit case $hNM_DBCLK Start_EditingLV() Case $hEN_KILLFOCUS End_EditingLV() EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_DBLCLK GUICtrlSendToDummy($hNM_DBCLK) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush) Local $stRect = DllStructCreate("int;int;int;int") DllStructSetData($stRect, 1, $nLeft) DllStructSetData($stRect, 2, $nTop) DllStructSetData($stRect, 3, $nRight) DllStructSetData($stRect, 4, $nBottom) DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush) EndFunc Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $iCode = BitShift($wParam, 16) Switch $lParam Case $hEdit Switch $iCode Case $EN_KILLFOCUS GUICtrlSendToDummy($hEN_KILLFOCUS) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func Start_EditingLV() ControlDisable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($hListView))) Local $aHit = _GUICtrlListView_SubItemHitTest($hListView) Local $hRect = ControlGetPos($hGUI, "", $hListView) If ($aHit[0] <> -1) And ($aHit[1] = 0) Then $Item = $aHit[0] $SubItem = 0 Local $aRect = _GUICtrlListView_GetItemRect($hListView, $Item) ElseIf ($aHit[0] <> -1) And ($aHit[1] > 0) Then $Item = $aHit[0] $SubItem = $aHit[1] Local $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem) Else Return $GUI_RUNDEFMSG EndIf Local $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem) Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText) $hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $aRect[0] + ($hRect[0] + 3), $aRect[1] + $hRect[1], $iLen + 10, 17, $Style) _GUICtrlEdit_SetSel($hEdit, 0, -1) _WinAPI_SetFocus($hEdit) $hDC = _WinAPI_GetWindowDC($hEdit) $hBrush = _WinAPI_CreateSolidBrush(0x0000FF) FrameRect($hDC, 0,0, $iLen + 10 , 17, $hBrush) HotKeySet("{ENTER}", "End_EditingLV") EndFunc Func End_EditingLV() Local $iText = _GUICtrlEdit_GetText($hEdit) _GUICtrlListView_SetItemText($hListView, $Item, $iText, $SubItem) _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC($hEdit, $hDC) _WinAPI_DestroyWindow($hEdit) ControlEnable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($hListView))) $Item = -1 $SubItem = 0 HotKeySet("{ENTER}") EndFunc I know this post is old but maybe this can help anyone.
    1 point
  36. Ascend4nt and Yashied, Thank you both for your efforts. I mentioned a tutorial on this x64 compatability problem to enlighten hobbyist coders like me the last time it came up - I suppose both of you are still not interested in writing one? New UDF and example in the first post. M23
    1 point
  37. I think MSDN is correct, NMHDR structure looks like this. $tagNMHDR = "hwnd hWndFrom;uint_ptr IDFrom;int Code" But the following structures that includes NMHDR must be aligned to sizeof(ptr). For example ; x64 $tagNMHEADER = $tagNMHDR & ";byte Alignment[4];int Item;int Button;ptr pItem" ; x86 $tagNMHEADER = $tagNMHDR & ";int Item;int Button;ptr pItem"
    1 point
  38. Yes of course, I wanted to say a double word.
    1 point
  39. 'INT' is 4 bytes. NMHDR changed in x64 so that the last item is 8 bytes (int_ptr), and apparently without notifying anyone. The MSDN info is wrong. The 'Spec' item was Melba's addition, I just kept it in there in case that was what he was going to use someday if it points to a larger struct. Ahh, and the @error thing is Melba's idea, not mine - I only left it as it was coded. *edit: for reference, you can look at
    1 point
  40. Another nice UDF Melba. I looked into the x64 stuff.. the only issue I see is the same one as GUIListViewEx had with the NMHDR, and a simple 'Program Files' location change. Here's the 'x64 compatible' change for double-click notifications to work properly in x64 mode: Func _CFF_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tStruct = DllStructCreate("hwnd hWndFrom;uint_ptr IDFrom;int_ptr Code;int Spec", $lParam) If @error Then Return Switch BitAnd(DllStructGetData($tStruct, "Code"),0xFFFFFFFF) Case 0xFFFFFFFD ; $NM_DBLCLK $fCFF_DblClk = DllStructGetData($tStruct, "hWndFrom") EndSwitch EndFunc ;==>_CFF_WM_NOTIFY_Handler And at the top of 'ChooseFileFolder_Ex.au3', you might put this: Local $sProgFiles=@ProgramFilesDir If @AutoItX64 Then $sProgFiles&=' (x86)' ..and then change any occurrences of @ProgramFilesDir to $sProgFiles. This change is due to the fact that AutoIt installs in the x86 Program Files folder ('C:\Program Files (x86)") on 64-bit O/S's. In x86 mode, that's where it looks by default, but not in x64 mode. This will give your example the ability to run the same in both bit modes. *edit: oops, meant 'double' click
    1 point
  41. I tested on x64 and it worked, but then I have a single drive with multiple partitions.
    1 point
  42. UEZ, Interesting. With some help from Yashied I thought the GUIFrame UDF was x64 compatible. - see here and the next few posts. M23
    1 point
  43. I'm starting ChooseFileFolder_Ex.au3. Ex 1: seems to be ok -> I can see the tree Ex 2: seems to be ok -> I can see the tree Ex 3: seems to be ok -> I can see the tree Ex 4: seems not to be ok -> nothing is displayed -> $hTreeView = 0 Ex 5: no tree. I can select a drive and it starting to indexing it Ex 6: no tree. I can select a drive. When I select my C drive the error appears. I've only one local drive - C. -> $hTreeView = 0 Ex 7: files are listed Looks like there is no handle to the treeview. If I find the the bug I will tell you! Br, UEZ
    1 point
  44. I get an error on example 6 when I select my C drive -> Line 419 (File "C:\Coding\AU3\GUI\ChooseFileFolder\ChooseFileFolder.au3"): $hTreeView = GUICtrlCreateTreeView(0, 0, $iW - 20, $aTV_Pos[3]) $hTreeView = GUICtrlCreateTreeView(0, 0, $iW - 20, $aTV_Pos^ ERROR Error: Subscript used with non-Array variable. Btw, nice coding! Br, UEZ
    1 point
  45. Wouldn't expect any less! Purely brilliant, I am sure I will find some use for this UDF.
    1 point
×
×
  • Create New...