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>
How to paste value to this box?
-
- Posts: 16
- Joined: 08 Jul 2018, 06:17
Re: How to paste value to this box?
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%
}
-
- Posts: 16
- Joined: 08 Jul 2018, 06:17
Re: How to paste value to this box?
its not working...sry im new in ahk...do i need to get the element id to get this work?
Re: How to paste value to this box?
Open Box.html in IE, then run PasteValue.ahk.
- Attachments
-
- Files.zip
- (1.25 KiB) Downloaded 32 times
-
- Posts: 16
- Joined: 08 Jul 2018, 06:17
Re: How to paste value to this box?
thanks you..but its still not working..when i run the paste.ahk i get this error... :
- Attachments
-
- Untitled.png (28.4 KiB) Viewed 1329 times
Re: How to paste value to this box?
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:Otherwise I'm out of ideas!
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%
Who is online
Users browsing this forum: No registered users and 146 guests