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

Get help with using AutoHotkey and its commands and hotkeys
eqv
Posts: 40
Joined: 18 Sep 2018, 22:17

"Dynamic" ComObj("InternetExplorer.Application")

Post by eqv » 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: 3326
Joined: 30 Sep 2013, 01:01
Location: Germany

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

Post by nnnik » 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: 40
Joined: 18 Sep 2018, 22:17

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

Post by eqv » 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!!! ^^
Post Reply

Return to “Ask For Help”