?
Solved

HTML Java script that executes network application

Posted on 2013-06-13
6
Medium Priority
?
332 Views
Last Modified: 2013-06-14
We created an intranet page for my company.  One of the links needs to launch an in-house application.  I have a java link script (below) which works for a local file, but what about over the network?  What is the syntax for that?  

example:
</form>
<script> 
     function go()
    {
          w = new ActiveXObject("WScript.Shell");
          w.run('\\server\share\application.bat');
          return true;
    } 
</script>

Open in new window


I do not wish to install any 3rd party utilities on the clients launching the intranet page because there are like 400 machines.  My goal is to make this all server-side.  

Thanks in advance!
0
Comment
Question by:icecom4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:BAKADY
ID: 39246334
this works under vbs:

<script type="text/vbscript">
     Public Function go
          Dim oShell
          Set oShell = CreateObject("WScript.Shell")
          oShell.run """\\server\shared path\program.exe"""
          go = true
    End Function
</script>

Open in new window

0
 

Author Comment

by:icecom4
ID: 39246353
I added your script to my html source but it does not show any forms or links.
0
 
LVL 4

Accepted Solution

by:
BAKADY earned 2000 total points
ID: 39246708
then add just the quotes in javascript, like this :

w.run('"\\server\share\application.bat"');

Open in new window

if this doesn't work again, i don't have any idea....
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:icecom4
ID: 39246727
I was able to get this to launch a .exe over the network, but for some reason it wont start a working batch script.  Any ideas?
<script>
function LaunchApp() {
	if (!document.all) {
 
  		alert ("This ActiveXObject is only available for Internet Explorer");
		return; 
	}
	var ws = new ActiveXObject("WScript.Shell");
    ws.Exec("\\\\server\\share\\test.exe");
}
</script>

Open in new window

0
 

Author Comment

by:icecom4
ID: 39246761
ok, tried adding the quotes to first script I posted and it worked, thanks!

I was able to blend the two different scripts I posted above, below is the final product
Makes a form, with button, and has that IE alert which is useful.  

<script type = "text/Javascript">

function go() {
if (!document.all) {
 
  		alert ("This ActiveXObject is only available for Internet Explorer");
		return; 
	}
w = new ActiveXObject("WScript.Shell");
w.run("\\\\server\\share\\file.bat");
return true;
}

</script>
 
<form>
Run Batch
<input type="button" value="Go" onClick="return go()">
</form>

Open in new window

0
 
LVL 4

Expert Comment

by:BAKADY
ID: 39246915
rename the file from *.bat to *.cmd
try it and send a feedback... should work...
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question