Solved

HTML Java script that executes network application

Posted on 2013-06-13
6
328 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
  • 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 500 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

860 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