How to operate upon the control whose information is not shown by window Spy?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

How to operate upon the control whose information is not shown by window Spy?

27 Sep 2017, 11:00

Hello friends..

I have to work on a webpage too much in my office which requires my User Id again and again. I want to set my User id on it by making a hotkey. But here the problem is that the specific control’s classNN is not shown by window spy. On the other hand when I use another tool- AccViewer Source.ahk, then it shows the control’s information in it.


Please look at this image-

Image

in the above image you can see that when I hover the mouse pointer on User ID field then window spy does not show the classNN of user ID field. It is showing internet explorer_server1 in classNN field, which is the classNN of entire web page. Moreover, I wrote 12345 in user ID field but window spy is showing no text.

Now look at this image-
Image

Now in the second image you can see that I used AccViewer Source.ahk tool to get the information of controls of web page. It is showing value of the classNN of the control same i.e. internet explorer_server1, but here the interesting fact is that, it is showing value of control- 12345. On the other hand window spy is not retrieving the text of the specific control.

Please guide me how can I retrieve the text of the control whose classNN is not shown by window spy. I searched old threads regarding retrieving the classNN of specific controls which are not shown in window spy, but nothing seems to be helpful.

PLEASE HELP...
THANKS A LOT....
I don't normally code as I don't code normally.
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
Contact:

Re: How to operate upon the control whose information is not shown by window Spy?

27 Sep 2017, 11:19

You can't get controls from a webpage using the native methods, youll need to find a lib specific to ie/webpage interaction.
Heres a older tutorial I found after a quick search thats relevant: https://autohotkey.com/board/topic/4705 ... -tutorial/
and a library that could retrieve such information: https://autohotkey.com/board/topic/7730 ... -09272012/
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
[/color]
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to operate upon the control whose information is not shown by window Spy?

28 Sep 2017, 01:49

KuroiLight wrote:You can't get controls from a webpage using the native methods, youll need to find a lib specific to ie/webpage interaction.
Heres a older tutorial I found after a quick search thats relevant: https://autohotkey.com/board/topic/4705 ... -tutorial/
and a library that could retrieve such information: https://autohotkey.com/board/topic/7730 ... -09272012/
Thanks dear KuroiLIght.....

sir, could you please give me basic idea how can i operate upon the controls which are not shown by window spy?? i tried to go through the link https://autohotkey.com/board/topic/7730 ... -09272012/ as provided by you, but as i am novice so i am unable to understand how to use this library in my scenario. moreover, there are no examples etc to learn it. please give me some basic ideas/codes to solve my issue. thank you so much.... :)
I don't normally code as I don't code normally.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to operate upon the control whose information is not shown by window Spy?

28 Sep 2017, 04:34

This works on AutoHotkey Help (HTML Help) and Internet Explorer. It works on Internet Explorer_Server controls. You could try it on your program as is, without changing the code.

That Userid box is not a control but a web element. If you search for things like: getElementById, getElementsByClassName, getElementsByTagName, you should find more information.

Code: Select all

;[WBGet function]
;Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
;https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/

q::
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
MsgBox, % oWB.document.activeElement.innerText
MsgBox, % oWB.document.activeElement.outerHTML
MsgBox, % "id: " oWB.document.activeElement.id "`r`n" "class: " oWB.document.activeElement.className "`r`n" "tag: " oWB.document.activeElement.tagName
oWB := ""
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to operate upon the control whose information is not shown by window Spy?

29 Sep 2017, 01:53

jeeswg wrote:This works on AutoHotkey Help (HTML Help) and Internet Explorer. It works on Internet Explorer_Server controls. You could try it on your program as is, without changing the code.

That Userid box is not a control but a web element. If you search for things like: getElementById, getElementsByClassName, getElementsByTagName, you should find more information.

Code: Select all

;[WBGet function]
;Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
;https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/

q::
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
MsgBox, % oWB.document.activeElement.innerText
MsgBox, % oWB.document.activeElement.outerHTML
MsgBox, % "id: " oWB.document.activeElement.id "`r`n" "class: " oWB.document.activeElement.className "`r`n" "tag: " oWB.document.activeElement.tagName
oWB := ""
return
Thank you so much dear jeeswg for your kind help and support........ :D
sir, when i tried to run the codes provided by you then it shows the error msgbox- Error: Call to nonexistent function. And it points to this line- oWB := WBGet("ahk_id " hWnd)

Please please tell me what are we missing in the codes? looking forward for your guidance.... Thanks you very much.....
I don't normally code as I don't code normally.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to operate upon the control whose information is not shown by window Spy?

29 Sep 2017, 04:25

It needs the WBGet function, I put a link at the top of the script.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to operate upon the control whose information is not shown by window Spy?

30 Sep 2017, 10:15

jeeswg wrote:It needs the WBGet function, I put a link at the top of the script.
thank you so much dear jeeswg......
Your really solved my problem..... :bravo:
I am highly obliged to you..... :salute:

Sir i have one small question-

suppose i have 3 tabs in internet explorer and i want to activate specific tab when i press f1 key then what should i do?
for example in first tab there is web page- www.autohotkey.com
in second tab the web page is www.google.com
and the third web page is www.yahoo.com
suppose currently third tab is activated and web page www.yahoo.com is on the screen now i want that when i press f1 key then it should select first tab (which is www.autohotkey.com) automatically.
I mean to say whether second or third tab is activated but when i press f1 key then it should activate first tab.
I know there is built in shortcut key for switching tabs for IE which is ctrl+tab.....
but i want to do it by objects in ahk....
I found the link https://autohotkey.com/board/topic/5268 ... owser-tab/ to be helpful for this purpose but the codes provided by jethrow are not working as i want.....
please help me.....
thanks a lot.....
I don't normally code as I don't code normally.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to operate upon the control whose information is not shown by window Spy?

