Jump to content

Leaderboard

Popular Content

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

  1. I'm trying to automate the connection to a WiFi network through the WPS mechanism so I though I would record the clicks of the process. However, when I run the code, it doesn't do anything...This is my code: #region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=0000040A)  --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '') If $aResult[1] <> '0000040A' Then   MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(0000040A->' & $aResult[1] & ')') EndIf EndFunc Func _WinWaitActivate($title,$text,$timeout=0)     WinWait($title,$text,$timeout)     If Not WinActive($title,$text) Then WinActivate($title,$text)     WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- _WinWaitActivate("classname=Shell_TrayWnd","") MouseClick("left",1143,12,1) _WinWaitActivate("Network Connections","") MouseClick("left",130,273,1) MouseUp("left") _WinWaitActivate("classname=Shell_TrayWnd","") MouseClick("left",1143,19,1) #endregion --- Au3Recorder generated code End --- Not sure if there are specific classes to replace the clicks for something more specific like a built-in function. Otherwise,so you know why the click action is not working? Thanks!
    1 point
  2. MouseClick is not your best strategy to automate something. What exactly are you trying to do ? Probably there is a better solution.
    1 point
  3. 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
  4. It works perfect for me. (I did not test too much. just $hParent stuff) Saludos
    1 point
  5. Hi all, Another Beta version with (I think) all of the recent suggestions incorporated - well, at least the ones I accepted! I would be grateful for any testing and comments: M23
    1 point
  6. MrCreator, Using simple addition when the author has set suitable values for the various constants is not, IMO, "improper coding", but there we can perhaps agree to differ. And having some "magic numbers" in the UDF follows my long established practice of keeping required include files to a minimum, especially when only a few of the values within them are needed. However, I do like your suggestion of naming the various $iDisplay values - thanks for the suggestion. M23
    1 point
  7. Well, i prefer to code properly to avoid as much as possible those simple mistakes, because we have other places in code where things get complicated. BTW, i would use User Constant in the UDF: Global Enum Step *2 _ $CFF_FLDRTREE = 0, $CFF_FLDRTREENOSUBFLDRS = 1, $CFF_FLDRTREENOFILES = 2, $CFF_NOHIDFILES, _ $CFF_NOSYSFILES, $CFF_SELECTABLE, $CFF_DUPSEL, $CFF_NOFILEEXT, $CFF_SCRLTOFRSTFILE, _ $CFF_SHOWSPLASH, $CFF_RETDEEPONLY, $CFF_DRVLSTRFRSH, $CFF_SHOWICONS And also i suggest to use real constants instead of "magic numbers" inside UDF.
    1 point
  8. 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
  9. 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
  10. 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
  11. 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
  12. Deye, You do not need my permission to adapt the UDF code - just go right ahead! But I suggest you post any modified code in your own thread and leave this one to my original. I might well pinch some of your changes though! M23
    1 point
  13. Hi Melba, I'm planning on giving this another go, at least till I can make it work with my mods Not that anything is wrong right the way it is now ..for a start, do you think it would be wise to split "_CFF_Choose" from other mods for easier Code implementations\rewrites along the way Or when ever necessary, especially for any user that wants to debug the "_CFF_Choose" part easier \ ly With my current mod I wanted that anything checked as precheck'd right after the GUI is loaded will include also any other newly checks to the final return when "save" is clicked after a refresh was executed at any\some point got really close to getting it done with ideas from the last mod you have posted .. Without concentrating to much (Up for some air till I dive into again) just as an example I use $cRedraw_Dummy case as "refresh", eliminating other $cRedraw_Dummy calls in the script where I couldn't find any use for in my mod And isn't very much different from the original UDF @initial post Edit: will soon be looking for some routine to De-elevate per script, To get any network\mapped drives and re-elevate to get them mapped in ready for any read\write operations Thanks Deye
    1 point
  14. tested, result (ChooseFileFolder_Example_1.au3): this works correctly: Treeview Explorer.au3
    1 point
  15. Hi, As xtcislove has not been back to the forum in 6 months (obviously his problem with the UDF not working under x64 was not as pressing as it appeared) has anyone else tested the above Beta code on a x64 machine and can confirm that it works correctly? Grateful for any replies so I can either release a new version or start debugging again! M23
    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. Thanks for the update, thats what i thought but all my experients did not end well but im maybe 6 months into autoit and just getting started with dllstructs. I will keep an eye on this thread to not miss any updates. Best regards
    1 point
  18. Hi Melba23, not 100% sure if this is the thing .. but it very much looks like it to me try : If DllStructGetData($tStruct, "Action") = 2 Or Not _GUICtrlTreeView_GetText($hWndFrom, _GUICtrlTreeView_GetExpanded($hWndFrom, $hItem)) Then GUICtrlSendToDummy($g_cCFF_Expand_Dummy, $hItem) .. Deye
    1 point
  19. 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
  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. xtcislove, I gave up on that download when it hit 20Mb! Just post the AutoIt code as explained here. M23
    1 point
  22. Okay, that's a bit sad, but understandable. Thanks again for all the great code you've provided. Have a nice weekend Slevin
    1 point
  23. SlevinKT, Welcome to the AutoIt forums. Glad you find my code useful. But I am afraid I am not going to implement icons in this UDF as I believe it would seriously slow the main expansion algorithm. Sorry. M23
    1 point
  24. 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
  25. 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
  26. 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
  27. Hi Melba, It works well, this only needs a small procedure to sustain the state of checks just like what $g_aCFF_PreCheckRetain is for when reloading the function Wasted 2 ours looking at the UDF I tried a few things like ways to remove stale references to $sAddFile_List and Such but soon was getting some hunch that the TreeView may not Or can't be updated in such ways .. .. back with my half baked thoughts .. will try again when i get a moment Thanks again Deye
    1 point
  28. 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
  29. Deye, So basically a _CFF_Refresh function. I think I can see how it might be done, but you would almost certainly lose all previously selected items - would that be a problem? M23
    1 point
  30. Hi Melba, I'm looking for a way to be able to update the "choose list" on the fly at my own trigger That will act as a refresh to the list for any drive letters (newly available) or removed, (redrawn back to the GUI) Without needing to close\restart the _CFF_Choose() function I tried a few things without a desired outcome .. Maybe you can devise something for this if not too busy Thanks Deye
    1 point
  31. m00, Sorry it took so long - a serious family illness and a new grandson got in the way! Here is a new Beta of the UDF with the freezing _Embed bug fixed and a rather better-working ability to select both folders and files when required. There is a small change in both _Choose and _Embed functions - $iDisplay option 3 has been removed as the new logic means that is was identical to option 2. The new options work as follows: Option Display Selectable Action when folder double-clicked 0 Folders and files Files only Folder expands/contracts 1 Files only Files only N/A 2 Folders only Folders only Selects folder +16 Folders and files Folders and files Selects folder only when using option 0 There is also one small change for consistency: pressing the {ENTER} key when in single selection mode now selects the highlighted (highlit?) item in both _Choose and _Embed - it did not do so in _Choose before. Please test it and let me know if you like it - and of course anyone else is free to test and comment as well. M23
    1 point
  32. 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
  33. 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
  34. 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
  35. solved my problem, GUICtrlCreateTreeView was causing it. if _GUICtrlTreeView_Create is used instead then it works correctly.
    1 point
  36. 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
  37. nobbitry, Thanks for that. Nikolas92, Can you let me see the line you used to call the UDF - perhaps you made a small syntax error resulting in the limited dispay. M23
    1 point
  38. 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
  39. 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
  40. 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
  41. Yes, you are right, this is an alignments problem under x64 (). But the Melba23's problem in this case in the following. "int IDFrom" instead of "uint_ptr IDFrom". Thanks for the links.
    1 point
  42. '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
  43. 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
  44. guinness, Thanks for that. I have no other reports of the GUIFrames UDF not being x64 compatible after Yashied helped me fix it. The size of drive has nothing to do with it - it is a simple case of the treeview not being created as a result of GUIFrames failing to create the frame! So as the error is most certainly coming from that UDF (and the fact that UEZ cannot run that UDF on x64) I am wondering what is different with UEZ's machine. M23 Edit: Typnig.
    1 point
  45. I tested on x64 and it worked, but then I have a single drive with multiple partitions.
    1 point
  46. UEZ, It looks like the problem is in the GUIFrame UDF not this one, as you only have a problem when $fSingleSel = False. In that case, the UDF creates a treeview within a frame created by GUIFrame and this is obviously not happening. Have you tried to run the GUIFrame UDF and its examples - if not could you please do do? I wonder if there is a problem with it on x64 systems - it uses many DllCalls so I would not be at all surprised. M23
    1 point
  47. 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
  48. 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
  49. Wouldn't expect any less! Purely brilliant, I am sure I will find some use for this UDF.
    1 point
  50. You need #include <Process.au3> with _RunDos ShutDown(1) But anyway, here's the code: ;If you press the END key, the AntiIdle stops HotKeySet("{END}", "EndAntiIdle") While 1 Run(@ComSpec & " /c @echo hello","", @SW_HIDE) Sleep(600000) WEnd ;Runs the check every 600000 seconds (10 minutes) Func EndAntiIdle() Exit 0 EndFunc
    1 point
×
×
  • Create New...