function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Karthi_VeluKarthi_Velu 

Lauch Exe from S-Controls is not working.

Hi Folk,

 

The below code is working in with '.html' file from local.

 

But when intergrating with S-Controls, It telling "[Object Error]" in IE.7 and "Error: A script from "https://na5.salesforce.com" was denied UniversalXPConnect privileges." in Mozilla. 

 

If you having any other solution to launch .exe from S-Controls (Consider S-Controls having the full path of .exe)  on windows client machine.

 

 

HTML:

============

 

<a href='#' onclick='launchExeToCall();return true;'>call</a>

 

 

JS

=========== 

 

 

/*

*to Launch the click2call application

*/

function launchExeToCall()

{

var browser=navigator.appName;

// var path = getLaunchExePath();

var path = "C:\\n.exe";

if (browser=="Microsoft Internet Explorer") {

alert("Microsoft Internet Explorer s");

runExeOnIE('\"'+path+'\"');

} else if(browser=="Netscape") {

alert("Netscape q");

runExeOnMozilla(path);

}

}

 

/*

*  launch the application in IE

*/

function runExeOnIE(path) {

try{

path="\"C:\\n.exe\"";

WSH=new ActiveXObject("WScript.Shell");

WSH.run(path);

} catch(e){

alert(e);

}

}

 

/*

*  launch the application in Mozzila.

*/

function runExeOnMozilla(path) {

alert('started lanuch');

try{

netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

var file = Components.classes["@mozilla.org/file/local;1"]

                    .createInstance(Components.interfaces.nsILocalFile);

path = "C:\\Progra~1\\Skype\\Phone\\Skype.exe";

file.initWithPath(path);

 

var process = Components.classes["@mozilla.org/process/util;1"]

                       .createInstance(Components.interfaces.nsIProcess);

process.init(file);

 

// Run the process.

// If first param is true, calling thread will be blocked until

// called process terminates.

// Second and third params are used to pass command-line arguments

// to the process.

var args = ["argument1", "argument2"];

process.run(false, args, args.length);

 

 

} catch(err){

alert(err);

}

}

 

 

werewolfwerewolf

What makes you think that you can launch an .exe from a web page in general?  That hasn't worked since browsers started imposing security restrictions in the late 90s.  If browsers could just launch .exe files from Javascript, that would be a super-easy method for a malicious programmer to take control of your machine.

 

The only way to make that work is to specifically authorize that .exe to be called by Javascript on the client machine.  Those security settings differ by browser and version.

Karthi_VeluKarthi_Velu

Thanks for your suggestion!

 

If this is my requirement( launch the .exe application from browser ), What is the possible way to achieve from web page. 

 

I have tried with flash, But in flash the .exe should be in 'fscommand' folder then only it possibe!.

 

 

 

WilmerWilmer

I'm not sure this could be allowed by SFDC's security but, why don´t you try to use an ActiveX?

 

Regards,

 

Wilmer