SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,316
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Convert console commands to Javascript?

    It is possible to create buttons on a web page (on my own computer) so that it will execute console commands? Instead of opening the Mac or PC console or terminal apps, clicking on a button will open the console or terminal app and execute the command? Could we input the starting directory in a text field and make the console start from that directory to run its commands?

    Of course, those commands will be part of the built-in button functionality.

    I just wonder if it's possible with Javascript or other programming language as fields and buttons on a web page.
    Steve Husting

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by StevenHu View Post
    It is possible to create buttons on a web page (on my own computer) so that it will execute console commands? Instead of opening the Mac or PC console or terminal apps, clicking on a button will open the console or terminal app and execute the command?
    Sorry no - JavaScript's security just doesn't allow that sort of thing to occur.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,312
    Mentioned
    178 Post(s)
    Tagged
    8 Thread(s)
    As Paul says, JavaScript executed by a browser, doesn't allow that sort of thing to occur due to security concerns.
    On Windows, one would normally write a DOS batch script for such tasks.

    It is however, also worth mentioning that Windows Script Host ships with an engine that support JScript (Microsoft's implementation of JavaScript), meaning that you can also use JavaScript for scripting tasks on Windows machines.

    I was looking at it recently to mount a TrueCrypt volume on boot.
    See also: http://stackoverflow.com/questions/1...t-on-a-desktop

  4. #4
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,316
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you, Paul. Makes sense.
    Steve Husting


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •