Solved

HTML Java script that executes network application

Posted on 2013-06-13
6
325 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
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 to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now