autohotkey - Get the value of an input field in IE using AHK -
I am trying to get an IEL using Auto Hot in an input field.
I am using AHK version 1.1.19.01 using IE 11.0.9600.174 9 on Windows 8.1
I have a simple (local) HTML page:
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Page 1 & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Input type = "text" name = "area 2" id = "area 2" /> & Lt; / Body & gt; & Lt; / Html & gt; I write something in the text box and then run the AHK script (which tells me the value I just wrote).
This is my ah script:
WB: = IEGet ( "Page 1") WinActivate Page 1 txt: = wb.Document.All.area2.Value MsgBox % Txt IEGet (name = ""); Recover the current IE window pointer / tab {ifEqual, name ,, WinGetTitle, name, ahk_class IEFrame {name: = (name = "new tab - Windows Internet Explorer")? About "tab": RegExReplace (Name, "- (Windows | Microsoft) Internet Explorer")} com Objereket ( "Sel.aplikeshn") in Kvindo {if the BBC (wb.LocationName = Name) & amp ; Amp; InStr (wb.FullName, "iexplore.exe") {return wb}}} The message box is empty.
I have not tried several syntax. What am i doing
The IEGet function was copied from some web page - it's not mine, but it works.
Notes: To find Aacke version:
msgbox% "My Aacke version:" A_ Ahkewarsian
here is a simple working example (Win7 v1.1.19.01 IE11)
FileSelectFile, path WB: = ComObjCreate ("InternetExplorer.Application") wb.visible: = true wb.navigate (path), while Wb.readyState! = 4 || Wb.document.readyState! = "Full" || || I sometimes had problems with IEGet () and IE9 + .
But here I use it to get an active IE object
WBGet (WinTitle = "Ahk_class IEFrame", Svr # = 1) {; // static message on comObjQuery Docs: = DllCall ( "RegisterWindowMessage", "str", "WM_HTML_GETOBJECT"), IID: = "{0002DF05-0000-0000-C000-000000000046}"; // IID_IWebBrowserApp; //, id: "{332C4427-26CB-11D0-B483-00C04FD90119}"; // IID_IHTMLWindow2 SendMessage message, 0, 0, Internet Explorer_Server% Svr #%,% WinTitle% if (! ERRORLEVEL = "fail") {lResult: = eRRORLEVEL, VarSetCapacity (GUID, 16,0) that DllCall ( "Ole32 \ CLSIDFromString "," Wstr "" {332C4425-26CB-11D0-B483-00C04FD90119} "," ptr ", & amp; GUID) = 0 {DllCall ( "oleacc \ ObjectFromLresult" "PTR" Elarslt, "PTR", and GUID, "PTR", 0, "PTR *" Peediosi) Comobj (9 Comobjoint (Peediosi, IID, IID), 1 ), Objeari strap (pdoc)}}}
query IWebBrowserApp interface and returns a usable IE Comobject
SetTitleMatchMode, 2 WB = WBGet ("Page 1") Txt: = wb.Document.All ["area2"]. Value messagebox% txt
Hope this helps
Comments
Post a Comment