Текст из загруженной в IE страницы:
if !IE := GetWebBrowser()
{
MsgBox, IE не найден!
return
}
Text := IE.Document.body.innerText
; MsgBox % Text
return
GetWebBrowser()
{
; Get a raw pointer to the document object of the top-most IE window.
static msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
SendMessage msg, 0, 0, Internet Explorer_Server1, ahk_class IEFrame
if ErrorLevel = FAIL
return ; IE not found.
lResult := ErrorLevel
DllCall("oleacc\ObjectFromLresult", "ptr", lResult
, "ptr", GUID(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}")
, "ptr", 0, "ptr*", pdoc)
; Query for the WebBrowserApp service. In this particular case,
; the SID and IID are the same, but it isn't always this way.
static IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}"
static SID_SWebBrowserApp := IID_IWebBrowserApp
pweb := ComObjQuery(pdoc, SID_SWebBrowserApp, IID_IWebBrowserApp)
; Release the document object pointer.
ObjRelease(pdoc)
; Return the WebBrowser object, wrapped for usability:
static VT_DISPATCH := 9, F_OWNVALUE := 1
return ComObject(VT_DISPATCH, pweb, F_OWNVALUE)
}
GUID(ByRef GUID, sGUID) ; Converts a string to a binary GUID and returns its address.
{
VarSetCapacity(GUID, 16, 0)
return DllCall("ole32\CLSIDFromString", "wstr", sGUID, "ptr", &GUID) >= 0 ? &GUID : ""
}
Сработает ли с xml — не пробовал.
Разработка AHK-скриптов:
e-mail
dfiveg@mail.ruTelegram
jollycoder