From: Thomas 'PointedEars' Lahn on
Swifty wrote:

> I know that JavaScript goes out of its way to make it impossible for
> local commands to be executed,

You are confused. This has nothing to do with the programming language but
with the APIs provided by a runtime environment.

> but in a situation where I own everything; the server, the webpage, the
> local system, the browser (and anything else that you can think of), is
> there a way to execute a local command?

It is very irrelevant who owns what. What matters are URI scheme
identifiers, domain names and port numbers.

> To give you the specifics: The webpage is the source control for all
> the HTML and CGI scripts on our department server (remote from me/my
> PC). After I've checked out the file that I want to work on, it would
> be nice if that file could be opened on my local system.

ssh remote-host vim remote-file

Though I prefer a combination of ssh(1), and screen(1) to work on the
remote console.

> To do this, the JavaScript running on my local system would have to
> execute a command such as:
>
> "C:\Program Fies\Editor\Edit.exe" "L:\path\to\file\filename"

You do not want information about your local system to be transferred over
unauthenticated, unencrypted connections.

> I realise that I'll probably have to make some adjustments to my
> browser to accommodate this, but I prefer to keep these to a minimum,
> as I use all sorts of different browsers, and I'd never be certain
> which one I'd be using.

Then you are out of luck client-side.

> If it helps, I could easily create a CGI script to run under apache on
> my local system, and that could be used as the mechanism that actually
> issues the host command.

You are confused. "host command"?

> So the JavaScript running on my local PC could issue some sort of
> httprequest to my local apache to cause the editor to launch.

The Web server maybe can run the application, but there would still be no
user interface to it.

You can have a server-side application generate an HTML form to display and
update the files contents, or to download the file for local editing and
upload the changed file to replace the original.

It is a lot easier to use a Shell script, though.

Anyhow, the solution for your problem is quite beyond the scope of this
newsgroup.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: Swifty on
On Wed, 07 Apr 2010 09:28:49 GMT, "rf" <rf(a)z.invalid> wrote:

>HTML Applications. IE only

Unfortunate. I have to keep my IE at IE6 as my employer's default
browser is IE6 (for compatibility with some Precambrian application)
so I tend to use almost anything *except* IE. Thanks for the
suggestion anyway. I may be on my way to IE8 soon.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
From: "Michael Haufe ("TNO")" on
On Apr 7, 7:29 am, Swifty <steve.j.sw...(a)gmail.com> wrote:
> On Wed, 07 Apr 2010 09:28:49 GMT, "rf" <r...(a)z.invalid> wrote:
> >HTML Applications. IE only
>
> Unfortunate. I have to keep my IE at IE6 as my employer's default
> browser is IE6 (for compatibility with some Precambrian application)
> so I tend to use almost anything *except* IE. Thanks for the
> suggestion anyway. I may be on my way to IE8 soon.


Write a web page in HTML + JScript. rename the extension to .hta and
you're done. As mentioned already, you can access system methods
through the WSH API. VBScript is not necessary.
From: Dr J R Stockton on
In comp.lang.javascript message <7tgor5dbgmjfqlmgqej8v3081hofpdde8c(a)4ax.
com>, Wed, 7 Apr 2010 09:45:28, Swifty <steve.j.swift(a)gmail.com> posted:
>I know that JavaScript goes out of its way to make it impossible for
>local commands to be executed,

No; browsers do that. When run under Windows Script Host, J[ava]Script
and VBScript have access to the sort of powers you seem to want.

> but in a situation where I own
>everything; the server, the webpage, the local system, the browser
>(and anything else that you can think of), is there a way to execute a
>local command?

You have asked a JavaScript question (independently of whether it has a
JavaScript answer), so you are firmly on-topic. However, the solution
if any is probably microsoft-specific (you would have said if you were
running non-Windows), and you would do well to ask in their newsgroup
hierarchy (whether or not they think it still exists).

That having been said : I have a web page which needs a file (in the
same domain) whose content needs to be what DIR /B /S currently
gives - so if there is a solution I'd like to hear of it.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7)
Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7)
From: Bwig Zomberi on
Swifty wrote:
> I know that JavaScript goes out of its way to make it impossible for
> local commands to be executed, but in a situation where I own
> everything; the server, the webpage, the local system, the browser
> (and anything else that you can think of), is there a way to execute a
> local command?

In IE, add the server to your Local Internet zone.


>
> To give you the specifics: The webpage is the source control for all
> the HTML and CGI scripts on our department server (remote from me/my
> PC). After I've checked out the file that I want to work on, it would
> be nice if that file could be opened on my local system. To do this,
> the JavaScript running on my local system would have to execute a
> command such as:
>
> "C:\Program Fies\Editor\Edit.exe" "L:\path\to\file\filename"

Set security level to Low.

Internet Options -> Security -> Security Level For this Zone

>
> I realise that I'll probably have to make some adjustments to my
> browser to accommodate this, but I prefer to keep these to a minimum,
> as I use all sorts of different browsers, and I'd never be certain
> which one I'd be using.

Only IE will allow that. Here is the code I tried - Modified from
POinted Ears.

<html>
<head>
<title></title>


<script type="text/jscript" language="JScript">
function runEditor()
{
try {

var wshShell = new ActiveXObject("WScript.Shell");
wshShell.Run("notepad.exe");



} catch(err) {
alert(err);
}
}
</script>


</head>
<body>

<input type="button" value="start" onclick="runEditor();">

</body>
</html>







--
Bwig Zomberi
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6
Prev: detect exiting the website
Next: BESEN ES5 implementation