Jump to content

Recommended Posts

Hi,

 

I am using SetValue method to input text into a ComboBox > TextBox the input does works however the string isn't found by the software as it says its invalid value

The comobox is a search box which auto completes text sent by the user. I tried using Send("text") but its replaced by 1 in textbox

UIA Spy info

https://pastebin.com/E05Ux505

i tried using junkew method where 

_UIA_action($oUIElement,Send("text"))

 does works however  i can't use it for controlling other parts

Edited by dranzer006
Link to post
Share on other sites

Normal. Send("anything") returns 1.  So it seems that it is working but you do not use it properly.  Next time, please post a runable code so we do not have to guess what you are trying to achieve...

Edited by Nine
Link to post
Share on other sites

Hi

this is my code

instead of sending "mytext" in editbox it sends 1 there.

 

ConsoleWrite( "--- Find window/control ---" & @CRLF )

   Local $pCondition0
   $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "PART_EditableTextBox", $pCondition0 )
   If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF )
   ConsoleWrite( "$pCondition0 OK" & @CRLF )

   Local $pEdit1, $oEdit1
   $oWindow2.FindFirst( $TreeScope_Descendants, $pCondition0, $pEdit1 )
   $oEdit1 = ObjCreateInterface( $pEdit1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement )
   If Not IsObj( $oEdit1 ) Then Return ConsoleWrite( "$oEdit1 ERR" & @CRLF )
   ConsoleWrite( "$oEdit1 OK" & @CRLF )


   Local $pValuePattern1, $oValuePattern1
   $oEdit1.GetCurrentPattern( $UIA_ValuePatternId, $pValuePattern1 )
   $oValuePattern1 = ObjCreateInterface( $pValuePattern1, $sIID_IUIAutomationValuePattern, $dtag_IUIAutomationValuePattern )
   If Not IsObj( $oValuePattern1 ) Then Return ConsoleWrite( "$oValuePattern1 ERR" & @CRLF )
   ConsoleWrite( "$oValuePattern1 OK" & @CRLF )

   $sValue = Send("mytext")
   $oValuePattern1.SetValue($sValue)
   ConsoleWrite( "$oValuePattern1.SetValue()" & @CRLF )

 

Link to post
Share on other sites

You are doing the same error.  Remove the whole Send line, as it returns 1 like I already told you.

And use

$oValuePattern1.SetValue("myText")
Link to post
Share on other sites

I see. Then remove the whole setValue line and replace it with :

Send("myText")

It is not the nicest way to set a field but this should work in your situation...

Link to post
Share on other sites

Try :

$oEdit1.SetFocus()

BTW, you do not need that ValuePattern portion of your code if you are not using .setValue method...

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...