Sign in to follow this  
Followers 0
Kharizmah

IUIAutomation Getting Read-Only Selected Value from Combo Box

32 posts in this topic

#1 ·  Posted (edited)

Disabled WPF Combo Boxes are not selectable and cannot receive focus.

Despite that there is a value there and want to know if there is anyway to access it.

If I use Junkew's simplyspy.au3  both the program and simplespy.au3 will crash the moment I attempt to retrieve this combobox.

If I paste the capture before the crash, Simple Spy doesn't have any data registered for $UIA_SelectionSelectionPropertyId.

         AutoIt Error for simplyspy.au3:

---------------------------
AutoIt Error
---------------------------
Line 210  (File "E:\Program Files (x86)\AutoIt3\Examples\simplespy.au3"):

_UIA_DrawRect($t[1],$t[3]+$t[1],$t[2],$t[4]+$t[2])
_UIA_DrawRect($t[1],^ ERROR

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.
---------------------------
OK   
---------------------------

If I use UI Spy or Inspect I do see a value named "list item" "Flat".

ComboxBox1.thumb.png.84ab66c5e4a4f27ced3

However, if I try:

 $comboBox.GetCurrentPropertyValue("SelectionSelection", $selection)

ConsoleWrite($selection)

Then ComboBox is highlighted but $selection is blank.

Is it imposible to retrieve this value when the comboBox is  disabled?

@junkew @LarsJ

Edited by Kharizmah

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

@junkew I might need clarification on this reply.

I do have administrator rights on the computer I am running the script from.

I tried inserting #requireadmin and looked for RunAs  and I am not seeing anything that would suggest that it needs to run in admin mode.

It works without crashing for all other fields except Read-Only WPF combo boxes.

In output it also has this line:

//TODO codetemplates.txt not available An error occurred when reading the file. & @CRLF

I'm not sure if that matters?

 

Edited by Kharizmah

Share this post


Link to post
Share on other sites

That's what I posted above.  I do see the selected item using Inspect.exe

I'll try one more verification technique to ensure the correct object is being viewed. 

The previous one I tried is insuring the object was of class comboBox. I'll also verify the AutomationID this time and see if it's able to pull the value.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@junkew I cannot get any Selection data from that object.

 

Do you know if that's just the way it is for Disabled UI?

Is there a known way through AutoIt to do something like Snoop and Enable the object for reading and then Disable it later?

Try 2:

 

OutPut:

ComboBox exists!Selection: 

So, it finds this combobox but I can't get Selection.Selection data

Selection_Inspect.thumb.png.10539ec93cef

ComboBox exists!Selection:  Class: ComboBox Automation Id: OptionalEnum

I also tried If IsArray($selection) because apparently the return value is an array.

This also returns blank.  I was wondering if GetCurrentPropertyValue will only returns bools and singular values?

Edited by Kharizmah

Share this post


Link to post
Share on other sites

I can see, that the output in the png-image in first post is from UISpy.exe. You should not use UISpy.exe which is at least 10 years old and does not give any valuable information for newer applications. There is no direct connection between the information you get from UISpy.exe and the way you search for the same information through the UI Automation framework by junkew.

You should investigate the combo box with Inspect.exe. Then you'll probably see that Inspect.exe does not get the value in the combo box directly from the combo box but from an edit box which is a child control of the combo box. A combo box usually consists of an edit box and a list box.

With the information you get from Inspect.exe you can easily extract the same information through the UI Automation framework by junkew. And you'll probably see, that you have to extract the information from the edit box and not directly from the combo box.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@LarsJ

I generally do use Inspect.exe in conjunction with UISpy.exe and don't generally see a huge difference.

It saddens me that a program from 2003 can pull information that a newer one may not. 

I will install the latest Inspect.exe to see if that is true. Meanwhile here is Inspect from 2009.Selection_Inspect.thumb.png.10539ec93cef

As you can see there is still data showing in Selection.Selection

Edited by Kharizmah

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@junkew It turns out it doesn't matter if it is enabled...

I will test a combo box  in a Windows app and get back to you

 

 

 

 

Edited by Kharizmah

Share this post


Link to post
Share on other sites

hard to say. I made a dummy WPF application with visual studio 2013 one disabled combobox and one enabled and run under windows 10

Simple spy gives this 

first one IsEnable is false and for second one its true.

Spy doesn't break

advice to comment out this in your version of simplespy: _UIA_DrawRect($t[1],$t[3]+$t[1],$t[2],$t[4]+$t[2]) 

unfortunately cannot share the latest version as mine is unstable at the moment

*** Detailed properties of the highlighted element ***
UIA_class:= <ComboBox>
UIA_regexpclass:= <ComboBox>
UIA_iaccessiblechildId:= <0>
UIA_handle:= <0>
UIA_RuntimeId:= <7;8388;35786431>
UIA_BoundingRectangle:= <171;136;120;22>
UIA_ProcessId:= <8388>
UIA_ControlType:= <50003>
UIA_LocalizedControlType:= <keuzelijst met invoervak>
UIA_HasKeyboardFocus:= <False>
UIA_IsKeyboardFocusable:= <False>
UIA_IsEnabled:= <False>
UIA_ClassName:= <ComboBox>
UIA_ClickablePoint:= <231;147>
UIA_Culture:= <0>
UIA_IsControlElement:= <True>
UIA_IsContentElement:= <True>
UIA_IsPassword:= <False>
UIA_NativeWindowHandle:= <0>
UIA_IsOffscreen:= <False>
UIA_Orientation:= <0>
UIA_FrameworkId:= <WPF>
UIA_IsRequiredForForm:= <False>
UIA_IsDockPatternAvailable:= <False>
UIA_IsExpandCollapsePatternAvailable:= <True>
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:= <True>
UIA_IsTablePatternAvailable:= <False>
UIA_IsTableItemPatternAvailable:= <False>
UIA_IsTextPatternAvailable:= <False>
UIA_IsTogglePatternAvailable:= <False>
UIA_IsTransformPatternAvailable:= <False>
UIA_IsValuePatternAvailable:= <False>
UIA_IsWindowPatternAvailable:= <False>
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:= <0>
UIA_MultipleViewCurrentView:= <0>
UIA_WindowCanMaximize:= <False>
UIA_WindowCanMinimize:= <False>
UIA_WindowWindowVisualState:= <0>
UIA_WindowWindowInteractionState:= <0>
UIA_WindowIsModal:= <False>
UIA_WindowIsTopmost:= <False>
UIA_SelectionItemIsSelected:= <False>
UIA_TableRowOrColumnMajor:= <2>
UIA_ToggleToggleState:= <2>
UIA_TransformCanMove:= <False>
UIA_TransformCanResize:= <False>
UIA_TransformCanRotate:= <False>
UIA_IsLegacyIAccessiblePatternAvailable:= <True>
UIA_LegacyIAccessibleChildId:= <0>
UIA_LegacyIAccessibleRole:= <46>
UIA_LegacyIAccessibleState:= <1025>
UIA_LegacyIAccessibleDefaultAction:= <Uitbreiden>
UIA_IsDataValidForForm:= <False>
UIA_ProviderDescription:= <[pid:8388,hwnd:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]>
UIA_IsItemContainerPatternAvailable:= <True>
UIA_IsVirtualizedItemPatternAvailable:= <False>
UIA_IsSynchronizedInputPatternAvailable:= <True>
*** Detailed properties of the highlighted element ***
UIA_class:= <ComboBox>
UIA_regexpclass:= <ComboBox>
UIA_iaccessiblechildId:= <0>
UIA_handle:= <0>
UIA_RuntimeId:= <7;8388;57957548>
UIA_BoundingRectangle:= <291;295;120;22>
UIA_ProcessId:= <8388>
UIA_ControlType:= <50003>
UIA_LocalizedControlType:= <keuzelijst met invoervak>
UIA_HasKeyboardFocus:= <False>
UIA_IsKeyboardFocusable:= <True>
UIA_IsEnabled:= <True>
UIA_ClassName:= <ComboBox>
UIA_ClickablePoint:= <351;306>
UIA_Culture:= <0>
UIA_IsControlElement:= <True>
UIA_IsContentElement:= <True>
UIA_IsPassword:= <False>
UIA_NativeWindowHandle:= <0>
UIA_IsOffscreen:= <False>
UIA_Orientation:= <0>
UIA_FrameworkId:= <WPF>
UIA_IsRequiredForForm:= <False>
UIA_IsDockPatternAvailable:= <False>
UIA_IsExpandCollapsePatternAvailable:= <True>
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:= <True>
UIA_IsTablePatternAvailable:= <False>
UIA_IsTableItemPatternAvailable:= <False>
UIA_IsTextPatternAvailable:= <False>
UIA_IsTogglePatternAvailable:= <False>
UIA_IsTransformPatternAvailable:= <False>
UIA_IsValuePatternAvailable:= <False>
UIA_IsWindowPatternAvailable:= <False>
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:= <0>
UIA_MultipleViewCurrentView:= <0>
UIA_WindowCanMaximize:= <False>
UIA_WindowCanMinimize:= <False>
UIA_WindowWindowVisualState:= <0>
UIA_WindowWindowInteractionState:= <0>
UIA_WindowIsModal:= <False>
UIA_WindowIsTopmost:= <False>
UIA_SelectionItemIsSelected:= <False>
UIA_TableRowOrColumnMajor:= <2>
UIA_ToggleToggleState:= <2>
UIA_TransformCanMove:= <False>
UIA_TransformCanResize:= <False>
UIA_TransformCanRotate:= <False>
UIA_IsLegacyIAccessiblePatternAvailable:= <True>
UIA_LegacyIAccessibleChildId:= <0>
UIA_LegacyIAccessibleRole:= <46>
UIA_LegacyIAccessibleState:= <1049600>
UIA_LegacyIAccessibleDefaultAction:= <Uitbreiden>
UIA_IsDataValidForForm:= <False>
UIA_ProviderDescription:= <[pid:8388,hwnd:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]>
UIA_IsItemContainerPatternAvailable:= <True>
UIA_IsVirtualizedItemPatternAvailable:= <False>
UIA_IsSynchronizedInputPatternAvailable:= <True>

 

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

@junkew So I noticed that $UIA_SelectionSelectionPropertyId is missing from your capture.

It doesn't even show as blank.

When I comment out the _UIA_DrawRect($t[1],$t[3]+$t[1],$t[2],$t[4]+$t[2]) , I notice that $UIA_SelectionSelectionPropertyId is missing in my capture also.

So, with your wrapper will I be unable to capture this information?

I know that the return value of  $UIA_SelectionSelectionPropertyId is an array.

Yet I also see that scenario should be handled here:

 PropertyValueIsArray.thumb.png.b4aad89c5

 

Edited by Kharizmah

Share this post


Link to post
Share on other sites

Okay, so just for fun, I changed the code to say:

If IsArray($tval) Then

_ArrayDisplay($tval)

EndIf

The return was an array of numbers:

Row|Col 0
[0]|1746
[1]|1086
[2]|120
[3]|21

 

Share this post


Link to post
Share on other sites

Its a safearray and to make life easier i make them a semicolon stringlist so easier to deal with under general assumption it are small arrays returned. I assume when you get the combobox itself you could play with a treewalker to iterate thru childs of the combobox beeing an edit and listcontrol. Of thise childcontrols you should be able to get the values.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

@junkew Yes, when the ComboBox is enabled that is how I get the value.

After I select the ComboBox, I use Treewalker to view the children and select a child object or verify the object

$UIA_SelectionIsSelectionRequiredPropertyId = true

That workaround works fine for an enabled comboBox.

However, it does not work for a disabled comboBox.  

Edited by Kharizmah

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

@junkew

Okay apparently I do NOT fully read things.

Did you know that $UIA_SelectionSelectionPropertyId does NOT return as an array but as an IUIAutomationElementArray pointer.  That's why the _ArrayDisplay showed a series of numbers.

Okay... I see your above comment that's why you're suggesting using a ContainerPattern

 

Edited by Kharizmah

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

@LarsJ

In speaking with @junkew he suggested I try to access the $UIA_SelectionIsSelectionRequiredPropertyId by using an ItemContainerProvider.  I noticed you had assisted someone with something similar in the thread below.

I was wondering what the variables represented in your FindItemByProperty method are, as there are 4 variables and the MSDN https://msdn.microsoft.com/en-us/library/system.windows.automation.itemcontainerpattern.finditembyproperty(v=vs.110).aspx

only seem to be referring to 3 variables.

objectInterface_selection.thumb.png.6a6bIn changing the code around to reflect your example, $selection is showing a result of 0.

I can only assume this is because of the variables I am putting in.

Edited by Kharizmah

Share this post


Link to post
Share on other sites

Your link above refer to the function in the .NET framework. The functions which junkew implements are the functions in the Windows API. You can find the documentation for FindItemByProperty here.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

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

Create an account

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


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • Psyllex
      By Psyllex
      Is it possible for AutoIt to execute LALT+LSHIFT+NUMLOCK?  I've attempted the following:
       
      ;To show the desktop Send("{RWIN down}") Send("{d}") Send("{RWIN up}") WinWait(2) ;just to make sure the desktop is activated. ControlClick("", "",1[,button="left"[, clicks=2 [, x [, y]]]] ) Send("{LALT down}") Send("{CLT down}") Send("{DELETE down}") ;Send("{LSHIFT down}") ;Send("{NUMLOCK}") ;Send("{NUMLOCK}") ;Send ("{LALT up}") ;Send("{LSHIFT up}") This should bring up the MouseKeys dialog...but I'm getting nothing.  Thanks for any help!
    • WalkHappy
      By WalkHappy
      Hello, I'm in the process of recreation-ally expanding my Auto-it experience for some future awesome presentation-Al capabilities. So I have a user interface which loads a text document onto a GUI-object. The variables of this function are 1) The text document is dynamic in font size and face; giving the viewer an unpredictable horizontal/vertical scroll dimension. 2) The main objective is to animate the vertical scroll-bar so that it moves like the end of a movie with accreditation. 3) I'm trying to limit the accessibility in observation by excluding any mouse functions within the animation process. Any help would be greatly appreciated! Been trying to work on this for days now - from getting element properties, to embedding external code, and even exploiting ("$oIE.navigate") to loading several awkwardly formatted text documents in sequential order just to imitate a slightly offensive animation scheme. Anyways... Suggestions and comments welcomed please!!
      Script is from [Function GUICreate] - Doc:
      GUICreate("Embedded Web control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) GUICtrlCreateObj($oIE, 10, 40, 600, 360) $idButton_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) $idButton_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) $idButton_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) $idButton_Stop = GUICtrlCreateButton("Stop", 330, 420, 100, 30) GUISetState(@SW_SHOW) ;Show GUI After this.. This is the window that pop's-up:

       
    • amphoric
      By amphoric
      Good Morning,
      I hope someone can help, below is a stripped down version of my current .au3 file and there is a few bits I just cant for the life of me get to work;
      1. I would like the 'Allow Edit' checkbox once checked to allow the user to edit the contents of the 'AD Group Name' input box
      2. I would like the 'Other / Internal Use' radio button if checked to show the '$OtherInternalGroup' group of radio buttons
      My current code.....
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIShellEx.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <WinAPI.au3> ; used for Lo/Hi word ; Declare Global variables for WM_COMMAND and '_GetAppName()' function. Global $__iComboWrite = 9999, $__iInputValue = 9999, $__iInputWrite = 9999 #Region ### START GUI section ### $Form1_1 = GUICreate("Packaging Wrapper", 435, 545, -1, -1) GUISetIcon("C.ico", -1) GUISetBkColor(0xFFFFFF) Global $ApplicationNameInput = GUICtrlCreateInput("", 24, 168, 385, 21) GUICtrlSetTip(-1, "EG: Corel_WinZip_21.0_0.1") $ADGroupNameInput = GUICtrlCreateInput("", 24, 224, 385, 21) $AllowEditChk = GUICtrlCreateCheckbox("Allow Edit", 344, 200, 65, 17, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_RIGHT)) GUICtrlSetBkColor(-1, 0xE3E3E3) $ApplicationTypeGroup = GUICtrlCreateGroup("", 24, 272, 185, 113) $CatalogueAppChk = GUICtrlCreateRadio("Catalogue Application", 32, 288, 137, 17) GUICtrlSetBkColor(-1, 0xE3E3E3) $NonCatalogueAppChk = GUICtrlCreateRadio("Non-Catalogue Application", 32, 320, 161, 17) GUICtrlSetBkColor(-1, 0xE3E3E3) $OtherAppChk = GUICtrlCreateRadio("Other / Internal Use", 32, 352, 137, 17) GUICtrlSetBkColor(-1, 0xE3E3E3) GUICtrlCreateGroup("", -99, -99, 1, 1) ; $OtherInternalGroup = GUICtrlCreateGroup("", 216, 272, 193, 113) $OSCoreApplicationChk = GUICtrlCreateRadio("OS Core Application", 224, 288, 129, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetBkColor(-1, 0xE3E3E3) $InternalOnlyChk = GUICtrlCreateRadio("Internal ONLY Application", 224, 320, 161, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetBkColor(-1, 0xE3E3E3) GUICtrlCreateGroup("", -99, -99, 1, 1) $OtherInternalLabel = GUICtrlCreateLabel("Other / Internal Use", 216, 256, 118, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $ConfirmGroup = GUICtrlCreateGroup("", 24, 392, 385, 89) $Confirm = GUICtrlCreateCheckbox("I confirm all details are correct, and I wish to proceed", 48, 456, 329, 17, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_CENTER)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xE3E3E3) $ConfirmDesc = GUICtrlCreateEdit("", 32, 408, 361, 41, 0, 0) GUICtrlSetData(-1, StringFormat("Please confirm that all entered information is correct, and the you wish to \r\nproceed with the creation of the " & Chr(39) & "Application Toolkit Wrapper" & Chr(39) & ".")) GUICtrlSetBkColor(-1, 0xE3E3E3) GUICtrlCreateGroup("", -99, -99, 1, 1) $ProceedBtn = GUICtrlCreateButton("Proceed", 128, 488, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) $CancelBtn = GUICtrlCreateButton("Cancel", 240, 488, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $CapitaLogo = GUICtrlCreatePic("Logo.jpg", 24, 8, 159, 33) $PackagingWrapperLabel = GUICtrlCreateLabel("Packaging Wrapper", 224, 8, 187, 28) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) $CreatedByLabel = GUICtrlCreateLabel("...", 16, 528, 405, 15, $SS_CENTER) GUICtrlSetFont(-1, 7, 400, 0, "MS Serif") $VerLabel = GUICtrlCreateLabel("Ver. 1.0 ALPHA", 328, 40, 79, 17) $Step1Label = GUICtrlCreateLabel("Please Enter The Following Information", 24, 80, 274, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) GUICtrlSetBkColor(-1, 0xE3E3E3) $Graphic3 = GUICtrlCreateGraphic(16, 72, 404, 452, BitOR($GUI_SS_DEFAULT_GRAPHIC, $SS_SIMPLE)) GUICtrlSetColor(-1, 0xE3E3E3) GUICtrlSetBkColor(-1, 0xE3E3E3) $ApplicationNameDesc = GUICtrlCreateEdit("", 24, 128, 393, 33, 0, 0) GUICtrlSetData(-1, StringFormat("Must be in the following format: Manufacturer_AppName_AppVersion_Rev\r\nEG: Corel_WinZip_21.0_01")) GUICtrlSetBkColor(-1, 0xE3E3E3) $ADGroupNameLabel = GUICtrlCreateLabel("AD Group Name", 24, 200, 95, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $ApplicationNameLabel = GUICtrlCreateLabel("Application Name", 24, 112, 103, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $ApplicationTypeLabel = GUICtrlCreateLabel("Application Type", 24, 256, 99, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) GUISetState(@SW_SHOW) #EndRegion ### END GUI section ### ;GLOBAL VARIABLES Global $ApplicationName, $adstring1 Global $ADGroupName = $adstring1 Global $envSystemDrive = EnvGet("systemdrive") Global $PackagingDirectory = "Packaging\???_Apps" Global $FullDir = $envSystemDrive & "\" & $PackagingDirectory & "\" & $ApplicationName Global $currentDate = @MDAY &"-"& @MON &"-"& @YEAR Global $currentTime = @HOUR &":"& @MIN &":"& @SEC ; Register the WM_COMMAND to intercept when the value in the first input's value is changed. GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CancelBtn Exit Case $ProceedBtn ;Check Application Name Validity $ApplicationNameInputValid = StringSplit(GUICtrlRead($ApplicationNameInput), "_") If $ApplicationNameInputValid[0]<> 4 Then ConsoleWrite("Application Name - NOT Valid" & @CRLF) $ApplicationNameInputValidYes = 0 MsgBox(0,"Are The Details Correct?", "Application Name NOT Valid.") GUICtrlSetState($ApplicationNameInput,$GUI_FOCUS) Elseif $ApplicationNameInputValid[0]= 4 Then ConsoleWrite("Application Name - Valid" & @CRLF) $ApplicationNameInputValidYes = 1 EndIf ;Is Confirm Checkbox 'Checked' if GUICtrlRead($Confirm) = $GUI_CHECKED Then ConsoleWrite("$Confirm - ticked" & @CRLF) $ConfirmYes = 1 Else $ConfirmYes = 0 ConsoleWrite("$Confirm - NOT ticked" & @CRLF) MsgBox(0,"Are The Details Correct?", "Please complete confirmation.") EndIf ;Is $CatalogueAppChk 'Checked' if GUICtrlRead($CatalogueAppChk) = $GUI_CHECKED Then ConsoleWrite("$CatalogueAppChk - ticked" & @CRLF) $CatalogueAppChkYes = 1 Else ConsoleWrite("$CatalogueAppChk - NOT ticked" & @CRLF) $CatalogueAppChkYes = 0 EndIf ;Is $NonCatalogueAppChk 'Checked' if GUICtrlRead($NonCatalogueAppChk) = $GUI_CHECKED Then ConsoleWrite("$NonCatalogueAppChk - ticked" & @CRLF) $NonCatalogueAppChkYes = 1 Else ConsoleWrite("$NonCatalogueAppChk - NOT ticked" & @CRLF) $NonCatalogueAppChkYes = 0 EndIf ;Is $OtherAppChk 'Checked' if GUICtrlRead($OtherAppChk) = $GUI_CHECKED Then ConsoleWrite("$OtherAppChk - ticked" & @CRLF) $OtherAppChkYes = 1 Else ConsoleWrite("$OtherAppChk - NOT ticked" & @CRLF) $OtherAppChkYes = 0 EndIf ConsoleWrite(@CRLF & "##### COMPLETED #####" & @CRLF) EndSwitch WEnd ;Check for 'Application Name' update Func _GetAppName() $adString = StringReplace(GUICtrlRead($ApplicationNameInput), "_", " ",2) $adstrings = StringSplit($adString, "_") Global $adString1 = $adstrings[1] Global $ApplicationName = GUICtrlRead($ApplicationNameInput) GUICtrlSetData($ADGroupNameInput, $adstring1) EndFunc ;WM_COMMAND Function used for Auto Input of fields Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Local $iHiWord = _WinAPI_HiWord($wParam) ; Control identification code. Local $iLoWord = _WinAPI_LoWord($wParam) ; Control identifier. Switch $iHiWord Case $EN_CHANGE ; When a change event is intercepted. Switch $iLoWord ; Retrieve the controlid. Case _GetAppName() ; If it matches the first input then call the custom function _GetInput. ConsoleWrite("Debug: value was changed." & @CRLF) _GetAppName() EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND I hope all this makes sense.
      Thanks in advance
    • tommytx
      By tommytx
      I have been experiment for months trying to find a way to be able to like script the find button to find some text and click on that text or something nearby.
      Is this possible?  When the search hilites the text of course this is not where the cursor is so you cannot command a click at that point.   I can get the coordinates of any point and go there and click... but I cannot find the coordinates of a piece of text i have searched up and click that..
      Thanks
       
    • oHenry
      By oHenry
      Hi,
      I would like to share this simple project which aims to be a first approach in order to use AutoIt as scripting language for mobile automation (Android).
      This project is an ImperiusGeorge client for mobile test automation that support native Android apps. 
      You can find more information at https://ohtejera.github.io/ImperiusAutoIt and here's the link to the project on Github: https://github.com/ohtejera/ImperiusAutoIt
      Best regards.
      Henry