How to paste value to this box?

Get help with using AutoHotkey and its commands and hotkeys
RaisetheBass
Posts: 16
Joined: 08 Jul 2018, 06:17

How to paste value to this box?

08 Jul 2018, 08:05

Can't get element id from iWB2 Learner...please help...



<span da='String' IsEditable='true' dec='0' EditType='DBEdit' I='' onfocusout='FormRowSet_Span_OnFocusOut(this)' OldT='' isn='Y' OldI='' ml='30' Sts='NN' name='CustIDCode' DBFormPK='frmIndivCustAndContact' isFieldInital='false' tt='ID Code' T='' onfocusin='FormRowSet_Span_OnFocusIn(this)' FieldName='CUST_CERT_CODE' style='' id='custid'><input title='' style='width:150;height:20;display:inline;' onKeyUp='FormRowSet_AllField_OnKeyUp(this)' class='dbform_inputfield_style' onbeforepaste='FormRowSet_AllField_OnBeforePaste(this)' maxlength='30' onKeyPress='FormRowSet_AllField_OnKeyPress(this)' onKeyDown='FormRowSet_AllField_OnKeyDown(this)' value='' type='text'></span>
User avatar
rommmcek
Posts: 1106
Joined: 15 Aug 2014, 15:18

Re: How to paste value to this box?

08 Jul 2018, 12:16

For IE try:

Code: Select all

#NoEnv
WinActivate, ahk_class IEFrame
WinWaitActive, ahk_class IEFrame
WinGetTitle, WinTitle, ahk_class IEFrame
try wb:=pwb_Get(WinTitle, 1)
wb.document.querySelector("input").value:="10"
return

PWB_Get(WinTitle="A", Svr#=1) ; Jethrow - http://www.autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
{
	Static msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
	, IID := "{0002DF05-0000-0000-C000-000000000046}" ; IID_IWebBrowserApp
	;,IID := "{332C4427-26CB-11D0-B483-00C04FD90119}" ; IID_IHTMLWindow2
	SendMessage, msg, 0, 0, Internet Explorer_Server%Svr#%, %WinTitle%
	If (ErrorLevel != "FAIL") {
		lResult := ErrorLevel, VarSetCapacity(GUID, 16, 0)
		If (DllCall("ole32\CLSIDFromString", "wstr", "{332C4425-26CB-11D0-B483-00C04FD90119}", "ptr", &GUID) >= 0) {
			DllCall("oleacc\ObjectFromLresult", "ptr", lResult, "ptr", &GUID, "ptr", 0, "ptr*", pdoc)
			Return ComObj(9, ComObjQuery(pdoc, IID, IID), 1), ObjRelease(pdoc)
		}
	}
	MsgBox, 262160, %A_ScriptName% - %A_ThisFunc%(): Error,  Unable to obtain browser object (PWB) from window:`n`n%WinTitle%
}
RaisetheBass
Posts: 16
Joined: 08 Jul 2018, 06:17

Re: How to paste value to this box?

09 Jul 2018, 00:23

its not working...sry im new in ahk...do i need to get the element id to get this work?
User avatar
rommmcek
Posts: 1106
Joined: 15 Aug 2014, 15:18

Re: How to paste value to this box?

09 Jul 2018, 00:48

Open Box.html in IE, then run PasteValue.ahk.
Attachments
Files.zip
(1.25 KiB) Downloaded 23 times
RaisetheBass
Posts: 16
Joined: 08 Jul 2018, 06:17

Re: How to paste value to this box?

09 Jul 2018, 05:48

thanks you..but its still not working..when i run the paste.ahk i get this error... : :headwall: :?
Attachments
Untitled.png
Untitled.png (28.4 KiB) Viewed 1114 times
User avatar
rommmcek
Posts: 1106
Joined: 15 Aug 2014, 15:18

Re: How to paste value to this box?

09 Jul 2018, 07:56

What's the version of your IE? Should be 11!
The line 4 is actually redundant, should be working without it too!
In line 5 remove the word "try" and see if you get error!
You can try to change PWB_Get function:

Code: Select all

	Static msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
	;, IID := "{0002DF05-0000-0000-C000-000000000046}" ; IID_IWebBrowserApp
	,IID := "{332C4427-26CB-11D0-B483-00C04FD90119}" ; IID_IHTMLWindow2
	SendMessage, msg, 0, 0, Internet Explorer_Server%Svr#%, %WinTitle%
Otherwise I'm out of ideas!

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 31 guests