Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/17/2015 in all areas

  1. The screendump from Inspect.exe shows that it can see the lists, but it can't see the list items. I'm afraid it's not possible to automate the listbox with UIA. In your first post, it appears that you can select items with down arrow and click, but it's not possible to know which item is the right one. With the ScreenCapture UDF you can create a screendump of the listbox. Then you can use text recognition (google: ocr text recognition site:autoitscript.com) to identify the right item in the screendump. With this information you can position the mouse on top of the proper item. Methods like this seems to be the only way to automate the listbox. If you have any questions related to text recognition, the best you can do is probably to create a new thread with "text recognition" or similar in the header. In that way you'll get the attention by people who knows something about this subject. My knowledge of the subject is very limited
    2 points
  2. Valuater

    MSGBOX HELP!

    By Melba... ... Just a little slow, Melba got here first 8)
    1 point
  3. Melba23

    MSGBOX HELP!

    JuanFelipe, Look at my ExtMsgBox UDF - the link is in my sig below. M23
    1 point
  4. Newb, But from the point of view of the interpreter there most certainly is - it expects the next line after a continuation character to be the next part of the string. You have one and it is not. M23
    1 point
  5. Though the help file doesn't explicitly say it, Melba's demonstration is a good explanation of why breaking the multiline with a comment won't work. However the help file does show how to, "combine underscore and semicolon to put comments on lines and still have a long statement span on next line." (also demonstrated by Melba).
    1 point
  6. you may want to look at this: http://www8.hp.com/us/en/solutions/business-solutions/printingsolutions/wja.html I used to be a certified HP trainer. This will do what you need.
    1 point
  7. topten, Put the items into an array and use _ArrayShuffle: #include <Array.au3> Global $aArray_Base[5] = ["Black", "Blue", "Red", "Brown", "Yellow"] While 1 $aArray = $aArray_Base _ArrayShuffle($aArray) _ArrayDisplay($aArray, "Shuffled", Default, 8) WEndM23
    1 point
  8. GTK+ Framework | Widgets I'm doing experiment to use GTK+ Widgets on AutoIt3 and seems it sucessfull. Its cause some user on AutoIt3 forum requesting it. Well there are I'm using V2 of GTK+ which you can get binary file at http://www.gtk.org x32 http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip x64 http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip Don't get too happy. Because this far from complete. As for V3. Maybe I will release if V2 have been completed. Hah, its anonnying when get failed on implementing some function! So as far my work only go to: gtk2.zip (link fixed) or gtk2.zip There sample file how to use it. Oh yeah copy AutoIt3 Script to 'bin' folder of package you download from gtk.org If you interesting to join this project, please let me know. PM or E-Mail me. Thanks Screenshots .. .. ..
    1 point
  9. Could you at least show me something? Are you following the guidelines for when developing a UDF/build script? Have you integrated into the latest build script? Have you tested by building the help file yourself? Are you sure that feature will add value to the help file?
    1 point
  10. Just use @‌Extended after _IETagNameGetCollection() #include <IE.au3> #include <MsgBoxConstants.au3> #include <Date.au3> $oIE1 = _IECreate("http://sneerz.com") $hwnd1 = _IEPropertyGet($oIE1, "hwnd") $oLinks = _IETagNameGetCollection($oIE1, "a") $tags = @extended MsgBox(262144, Default, $tags & " A-Tags found", 0) For $oLink In $oLinks $class_value = $oLink.GetAttribute("class") If String($class_value) = " active" Then MsgBox(0, "", "Found element: " & $oLink.innerText) EndIf Next MsgBox(64 + 262144, Default, "Exit", 0)
    1 point
  11. You have to add something like Local $hWindow = WinGetHandle( "Setlib" )in top of both code chunks. It's very late at my location (Denmark) now. I'll take a closer look at the new information tomorrow. Regards Lars.
    1 point
  12. wakillon

    ImageRasterizer

    A little example of Image processing where pixel blocks are replaced by forms of your choice. Don't know if title is really appropriate... Try it and tell me. Downloads available in the download section Use big images (> 1000px) for a better rendering! Example :
    1 point
  13. When you use $UIA_NamePropertyId to search for an item, the text value ("RLS 424 - SERIES") must be an exact match. Not a substring. I can't see the name property in the output from the Spy tool. I guess you have erased it. To verify more specific whether the listbox can be automated with UI Automation or not, you can use Inspect.exe (MicroSoft tool to inspect UI Automation elements) in Windows SDK. If Inspect.exe can't identify the listbox items and subitems, you can't automate the listbox with UI Automation. This code will print information about all list elements that it can see: #include "CUIAutomation2.au3" Opt( "MustDeclareVars", 1 ) MainFunc() Func MainFunc() ; Windows Explorer on Windows XP, Vista, 7, 8 Local $hWindow = WinGetHandle( "[REGEXPCLASS:^(Cabinet|Explore)WClass$]" ) If Not $hWindow Then Return ConsoleWrite( "Window handle ERR" & @CRLF ) ConsoleWrite( "Window handle OK" & @CRLF ) ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "UI Automation object ERR" & @CRLF ) ConsoleWrite( "UI Automation object OK" & @CRLF ) ; Get UI Automation element from window handle Local $pWindow, $oWindow $oUIAutomation.ElementFromHandle( $hWindow, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "Automation element from window ERR" & @CRLF ) ConsoleWrite( "Automation element from window OK" & @CRLF ) ; Condition to find list items Local $pCondition $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ListItemControlTypeId, $pCondition ) If Not $pCondition Then Return ConsoleWrite( "Property condition ERR" & @CRLF ) ConsoleWrite( "Property condition OK" & @CRLF ) ; Find list items Local $pUIElementArray, $oUIElementArray, $iElements $oWindow.FindAll( $TreeScope_Descendants, $pCondition, $pUIElementArray ) $oUIElementArray = ObjCreateInterface( $pUIElementArray, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray ) $oUIElementArray.Length( $iElements ) If Not $iElements Then Return ConsoleWrite( "Find list items ERR" & @CRLF ) ConsoleWrite( "Find list items OK" & @CRLF ) ; Print list item info Local $pUIElement, $oUIElement For $i = 0 To $iElements - 1 ConsoleWrite( @CRLF ) $oUIElementArray.GetElement( $i, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) ConsoleWrite( "Name = " & GetCurrentPropertyValue( $oUIElement, $UIA_NamePropertyId ) & @CRLF & _ "Class = " & GetCurrentPropertyValue( $oUIElement, $UIA_ClassNamePropertyId ) & @CRLF & _ "Ctrl type = " & GetCurrentPropertyValue( $oUIElement, $UIA_ControlTypePropertyId ) & @CRLF & _ "Ctrl name = " & GetCurrentPropertyValue( $oUIElement, $UIA_LocalizedControlTypePropertyId ) & @CRLF & _ "Value = " & GetCurrentPropertyValue( $oUIElement, $UIA_LegacyIAccessibleValuePropertyId ) & @CRLF & _ "Handle = " & Hex( GetCurrentPropertyValue( $oUIElement, $UIA_NativeWindowHandlePropertyId ) ) & @CRLF ) Next EndFunc Func GetCurrentPropertyValue( $obj, $id ) Local $tVal $obj.GetCurrentPropertyValue( $id, $tVal ) If Not IsArray( $tVal ) Then Return $tVal Local $tStr = $tVal[0] For $i = 1 To UBound( $tVal ) - 1 $tStr &= "; " & $tVal[$i] Next Return $tStr EndFunc This code will print information about all UI Automation elements that it can see in the entire window: #include "CUIAutomation2.au3" Opt( "MustDeclareVars", 1 ) Global $oUIAutomation MainFunc() ; List all automation elements of a window ; in a hierarchical structure like a treeview. Func MainFunc() ; Get window handle ;Local $hWindow = 0x0006045C ; Infragistics ;Local $hWindow = WinGetHandle( "[CLASS:WindowsForms10.Window.8.app.0.bb8560_r19_ad1]" ) ; Infragistics ;Local $hWindow = WinGetHandle( "[REGEXPCLASS:WindowsForms10.Window.8.app.*]" ) ; Windows Updates Downloader ;Local $hWindow = WinGetHandle( "BCGPVisualStudioGUIDemo - Start Page" ) ; BCGSoft BCGPVisualStudioGUIDemo ;Local $hWindow = WinGetHandle( "[CLASS:CabinetWClass]" ) ; Windows Explorer, Windows 7 ;Local $hWindow = WinGetHandle( "[CLASS:ExploreWClass]" ) ; Windows Explorer, Windows XP ;Local $hWindow = WinGetHandle( "Windows Explorer right pane" ) ; Windows Explorer right pane ;Local $hWindow = WinGetHandle( "[TITLE:My GUI Checkbox; CLASS:AutoIt v3 GUI]" ) ; AutoIt GUI window ;Local $hWindow = WinGetHandle( "[CLASS:AutoIt v3 GUI]" ) ; AutoIt script ;Local $hWindow = WinGetHandle( "[CLASS:Chrome_WidgetWin_1]" ) ; Chrome ;Local $hWindow = WinGetHandle( "[CLASS:IEFrame]" ) ; Internet Explorer Local $hWindow = WinGetHandle( "Calculator" ) ; Calculator If Not $hWindow Then Return ConsoleWrite( "Window handle ERR" & @CRLF ) ConsoleWrite( "Window handle OK" & @CRLF ) ; Create UI Automation object $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "UI Automation object ERR" & @CRLF ) ConsoleWrite( "UI Automation object OK" & @CRLF ) ; Get UI Automation element from window handle Local $pWindow, $oWindow $oUIAutomation.ElementFromHandle( $hWindow, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "Automation element from window ERR" & @CRLF ) ConsoleWrite( "Automation element from window OK" & @CRLF & @CRLF ) ; List all elements of window ListDescendants( $oWindow, 0, 0 ) EndFunc ; List all child elements of parent Func ListDescendants( $oParent, $iLevel, $iLevels = 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, $dtagIUIAutomationTreeWalker ) If Not IsObj( $oRawViewWalker ) Then Return ConsoleWrite( "RawViewWalker object error" & @CRLF ) ; Get first child element Local $pUIElement, $oUIElement $oRawViewWalker.GetFirstChildElement( $oParent, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) Local $sIndent = "" For $i = 0 To $iLevel - 1 $sIndent &= " " Next While IsObj( $oUIElement ) ConsoleWrite( $sIndent & "Name = " & GetCurrentPropertyValue( $oUIElement, $UIA_NamePropertyId ) & @CRLF & _ $sIndent & "Class = " & GetCurrentPropertyValue( $oUIElement, $UIA_ClassNamePropertyId ) & @CRLF & _ $sIndent & "Ctrl type = " & GetCurrentPropertyValue( $oUIElement, $UIA_ControlTypePropertyId ) & @CRLF & _ $sIndent & "Ctrl name = " & GetCurrentPropertyValue( $oUIElement, $UIA_LocalizedControlTypePropertyId ) & @CRLF & _ $sIndent & "Value = " & GetCurrentPropertyValue( $oUIElement, $UIA_LegacyIAccessibleValuePropertyId ) & @CRLF & _ $sIndent & "Handle = " & Hex( GetCurrentPropertyValue( $oUIElement, $UIA_NativeWindowHandlePropertyId ) ) & @CRLF & @CRLF ) ListDescendants( $oUIElement, $iLevel + 1, $iLevels ) $oRawViewWalker.GetNextSiblingElement( $oUIElement, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) WEnd EndFunc Func GetCurrentPropertyValue( $obj, $id ) Local $tVal $obj.GetCurrentPropertyValue( $id, $tVal ) If Not IsArray( $tVal ) Then Return $tVal Local $tStr = $tVal[0] For $i = 1 To UBound( $tVal ) - 1 $tStr &= "; " & $tVal[$i] Next Return $tStr EndFuncI do not think there are other automation tools that you can use. If UI Automation does not work, the only option seems to be text recognition to identify the item in the list.
    1 point
  14. You can try to replace this line If StringInStr( $sName, "LISTBOX" ) Thenwith this line If StringInStr( $sName, "LSLISTLIST" ) Thenin the code above. According to the output from the Spy tool the immediate parent of the list item seems to be a LSLISTLIST class listbox.
    1 point
  15. Welcome to the forum. Did you try this: ?? This is the only possible solution that comes to my mind. But this is only a guess - you must try to chceck. mLipok
    1 point
  16. jchd

    Data records with Array

    The main points remains that the OP asked for an AutoIt construct similar in essential properties to the Pascal record and this does have an answer: DllStruct are just doing that, keeping in mind that they are an equivalent to C structs but not to C typedefed structs. What DllStructs are not suitable for is when one expects to use them for, say, masquerading the inner layout of objects or similar acrobatic tricks. This is the kind of sideways use that I believe Valik and Jon had in mind. That or doing tricks with the stack or even more dangerous misuse. Agreed, AutoIt isn't the language of choice to rewrite Stuxnet. I'd like to see a rebutal to the fact that they can be used (and are used today) to pass data to _WinAPI_WriteFile and from _WinAPI_ReadFile as an opaque binary container (address and size). This is all the OP wanted and I see no reason why such legitimate use should be discouraged. Yet again I must warn against the fact that, contrary to Pascal records, assigning an existing DllStruct to another variable doesn't create a distinct copy of the DllStruct, but a clone of the original struct based at the same address. Local $tBuf = DllStructCreate('dword') DllStructSetData($tBuf, 1, 1234) ConsoleWrite(DllStructGetData($tBuf, 1) & @LF) Local $tBufCopy = $tBuf DllStructSetData($tBuf, 1, 5678) ConsoleWrite(DllStructGetData($tBufCopy, 1) & @LF)
    1 point
  17. RTFC

    Data records with Array

    @jchd: thanks. I was sort of hoping/expecting you'd see it that way too. But I think Melba's point in removing my post was more specifically aimed at the example script I posted, which could be/was apparently construed as subverting the proper AutoIt way of defining a single struct in a stand-alone variable for Dll parsing, and thereby (inadvertently) advertising a type of usage that the devs would rather discourage. Your broader definition certainly fits my own coding style, though. But I don't know enough about AutoIt's internal workings to be able to judge whether the devs' concerns are legitimate here. Let's just leave it at that. After all, I was only trying to help the OP, and such a fundamental, universal data container as a struct seemed a more obvious suggestion (to me) than a beta feature.
    1 point
  18. jchd

    Data records with Array

    If DllStruct stop working the way they work today there will be more than unexpected behaviors. For instance would _WinAPI_WriteFile stop working when it's passed a DllStruct, which is readily used in some standard includes and Wrapper, to say the least? That is exactly what the OP could be using DllStruct for. Also would the large number of DllStructs used in other WinAPI calls stop working? For me DllStructs are containers which can hold data under a strict format definable by users with well documented basic types. Maybe both Valik and Jon feared completely different [mis]uses, but certainly not this one.
    1 point
  19. RTFC

    Data records with Array

    @M23:Sorry, I was unaware of this discussion and that the approach I suggested was frowned upon. However, using structs themselves as containers for multiple fields of different type is documented, and they offer quick access to individual members. I personally use them in various languages for storing associated bits of data; I wasn't aware I was falling foul of canonical use of AutoIt in this.
    1 point
  20. @232showtime : generally, you can just enter the full file name in the File name control and press OK. Use AutoIt Window Info tool to find infos for the file name control and for the Open button, then use ControlSetText and ControlClick. For example : $hOpen = WinGetHandle("Open") ControlSetText($hOpen, "", "[CLASS:Edit; INSTANCE:1]", "c:\path\of\the\file.pdf") ControlClick($hOpen, "", "[CLASS:Button; INSTANCE:2]")
    1 point
  21. I haven't been able to find a way to send text to this control but you can send your path to the File Name control at get the same effect. It must be the full path including file to work though. Example (win7): Run("notepad") Sleep(700) $hWnd = WinGetHandle("[CLASS:Notepad]") Send("^o") Sleep(1000) ControlSend("Open", "", "[CLASS:Edit; INSTANCE:1]", "C:\Downloads\test.txt") Send("{ENTER}")
    1 point
  22. 232showtime, While not a direct solution to your problem, my ChooseFileFolder UDF is a bit more user-friendly and allows you to set the start path for the folder tree very easily. Why not take a look - the link is in my sig. M23
    1 point
  23. In your start menu under AutoIt v3 is a tool called AutoIt Window Info and it will give you the name of the window and info on the control you are trying to automate. To open a file I usually take the Edit Control (File Name area)and add a pathname or filename and send an enter. If you want to display a specific directory then [ControlSend] sending the edit (file name area) a string of "c:\" & @cr will set the displayed directory to c:\
    1 point
  24. Yashied

    HotKeyInput UDF

    LAST VERSION - 1.3 28-Oct-11 The library allows to create HotKey Input control by using the low-level keyboard hook. This UDF is designed specially to support the >HotKey UDF library but it can be used separately. Please look at the example below to understand how it works. For more information, see detailed descriptions of all functions inside the library. Available functions HotKeyInput UDF Library v1.3 Previous downloads: 2564 HotKeyInput.au3 Example #Include <GUIConstantsEx.au3> #Include <HotKeyInput.au3> Global $Form, $HKI1, $HKI2, $Button, $Text $Form = GUICreate('Test', 300, 160) GUISetFont(8.5, 400, 0, 'Tahoma', $Form) $HKI1 = _GUICtrlHKI_Create(0, 56, 55, 230, 20) $HKI2 = _GUICtrlHKI_Create(0, 56, 89, 230, 20) ; Lock CTRL-ALT-DEL for Hotkey Input control, but not for Windows _KeyLock(0x062E) GUICtrlCreateLabel('Hotkey1:', 10, 58, 44, 14) GUICtrlCreateLabel('Hotkey2:', 10, 92, 44, 14) GUICtrlCreateLabel('Click on Input box and hold a combination of keys.' & @CR & 'Press OK to view the code.', 10, 10, 280, 28) $Button = GUICtrlCreateButton('OK', 110, 124, 80, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button $Text = 'Hotkey1: 0x' & StringRight(Hex(_GUICtrlHKI_GetHotKey($HKI1)), 4) & ' (' & GUICtrlRead($HKI1) & ')' & @CR & @CR & _ 'Hotkey2: 0x' & StringRight(Hex(_GUICtrlHKI_GetHotKey($HKI2)), 4) & ' (' & GUICtrlRead($HKI2) & ')' MsgBox(0, 'Code', $Text, 0, $Form) EndSwitch WEnd
    1 point
  25. StringStripWS Feed the result into StringLen
    1 point
  26. Something like this : StringLen (ClipGet() )
    1 point
×
×
  • Create New...