Solved

using javascript to run command line commands

Posted on 2004-04-09
3
1,064 Views
Last Modified: 2012-06-27
hi, i have a series of perl forms which collect data from a user and then run's a program. once the program is finished i would like to run a open the command line and run pro/engineer on the client's machine. i have done this using visual basic script but i have used javascript for other constraints on my forms so i thought i would try to stick with that. so i guess my question is what is the javascript equivalent of the wshShell command in vbs. and how can i have javascript run pro/e AFTER my first program is complete.

any help will be greatly appreciated!

thanks all!
0
Comment
Question by:jlm661
  • 2
3 Comments
 
LVL 25

Expert Comment

by:devic
ID: 10793666
hi jlm661.

look here:
================
JS example:
<script>
   var ws = new ActiveXObject("WScript.Shell");
   ws.Exec("c:\\Windows\\Notepad.exe")
</script>


VBS example:

<script language="VBScript">
    Set shell = CreateObject("WScript.Shell")
      shell.Run("c:\WINDOWS\Notepad.exe")
</script>
0
 

Author Comment

by:jlm661
ID: 10793720
now does this script have to be inserted in the <head></head> of my page....if so how do i tell it to run those commands AFTER my other code??? thanks for the really quick reply :)
0
 
LVL 25

Accepted Solution

by:
devic earned 500 total points
ID: 10793763
write a function, and call it as you need.
=================================
<script>
function runit()
{
      var ws = new ActiveXObject("WScript.Shell");
      ws.Exec("c:\\Windows\\Notepad.exe");
}
</script>
...............

<script>
runit();
</script>

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 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

19 Experts available now in Live!

Get 1:1 Help Now