30 Sep 2017, 16:21

There are Ctrl+1 to Ctrl+8 to focus the nth tab, and Ctrl+9 to focus the last tab.

Code: Select all

F1::
F2::
F3::
F4::
F5::
F6::
F7::
F8::
SendInput, % "^" SubStr(A_ThisHotkey, StrLen(A_ThisHotkey))
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to operate upon the control whose information is not shown by window Spy?

01 Oct 2017, 04:57

jeeswg wrote:There are Ctrl+1 to Ctrl+8 to focus the nth tab, and Ctrl+9 to focus the last tab.

Code: Select all

F1::
F2::
F3::
F4::
F5::
F6::
F7::
F8::
SendInput, % "^" SubStr(A_ThisHotkey, StrLen(A_ThisHotkey))
return
You are really superb dear jeeswg….
I really do not know that there is also a built in shortcut key- ctrl + 1 to 9 to select desired tab in internet explorer.
I appreciate your knowledge and skills….. :thumbup:

Sir, as I want to select the specific tab of internet explorer is that, to select it by the name of web site’s url. For example I use com object module for working in MS excel. Suppose I want to select sheet3 when I press f1 key then I use following codes-

f1::
xl:= ComObjActive("Excel.Application")
xl.sheets(“sheet3”).select
return


In the above codes you can see that I am selecting specific sheet (sheet3) by sheet’s name. My quarry is that- can’t this happen in Internet Explorer while selecting specific tab? In my earlier post I gave an example that- suppose there are three tabs in Internet Explorer window and they are- first- www.autohotkey.com, second- www.google.com, third- www.yahoo.com , now I want that whether second for third tab is activated but when I press f1 key then it should activate first tab. I tried to get help from this link as suggested by you- https://autohotkey.com/board/topic/4705 ... -tutorial/
in this link jethrow has done outstanding work to make us understand the basics of controlling webpages. He also provides the codes to ‘Access an IE object by Window/Tab Name:’ and the codes are these-

Code: Select all

IEGet(name="") {
   IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame     ;// Get active window if no parameter
   Name := (Name="New Tab - Windows Internet Explorer")? "about:Tabs":RegExReplace(Name, " - (Windows|Microsoft)? ?Internet Explorer$")
   for wb in ComObjCreate("Shell.Application").Windows()
      if wb.LocationName=Name and InStr(wb.FullName, "iexplore.exe")
         return wb
}
But I am unable to use them to select the specific tab by url name. If you could help me solve my quarry, I would be highly thankful to you.
Thanks..
I don't normally code as I don't code normally.
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to operate upon the control whose information is not shown by window Spy?

02 Oct 2017, 13:03

jeeswg wrote:There are Ctrl+1 to Ctrl+8 to focus the nth tab, and Ctrl+9 to focus the last tab.

Code: Select all

F1::
F2::
F3::
F4::
F5::
F6::
F7::
F8::
SendInput, % "^" SubStr(A_ThisHotkey, StrLen(A_ThisHotkey))
return
sir please help....
I don't normally code as I don't code normally.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to operate upon the control whose information is not shown by window Spy?

02 Oct 2017, 23:13

See JEE_IntExpFocusVisTabByName, where you specify the webpage title and url to focus the tab.
Internet Explorer: activate tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 27#p173827
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to operate upon the control whose information is not shown by window Spy?

06 Oct 2017, 23:19

jeeswg wrote:See JEE_IntExpFocusVisTabByName, where you specify the webpage title and url to focus the tab.
Internet Explorer: activate tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 27#p173827
Thank you so much dear jeeswg.....
you really helped me.....
so nice of your....
thanks a lott..... :bravo: :clap: :thumbup:
I don't normally code as I don't code normally.
User avatar
Sabestian Caine
Posts: 528
Joined: 12 Apr 2015, 03:53

Re: How to operate upon the control whose information is not shown by window Spy?

20 Oct 2023, 08:39

jeeswg wrote:
28 Sep 2017, 04:34
This works on AutoHotkey Help (HTML Help) and Internet Explorer. It works on Internet Explorer_Server controls. You could try it on your program as is, without changing the code.

That Userid box is not a control but a web element. If you search for things like: getElementById, getElementsByClassName, getElementsByTagName, you should find more information.

Code: Select all

;[WBGet function]
;Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
;https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/

q::
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
MsgBox, % oWB.document.activeElement.innerText
MsgBox, % oWB.document.activeElement.outerHTML
MsgBox, % "id: " oWB.document.activeElement.id "`r`n" "class: " oWB.document.activeElement.className "`r`n" "tag: " oWB.document.activeElement.tagName
oWB := ""
return
Hello dear jeeswg...

Sir, I have windows 10 and I am trying to automate Internet explorer using WBGet function, but it is not working on the active internet explorer window....Sir please tell me how can I set values and retrieve values from internet explorer in windows 10? please look at this link-
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=112611&p=501441#p501441
please help me sir...
thanks a lot..
I don't normally code as I don't code normally.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arrondark, Bing [Bot], CoffeeChaton and 147 guests