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

Get processid from window title - javascript

$
0
0
Hi,

I have around 50 URLs to be launched and each button launch its URL.
Eg Button1 - [url]www.google.com[/url].
    Button2 - [url]www.Facebook.com[/url].   
    Button3 - [url]www.amazon.com[/url].

When google.com is already open, onlick of Button1 bring google.com to focus instead of launching second instance. I cannot rely on window titles to focus as they tend to change when user navigates to other pages inside same browser. 

My Org uses IE11 and it wants only 32 bit IE. I can grab process Id of the URL launched and refocus the same Process ID, but due to protected mode processID gets changed as soon IE is launched. So am thinking to grab window title as soon as IE is loaded and then get process id of the window and use it to re focus. And we need this in Javascript.

This is the piece of code I wrote.
[url]https://jsfiddle.net/[/url]
We run the below code by copying it to JavaScript section.

var URL = "www.google.com"; 
var wshShell = new ActiveXObject("WScript.Shell");
var IEVersion = "C:\\Program Files (x86)\\Internet Explorer\\IExplore.exe "+URL; //32bit
//var IEVersion = "C:\\Program Files\\Internet Explorer\\IExplore.exe "+URL; //64 bit
var LaunchApp = wshShell.Exec(IEVersion); 
var AppProcessId = LaunchApp.ProcessID;
alert(AppProcessId );
//wshShell.AppActivate(AppProcessId);


You might need to Enable, Initialize and script activex controls not marked as safe for scripting security setting of IE inorder to run ActiveX.

I searched in google and tried few examples but nothing worked. Would appreciate if someone post a working example to grab process id from window title.

Thanks.

Viewing all articles
Browse latest Browse all 3527

Trending Articles



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