Solved

using javascript to run command line commands

Posted on 2004-04-09
3
1,072 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

839 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