Bobbins Posted December 30, 2014 Posted December 30, 2014 Hey guys does anyone know how to retrieve this text from Arduino? What I am trying to do is to trigger a popup when Arduino is finished uploading a program. With help from others I tried to find the string but could not find it. #include <Constants.au3> WinWaitActive("[CLASS:SunAwtFrame]") Send("^u") While 3 Local $sText = WinGetText("[CLASS:SunAwtFrame]") Local $iEvaluate = StringInStr ($sText, "Done uploading.", 0) if $iEvaluate > 0 Then WinClose("[CLASS:SunAwtFrame]") MsgBox(0,0,0); just as indicator Exit EndIf WEnd Someone recommended using IUIAutomation MS framework but I still could not find the "Done Uploading" string Also I used the simplespy script to try look for a difference between before upload and after upload but I don't see a difference that I could use to trigger the popup. Before upload: expandcollapse popupMouse position is retrieved 630-339 At least we have an element [Mac_reader | Arduino 1.0.6][SunAwtFrame] Having the following values for all properties: Title is: <Mac_reader | Arduino 1.0.6> Class := <SunAwtFrame> controltype:= <UIA_WindowControlTypeId> ,<50032> , (0000C370) 433;84;500;600 *** Parent Information top down *** 0: Title is: <Desktop> Class := <#32769> controltype:= <UIA_PaneControlTypeId> ,<50033> , (0000C371) 0;0;1366;768 "Title:=Desktop;controltype:=UIA_PaneControlTypeId;class:=#32769" ;~ *** Standard code *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("Mac_reader|Arduino1.0.6.mainwindow","title:=Mac_reader | Arduino 1.0.6;classname:=SunAwtFrame") _UIA_action("Mac_reader|Arduino1.0.6.mainwindow","setfocus") *** Detailed properties of the highlighted element *** UIA_title:= <Mac_reader | Arduino 1.0.6> UIA_text:= <Mac_reader | Arduino 1.0.6> UIA_regexptitle:= <Mac_reader | Arduino 1.0.6> UIA_class:= <SunAwtFrame> UIA_regexpclass:= <SunAwtFrame> UIA_iaccessiblechildId:= <0> UIA_handle:= <329456> UIA_RuntimeId:= <42;329456> UIA_BoundingRectangle:= <433;84;500;600> UIA_ProcessId:= <988> UIA_ControlType:= <50032> UIA_LocalizedControlType:= <window> UIA_Name:= <Mac_reader | Arduino 1.0.6> UIA_HasKeyboardFocus:= <True> UIA_IsKeyboardFocusable:= <True> UIA_IsEnabled:= <True> UIA_ClassName:= <SunAwtFrame> UIA_Culture:= <0> UIA_IsControlElement:= <True> UIA_IsContentElement:= <True> UIA_IsPassword:= <False> UIA_NativeWindowHandle:= <329456> UIA_IsOffscreen:= <False> UIA_Orientation:= <0> UIA_FrameworkId:= <Win32> UIA_IsRequiredForForm:= <False> UIA_IsDockPatternAvailable:= <False> UIA_IsExpandCollapsePatternAvailable:= <False> UIA_IsGridItemPatternAvailable:= <False> UIA_IsGridPatternAvailable:= <False> UIA_IsInvokePatternAvailable:= <False> UIA_IsMultipleViewPatternAvailable:= <False> UIA_IsRangeValuePatternAvailable:= <False> UIA_IsScrollPatternAvailable:= <False> UIA_IsScrollItemPatternAvailable:= <False> UIA_IsSelectionItemPatternAvailable:= <False> UIA_IsSelectionPatternAvailable:= <False> UIA_IsTablePatternAvailable:= <False> UIA_IsTableItemPatternAvailable:= <False> UIA_IsTextPatternAvailable:= <False> UIA_IsTogglePatternAvailable:= <False> UIA_IsTransformPatternAvailable:= <True> UIA_IsValuePatternAvailable:= <False> UIA_IsWindowPatternAvailable:= <True> UIA_ValueIsReadOnly:= <True> UIA_RangeValueValue:= <0> UIA_RangeValueIsReadOnly:= <True> UIA_RangeValueMinimum:= <0> UIA_RangeValueMaximum:= <0> UIA_RangeValueLargeChange:= <0> UIA_RangeValueSmallChange:= <0> UIA_ScrollHorizontalScrollPercent:= <0> UIA_ScrollHorizontalViewSize:= <100> UIA_ScrollVerticalScrollPercent:= <0> UIA_ScrollVerticalViewSize:= <100> UIA_ScrollHorizontallyScrollable:= <False> UIA_ScrollVerticallyScrollable:= <False> UIA_SelectionCanSelectMultiple:= <False> UIA_SelectionIsSelectionRequired:= <False> UIA_GridRowCount:= <0> UIA_GridColumnCount:= <0> UIA_GridItemRow:= <0> UIA_GridItemColumn:= <0> UIA_GridItemRowSpan:= <1> UIA_GridItemColumnSpan:= <1> UIA_DockDockPosition:= <5> UIA_ExpandCollapseExpandCollapseState:= <3> UIA_MultipleViewCurrentView:= <0> UIA_WindowCanMaximize:= <True> UIA_WindowCanMinimize:= <True> UIA_WindowWindowVisualState:= <0> UIA_WindowWindowInteractionState:= <2> UIA_WindowIsModal:= <False> UIA_WindowIsTopmost:= <False> UIA_SelectionItemIsSelected:= <False> UIA_TableRowOrColumnMajor:= <2> UIA_ToggleToggleState:= <2> UIA_TransformCanMove:= <True> UIA_TransformCanResize:= <True> UIA_TransformCanRotate:= <False> UIA_IsLegacyIAccessiblePatternAvailable:= <True> UIA_LegacyIAccessibleChildId:= <0> UIA_LegacyIAccessibleName:= <Mac_reader | Arduino 1.0.6> UIA_LegacyIAccessibleRole:= <10> UIA_LegacyIAccessibleState:= <1048580> UIA_IsDataValidForForm:= <False> UIA_ProviderDescription:= <[pid:9904,hwnd:0x506F0 Main:Nested [pid:988,hwnd:0x506F0 Annotation(parent link):Microsoft: Annotation Proxy (unmanaged:uiautomationcore.dll); Main:Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]; Nonclient:Microsoft: Non-Client Proxy (unmanaged:uiautomationcore.dll); Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]> UIA_IsItemContainerPatternAvailable:= <False> UIA_IsVirtualizedItemPatternAvailable:= <False> UIA_IsSynchronizedInputPatternAvailable:= <False> After upload: expandcollapse popupMouse position is retrieved 605-403 At least we have an element [Mac_reader | Arduino 1.0.6][SunAwtFrame] Having the following values for all properties: Title is: <Mac_reader | Arduino 1.0.6> Class := <SunAwtFrame> controltype:= <UIA_WindowControlTypeId> ,<50032> , (0000C370) 433;84;500;600 *** Parent Information top down *** 0: Title is: <Desktop> Class := <#32769> controltype:= <UIA_PaneControlTypeId> ,<50033> , (0000C371) 0;0;1366;768 "Title:=Desktop;controltype:=UIA_PaneControlTypeId;class:=#32769" ;~ *** Standard code *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("Mac_reader|Arduino1.0.6.mainwindow","title:=Mac_reader | Arduino 1.0.6;classname:=SunAwtFrame") _UIA_action("Mac_reader|Arduino1.0.6.mainwindow","setfocus") *** Detailed properties of the highlighted element *** UIA_title:= <Mac_reader | Arduino 1.0.6> UIA_text:= <Mac_reader | Arduino 1.0.6> UIA_regexptitle:= <Mac_reader | Arduino 1.0.6> UIA_class:= <SunAwtFrame> UIA_regexpclass:= <SunAwtFrame> UIA_iaccessiblechildId:= <0> UIA_handle:= <329456> UIA_RuntimeId:= <42;329456> UIA_BoundingRectangle:= <433;84;500;600> UIA_ProcessId:= <988> UIA_ControlType:= <50032> UIA_LocalizedControlType:= <window> UIA_Name:= <Mac_reader | Arduino 1.0.6> UIA_HasKeyboardFocus:= <True> UIA_IsKeyboardFocusable:= <True> UIA_IsEnabled:= <True> UIA_ClassName:= <SunAwtFrame> UIA_Culture:= <0> UIA_IsControlElement:= <True> UIA_IsContentElement:= <True> UIA_IsPassword:= <False> UIA_NativeWindowHandle:= <329456> UIA_IsOffscreen:= <False> UIA_Orientation:= <0> UIA_FrameworkId:= <Win32> UIA_IsRequiredForForm:= <False> UIA_IsDockPatternAvailable:= <False> UIA_IsExpandCollapsePatternAvailable:= <False> UIA_IsGridItemPatternAvailable:= <False> UIA_IsGridPatternAvailable:= <False> UIA_IsInvokePatternAvailable:= <False> UIA_IsMultipleViewPatternAvailable:= <False> UIA_IsRangeValuePatternAvailable:= <False> UIA_IsScrollPatternAvailable:= <False> UIA_IsScrollItemPatternAvailable:= <False> UIA_IsSelectionItemPatternAvailable:= <False> UIA_IsSelectionPatternAvailable:= <False> UIA_IsTablePatternAvailable:= <False> UIA_IsTableItemPatternAvailable:= <False> UIA_IsTextPatternAvailable:= <False> UIA_IsTogglePatternAvailable:= <False> UIA_IsTransformPatternAvailable:= <True> UIA_IsValuePatternAvailable:= <False> UIA_IsWindowPatternAvailable:= <True> UIA_ValueIsReadOnly:= <True> UIA_RangeValueValue:= <0> UIA_RangeValueIsReadOnly:= <True> UIA_RangeValueMinimum:= <0> UIA_RangeValueMaximum:= <0> UIA_RangeValueLargeChange:= <0> UIA_RangeValueSmallChange:= <0> UIA_ScrollHorizontalScrollPercent:= <0> UIA_ScrollHorizontalViewSize:= <100> UIA_ScrollVerticalScrollPercent:= <0> UIA_ScrollVerticalViewSize:= <100> UIA_ScrollHorizontallyScrollable:= <False> UIA_ScrollVerticallyScrollable:= <False> UIA_SelectionCanSelectMultiple:= <False> UIA_SelectionIsSelectionRequired:= <False> UIA_GridRowCount:= <0> UIA_GridColumnCount:= <0> UIA_GridItemRow:= <0> UIA_GridItemColumn:= <0> UIA_GridItemRowSpan:= <1> UIA_GridItemColumnSpan:= <1> UIA_DockDockPosition:= <5> UIA_ExpandCollapseExpandCollapseState:= <3> UIA_MultipleViewCurrentView:= <0> UIA_WindowCanMaximize:= <True> UIA_WindowCanMinimize:= <True> UIA_WindowWindowVisualState:= <0> UIA_WindowWindowInteractionState:= <2> UIA_WindowIsModal:= <False> UIA_WindowIsTopmost:= <False> UIA_SelectionItemIsSelected:= <False> UIA_TableRowOrColumnMajor:= <2> UIA_ToggleToggleState:= <2> UIA_TransformCanMove:= <True> UIA_TransformCanResize:= <True> UIA_TransformCanRotate:= <False> UIA_IsLegacyIAccessiblePatternAvailable:= <True> UIA_LegacyIAccessibleChildId:= <0> UIA_LegacyIAccessibleName:= <Mac_reader | Arduino 1.0.6> UIA_LegacyIAccessibleRole:= <10> UIA_LegacyIAccessibleState:= <1048580> UIA_IsDataValidForForm:= <False> UIA_ProviderDescription:= <[pid:9904,hwnd:0x506F0 Main:Nested [pid:988,hwnd:0x506F0 Annotation(parent link):Microsoft: Annotation Proxy (unmanaged:uiautomationcore.dll); Main:Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]; Nonclient:Microsoft: Non-Client Proxy (unmanaged:uiautomationcore.dll); Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]> UIA_IsItemContainerPatternAvailable:= <False> UIA_IsVirtualizedItemPatternAvailable:= <False> UIA_IsSynchronizedInputPatternAvailable:= <False> Could someone please suggest a way to identify when it's done uploading? Thanks in advance.
Jfish Posted December 30, 2014 Posted December 30, 2014 I think that is because the Spy can only see the Frame - not anything inside of it. You should have seen a red box around the Arduino Sketch when you ran the spy. The red box is what you are "spying". I did the same on my PC and did not see any controls within the frame. Have you considered trying to hook the event from within the sketch code? I am not an Arduino expert but something like this: boolean success = sketch.exportApplet(false); if (success) { statusNotice(_("Done uploading.")); } else { // error message will already be visible } That way the code you are running can tell you if it is complete. If you need it to interact with another app you could consider using UDP to send the completion code. Just a thought. Others may have better ideas. @Junkew and others could probably figure out how to find the controls within the frame ... Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now