Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[AHK_L]How to let parentWindow.execScript in ie6 execution


  • Please log in to reply
9 replies to this topic
bolang
  • Members
  • 12 posts
  • Last active: Jan 19 2012 05:16 PM
  • Joined: 17 May 2007
I according to the club's example test in ie8 through
But in IE6 execution failure
Excuse me, how do I make pwb.document.parentWindow.execScript in ie6 execution
Below are in IE6 executable error report

0x80070005 -Refused to visit
Source: (null)
Description: Refused to visit

HelpFile: C:\WINDOWS\system32\mshtml.hlp
HelpContext: 0

Specifically: execScript
Line#
1636: pwb := ComObjCreate("InternetExplorer.Application")
1637: pwb.Visible := true
1638: pwb.Navigate("www.google.com.hk")
1639: While,pwb.busy
1640: Sleep,100
1642: jscomplete = j_str = location.href
---> 1647: pwb.document.parentWindow.execScript(jscomplete)
1650: j_str := pwb.document.parentWindow.j_str
1651: MsgBox,%j_str%
Continue running the script?

pwb := ComObjCreate("InternetExplorer.Application")
pwb.Visible := true
pwb.Navigate("www.google.com.hk")
while, pwb.busy
   sleep, 100

jscomplete =
(
j_str = location.href
)

pwb.document.parentWindow.execScript(jscomplete)
j_str :=  pwb.document.parentWindow.j_str
MsgBox, %j_str%


ahklerner
  • Members
  • 1386 posts
  • Last active: Jul 18 2014 12:08 AM
  • Joined: 26 Jun 2006
not sure which of yours correlates to pwin (maybe pwb) but i used

COM_Invoke(pwin, "execscript", JS_to_Inject)

as suggested by lexikos who wrote the ahk_l

<!-- m -->http://www.autohotke... ... ieinjectjs<!-- m -->

Lexikos
  • Administrators
  • 9441 posts
  • Last active:
  • Joined: 17 Oct 2006
ahklerner, pwb.document.parentWindow is the window object.

nams, do you just need the URL? If so, use pwb.LocationURL. For other properties, refer to WebBrowser object. I think the error is to do with retrieving location.href in an indirect way; AutoHotkey only shows "execScript" because that's where it handed control over to IE.

tank
  • Moderators
  • 4238 posts
  • Last active: Today, 10:05 PM
  • Joined: 21 Dec 2007
it is for this very reason that i query the pwb for the window instead of invoking it.
pWin := COM_QueryService(pwb,	"{332C4427-26CB-11D0-B483-00C04FD90119}",	"{332C4427-26CB-11D0-B483-00C04FD90119}")
I used to support only users of IE6 and the list of problems over come by this are substantial. I suppose its only related to ie6 and older. There exist a handy library by Sean which has this functions replacement in a downloaded found elsewhere called comUtils. I am too lazy to link it right now. for javascript globals you may better declare the variable with var also

bolang
  • Members
  • 12 posts
  • Last active: Jan 19 2012 05:16 PM
  • Joined: 17 May 2007

not sure which of yours correlates to pwin (maybe pwb) but i used

COM_Invoke(pwin, "execscript", JS_to_Inject)

as suggested by lexikos who wrote the ahk_l

<!-- m -->http://www.autohotke... ... ieinjectjs<!-- m -->


Thanks for your help.
My application environment is IE6, I've been using your IE_InjectJS() to execute javascript has a year and a half.
Recent upgrades to want to give the script in updated AHK_L version, when the problem appeared.

I updated the Acc.ahk and COM.ahk, but without much success FOR AHK_L version.
COM_L.AHK
<!-- m -->http://www.autohotke...topic22923.html<!-- m -->
ACC.ahk Sean's ComUtils
<!-- m -->http://www.autohotke...pic.php?t=67931<!-- m -->
Excuse me IE_InjectJS () how to update the AHKL

bolang
  • Members
  • 12 posts
  • Last active: Jan 19 2012 05:16 PM
  • Joined: 17 May 2007

nams, do you just need the URL? If so, use pwb.LocationURL. For other properties, refer to WebBrowser object. I think the error is to do with retrieving location.href in an indirect way; AutoHotkey only shows "execScript" because that's where it handed control over to IE.


thank for your help
May my statement incorrect, I want to be through object to IE implanted in IE8 javascript, above all, IE7 success, but in IE6 below not succeed.
How do I use object's manner to IE6 implant javascript´╝č

bolang
  • Members
  • 12 posts
  • Last active: Jan 19 2012 05:16 PM
  • Joined: 17 May 2007

it is for this very reason that i query the pwb for the window instead of invoking it.

pWin := COM_QueryService(pwb,	"{332C4427-26CB-11D0-B483-00C04FD90119}",	"{332C4427-26CB-11D0-B483-00C04FD90119}")
I used to support only users of IE6 and the list of problems over come by this are substantial. I suppose its only related to ie6 and older. There exist a handy library by Sean which has this functions replacement in a downloaded found elsewhere called comUtils. I am too lazy to link it right now. for javascript globals you may better declare the variable with var also


Thank you for your help, I find COM_L.AHK and Sean's ComUtils
<!-- m -->http://www.autohotke...topic22923.html<!-- m -->
ACC.ahk ComUtils
<!-- m -->http://www.autohotke...pic.php?t=67931<!-- m -->

I try to use ComUtils to update, but without much success, how do I correct modify code?

a4u
  • Guests
  • Last active:
  • Joined: --
IID_IHTMLWindow2 := "{332C4427-26CB-11D0-B483-00C04FD90119}"

pwb := ComObjCreate("InternetExplorer.Application") 
pwb.Visible := true 
pwb.Navigate("www.google.com.hk") 
while, pwb.busy 
   sleep, 100 

[color=red]pwin := Query_Service(pwb, IID_IHTMLWindow2)[/color]
pwin.execScript("j_str = location.href") 
MsgBox, % pwin.j_str 
Note - this does not use the COM Library (the COM Library does not use Native COM)

a4u
  • Guests
  • Last active:
  • Joined: --
... of course, as Lexikos pointed out, you don't even need execScript:
MsgBox, % pwb.locationURL "`n"

		.	Query_Service(pwb, IID_IHTMLWindow2).location.href


bolang
  • Members
  • 12 posts
  • Last active: Jan 19 2012 05:16 PM
  • Joined: 17 May 2007

IID_IHTMLWindow2 := "{332C4427-26CB-11D0-B483-00C04FD90119}"

pwb := ComObjCreate("InternetExplorer.Application") 
pwb.Visible := true 
pwb.Navigate("www.google.com.hk") 
while, pwb.busy 
   sleep, 100 

[color=red]pwin := Query_Service(pwb, IID_IHTMLWindow2)[/color]
pwin.execScript("j_str = location.href") 
MsgBox, % pwin.j_str 
Note - this does not use the COM Library (the COM Library does not use Native COM)


Thank you very much.
I use your methods to solve the problem.