"Dynamic" ComObj("InternetExplorer.Application") Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
eqv
Posts: 72
Joined: 18 Sep 2018, 22:17

"Dynamic" ComObj("InternetExplorer.Application")

18 Sep 2018, 23:22

Good morning everyone, I have a question about the "ComObj" (specifically internet explorer).
·
Is it possible to enter properties as variables?
····························································· For example:
f(a, b, c, d) {
Return a.getElementBy%b%(c).%d%
}
····························································· So I could do something like;
a:=ComObjCreate("InternetExplorer.Application")
Msgbox % f(a,"ID","Example1","innerText") ;; show InnerText Example1 (ID)
Msgbox % f(a,"TagName","Example2","value") ;; show Value of Example2 (TagName)
·····························································
Sorry my bad English. Thanks in advance.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: "Dynamic" ComObj("InternetExplorer.Application")  Topic is solved

19 Sep 2018, 01:08

Code: Select all

f(a, b, c, d) {
Return a["getElementBy" . b](c)[d]
}
In order to access objects dynamically you have to use []
Also you might find that getElementByTagName doesn't exist.
There is only getElementsByTagName.
getElementById will work normally though - but getElementsById might fail.
Recommends AHK Studio
eqv
Posts: 72
Joined: 18 Sep 2018, 22:17

Re: "Dynamic" ComObj("InternetExplorer.Application")

19 Sep 2018, 01:29

It is the first time that I post in the forum; and the response was very quick! 0.0
Thank you very much!!! ^^

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Thorlian and 280 guests