Selecting particular existing IE and clicking things. Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
thenasos
Posts: 79
Joined: 10 Nov 2015, 10:00

Selecting particular existing IE and clicking things.

17 Feb 2017, 07:45

Once IE open windows number increases, unable to select particular windows and navigate it.

Trying to use jethrow's IEGet ( but looks like I am not getting it ( no pun intended).

Code: Select all

WinActivate, badwindow - Internet Explorer
WinWaitActive, badwindow - Internet Explorer

IEGet()
while wb.Busy
	 Sleep 200

Astatus := wb.Document.getElementsByClassName("navLabel")
MsgBox % Astatus.length

IEGet(Name="", HwndFilter="") {
	if (Name = "")	;// Get active window name if no parameter
		WinGetTitle, Name, % "ahk_id" HwndFilter:=WinExist("ahk_class IEFrame")
	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")
			if Not HwndFilter or (HwndFilter and wb.hwnd=HwndFilter)
				return wb
}
Script works fine, when creating new windows, but once I have all windows open, I can force to select specific window to navigate.
Shrek is love...
Gicu
Posts: 111
Joined: 19 Aug 2014, 08:19
Location: Italy

Re: Selecting particular existing IE and clicking things.  Topic is solved

17 Feb 2017, 08:46

wb := IEGet() / wb := IEGet("badwindow")
User avatar
thenasos
Posts: 79
Joined: 10 Nov 2015, 10:00

Re: Selecting particular existing IE and clicking things.

21 Feb 2017, 05:03

Gicu wrote:wb := IEGet() / wb := IEGet("badwindow")
Did try:

Code: Select all

WinActivate, badwindow - Internet Explorer
WinWaitActive, badwindow - Internet Explorer
wb := IEGet()
And this:
wb := IEGet("badwindow ")
Looks like "wb" is empty.

Feels like I am failing to fold a chair...
Shrek is love...
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
GitHub: 4GForce

Re: Selecting particular existing IE and clicking things.

21 Feb 2017, 06:51

?? https://gist.github.com/jethrow/2574167 ??

You modified his code ? Was it working with original code ?
User avatar
thenasos
Posts: 79
Joined: 10 Nov 2015, 10:00

Re: Selecting particular existing IE and clicking things.

21 Feb 2017, 10:24

4GForce wrote:?? https://gist.github.com/jethrow/2574167 ??

You modified his code ? Was it working with original code ?
I found this modification on forums done by the great gurus them selves ( but do not find the link any more.)
Anyhow, got a discovery, it works fine with other pages, only "that one" is giving me the issue.
Shrek is love...
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
GitHub: 4GForce

Re: Selecting particular existing IE and clicking things.

21 Feb 2017, 14:36

What is this badwindow anyway ?? ( you have the url ? )

Is WinActivate even working for you ? I had to use the ahk_class IEFrame to activate Internet Explorer :/
User avatar
thenasos
Posts: 79
Joined: 10 Nov 2015, 10:00

Re: Selecting particular existing IE and clicking things.

22 Feb 2017, 05:00

4GForce wrote:What is this badwindow anyway ?? ( you have the url ? )

Is WinActivate even working for you ? I had to use the ahk_class IEFrame to activate Internet Explorer :/
"badwindow" is an internal page, url not gonna help much. :)

My aim is to have as little "active" window manipulation as possible, so I only capture and act upon the information gathered.
When tested on other pages it works fine. Noticed page also has iframe tags, parentWindow.frames will be needed to "frag" this one. :)

Here, an example working fine on "google"

Code: Select all

wb := IEGet("Google")
while wb.Busy
	 Sleep 200

Astatus := wb.Document.getElementsByClassName("_Gs")
MsgBox % Astatus.length
loop % Astatus.length
{
MsgBox % Astatus[A_Index - 1].innerText
;~ if (AstatusSTR := SubStr(Astatus[A_index - 1].InnerText, 1, 8) = "View REQ")
	;~ Astatus[A_index - 1].Click()
}

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
}
return
Shrek is love...
User avatar
thenasos
Posts: 79
Joined: 10 Nov 2015, 10:00

Re: Selecting particular existing IE and clicking things.

22 Feb 2017, 07:59

Found the reason, why I was not able to select "see" the window...
In this particular case, the window title did not match window.LocationName

When cheking with window spy(or just checking the header) I'd get "badwindow"
But when running:

Code: Select all

for window in ComObjCreate("Shell.Application").Windows
    windows .= window.LocationName " :: " window.Width "`n"
MsgBox % windows
I found the "title was" something like this "https://badwindow/forms/It%was/a+wonder ... =test=html"
Great, now time for a tea party with the rabbit!
Shrek is love...
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
GitHub: 4GForce

Re: Selecting particular existing IE and clicking things.

22 Feb 2017, 14:17

thenasos wrote:Found the reason, why I was not able to select "see" the window...
In this particular case, the window title did not match window.LocationName

When cheking with window spy(or just checking the header) I'd get "badwindow"
But when running:

Code: Select all

for window in ComObjCreate("Shell.Application").Windows
    windows .= window.LocationName " :: " window.Width "`n"
MsgBox % windows
I found the "title was" something like this "https://badwindow/forms/It%was/a+wonder ... =test=html"
Great, now time for a tea party with the rabbit!
That's why I was asking about the url ... IEGet() uses the wb.LocationName to match the name

Return to “Ask For Help”

Who is online

Users browsing this forum: aftskin, austin4149, Bad husband, mikeyww, songdg and 55 guests