Question About COM (IE) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
snowmind
Posts: 124
Joined: 12 Nov 2015, 15:18

Question About COM (IE)

25 Jul 2017, 12:39

Hello guys :shock:

I'm trying to develop a script inside my company so that a focus is made on a certain field and a value is inserted.
I've tried to use the COM concepts I know and it just spins and nothing happens. Should it have a different syntax because it has "IFRAME"?

iWB2 Learner Shows:
------------------------------------------------------------------------------
Title: SystemForm
Input: 41
Url: https://servicemanager.net.system.com.br
Index: 154
Name: instance/number
ID: X20

Frame#: IFRAME.1
Index: 2089
name: mif-comp-721479
id: ext-gen415
------------------------------------------------------------------------------


I try:

Code: Select all

for wb in ComObjCreate("Shell.Application").Windows
If InStr(wb.locationURL, "https://servicemanager.net.system.com.br")
{
	V_Span := wb.document.getElementsByTagName("SPAN")
	V_Input := wb.document.getElementsByTagName("INPUT")
	V_Input.item[41].Focus()
}
and try this too:

Code: Select all

for wb in ComObjCreate("Shell.Application").Windows
If InStr(wb.locationURL, "https://servicemanager.net.system.com.br")
{
	wb.document.getElementById("X20").Focus()
}
and more recently:

Code: Select all

for wb in ComObjCreate("Shell.Application").Windows
If InStr(wb.locationURL, "https://servicemanager.net.system.com.br")
{
	wb.document.getElementById("X20").contentWindow.document.frames[0].Focus()
}

some help? :wtf:
User avatar
F4Jonatas
Posts: 45
Joined: 22 Oct 2015, 06:35
Contact:

Re: Question About COM (IE)

25 Jul 2017, 19:06

It looks like you can not access the site. So we can not find a solution.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Question About COM (IE)  Topic is solved

25 Jul 2017, 22:06

iWB2 Learner Shows:
------------------------------------------------------------------------------
Title: SystemForm
Input: 41
Url: https://servicemanager.net.system.com.br
Index: 154
Name: instance/number
ID: X20

Frame#: IFRAME.1
Index: 2089
name: mif-comp-721479
id: ext-gen415
------------------------------------------------------------------------------
The element is inside a frame, so you need locate the frame first:

Code: Select all

for wb in ComObjCreate("Shell.Application").Windows
	If InStr(wb.locationURL, "https://www.baidu.com/")
	{
		frame := ComObj(9,ComObjQuery(wb.document.getElementById("ext-gen415").contentWindow,"{332C4427-26CB-11D0-B483-00C04FD90119}","{332C4427-26CB-11D0-B483-00C04FD90119}"),1)
		; or --> frame := ComObj(9, ComObjQuery(wb.Document.ParentWindow.Frames[0], "{332C4427-26CB-11D0-B483-00C04FD90119}", "{332C4427-26CB-11D0-B483-00C04FD90119}"), 1)
		frame.document.getElementById("X20").Focus()
	}
snowmind
Posts: 124
Joined: 12 Nov 2015, 15:18

Re: Question About COM (IE)

26 Jul 2017, 07:22

tmplinshi wrote:
iWB2 Learner Shows:
------------------------------------------------------------------------------
Title: SystemForm
Input: 41
Url: https://servicemanager.net.system.com.br
Index: 154
Name: instance/number
ID: X20

Frame#: IFRAME.1
Index: 2089
name: mif-comp-721479
id: ext-gen415
------------------------------------------------------------------------------
The element is inside a frame, so you need locate the frame first:

Code: Select all

for wb in ComObjCreate("Shell.Application").Windows
	If InStr(wb.locationURL, "https://www.baidu.com/")
	{
		frame := ComObj(9,ComObjQuery(wb.document.getElementById("ext-gen415").contentWindow,"{332C4427-26CB-11D0-B483-00C04FD90119}","{332C4427-26CB-11D0-B483-00C04FD90119}"),1)
		; or --> frame := ComObj(9, ComObjQuery(wb.Document.ParentWindow.Frames[0], "{332C4427-26CB-11D0-B483-00C04FD90119}", "{332C4427-26CB-11D0-B483-00C04FD90119}"), 1)
		frame.document.getElementById("X20").Focus()
	}

Works perfect! Tks a lot for you help :clap:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], rc76 and 222 guests