Jump to content

Recommended Posts

Posted

I am trying to click inputbox.

$IE = _IEAttach($WinTitle)
_IELoadWait($IE) ;make sure loaded
$IEObject = _IEGetObjByname($IE, "txtSearch")
_IEAction($IEObject, "click")

Nothing happens unless i click it with mouse.

It ONLY works for buttons but not for an inputs and combo boxes.
Maybe inputs and combos i try to click are none standard ?

Here is a code from the page for the input.

<INPUT onkeypress=ValidationForCatalogandInventoryText();CheckScan(); onkeyup=EnableSearchButton(); onfocus=RemoveScanText(this.id); onblur=SystemSettingsTrim();SetScanText(false); id=txtSearch class=textbox onpaste=EnableSearchButton();OnPasteDisallowSpecialChars(); style="BACKGROUND-COLOR: white" ondrop="OnDragDropDisallowSpecialChars('btnSearch');" maxLength=15 value="Scan an item ..." name=txtSearch>

Thats where i want to click.

thanks !

Posted (edited)

Not enough info, so I'll take a stab in the dark...throw in this additional line:

$IE = _IEAttach($WinTitle)
_IELoadWait($IE) ;make sure loaded
$IEObject = _IEGetObjByname($IE, "txtSearch")
; _IEAction($IEObject, "click") 
_IEAction($IEObject, "focus") 

; now set the text, and then do a blur: _IEAction($IEObject, "blur")

As for combo boxes, use this to set the value:

_IEFormElementOptionSelect

 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted

I dont need to set any values, i just need the input box to be clicked.

Focus worked, thank you. What i dont understand is why CLICK does not work but FOCUS does.
No way i'd assume i need to focus on an element when i am trying to click it lol

Posted

I began to see what you mean, but that i need not only understand autoit but also how IE elements work.
Why not say in the help file that "Focus" is more like a mouse click and "click" is more like (to be honest, i dont know what "click" would stand for other then a mouse click.) something else but clearly not the mouse click. ?

That would clear the confusion for generations to come :P

Posted
15 minutes ago, tonycst said:

Why not say in the help file that "Focus" is more like a mouse click and "click" is more like...something else but clearly not the mouse click. ?

Because that is not accurate.  Focus is like setting focus, while Click "simulates" a mouse click by firing the objects OnClick event.  

It would be more accurate for the help file to state this message which is on the MSDN page for the IHTMLElement Click method page

 

Quote

Remarks

Note  Simulating a click using the IHTMLElement::click does not bring the element being clicked into focus.
 

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
×
×
  • Create New...