Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

How to convert VB/VBA code from "IE.document.parentWindow.executeScript()" to "eval()"

$
0
0

My team is working on a project creating "custom voice commands" for a 3rd party speech recognition product, and that product includes support for Microsoft Word via VBA.  The custom commands we are working to create are for controlling a web app in the browser, setting focus to various elements, typing text, etc.. and we have proven the approach of using "execScript()" under IE9 to execute jQuery, and it works flawlessly.  However, with the impending push of IE11 within our organization, and the removal of the "execScript()" functionality beginning in IE11, we are seeking examples of exactly how to convert our code from "execScript()" to "eval()". 

Here is an example;

Sub FocusFrame()
On Error GoTo ErrMsg Dim SWs As SHDocVw.ShellWindows Dim vIE As SHDocVw.InternetExplorer Dim ipv_website_name As String Set SWs = New SHDocVw.ShellWindows ipv_website_name = "https://www.ourdevsite.org/ipv/ipv.jsp?ipvx_complete=yes" Dim arrSite arrSite = Split(ipv_website_name, "?") ipv_website_name = arrSite(0) For Each vIE In SWs If LCase(Left(vIE.LocationName, Len(ipv_website_name))) = LCase(ipv_website_name) Then Dim strScript As String strScript = "jQuery(""iframe[id*='ui-id-'][style*='block']"").contents().find(""iframe#params"").focus();" Call vIE.document.parentWindow.execScript(strScript, "javascript") End If Next GoTo Cleanup ErrMsg: MsgBox Err.Description Cleanup: Set SWs = Nothing End Sub

What we are asking for is a good example of how to convert this line such that it will use "Eval()" under IE 11 and accomplish the exact same functionality;

         Call vIE.document.parentWindow.execScript(strScript, "javascript")

to

         Call <?what goes here?>.Eval(strScript)

Thank you very much, in advance!


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>