shell or system call from JS

C

CTG

Hi guys;

Without any documentation , and new to JS coudl some one tell me how a
JS can shell to operating system, call nother program and get back to
what it used to do...

Can the result of the operation be checked as well (if it was
successful or not) ?


Thanks
 
D

David Mark

Well, you presumably can if you are running under WSH, but not if you
are running under a browser (which most people are).

You can do it in a browser, but not under normal security
configurations. In IE you create an ActiveX object
(Shell.Application) and use the shellExecute method. The technique is
only appropriate for a controlled environment like an Intranet.
 
T

The Magpie

CTG said:
Hi guys;

Without any documentation , and new to JS coudl some one tell me how a
JS can shell to operating system, call nother program and get back to
what it used to do...

Can the result of the operation be checked as well (if it was
successful or not) ?
Essentially, that is exactly what Javascript was developed *not* to be
able to do. It *can* be permitted to do it, but it depends on what the
code runs in and what the user's PC security settings are. In short,
there is absolutely *no* general-purpose method of doing it.
 
T

Thomas 'PointedEars' Lahn

The said:
Essentially, that is exactly what Javascript was developed *not* to be
able to do.

How do you got that crazy idea?


PointedEars
 
T

Thomas 'PointedEars' Lahn

The said:
Age, experience and collaborating through my employers with Netscape
on the original design.

I'd like to see *some* reference material on that, Mrs/M(r)s. Anonymous,
before I am even considering to believe that.

But, whatever your possible connection to Netscape, you are missing the
point. If what you have stated is true, you of all people should know that
JavaScript (and its incarnations) has evolved since Netscape 2.0 from being
a programming language bound to the object model designed for one browser
into an all-purpose programming language that can be used for any means as
long as the execution environment provides the corresponding API. Which
makes especially Gecko-based browsers using XUL, which can do much (maybe
all) of what the OP asked, this successful.

And on Microsoft Windows, the Windows Script Host which can be triggered
from Internet Explorer provides the execution environment and API for
JScript to do all of what the OP asked.


PointedEars
 
L

Lee

Thomas 'PointedEars' Lahn said:
I'd like to see *some* reference material on that, Mrs/M(r)s. Anonymous,
before I am even considering to believe that.

But, whatever your possible connection to Netscape, you are missing the
point. If what you have stated is true, you of all people should know that
JavaScript (and its incarnations) has evolved since Netscape 2.0 from being
a programming language bound to the object model designed for one browser
into an all-purpose programming language that can be used for any means as
long as the execution environment provides the corresponding API. Which
makes especially Gecko-based browsers using XUL, which can do much (maybe
all) of what the OP asked, this successful.

And on Microsoft Windows, the Windows Script Host which can be triggered
from Internet Explorer provides the execution environment and API for
JScript to do all of what the OP asked.

None of which changes the fact that it is exactly the sort of thing
that Javascript was developed *not* to be able to do. The fact that
security has been relaxed since then can't change that fact, and the
fact that it's possible, under very unusual circumstances to do what
the OP wants to do, probably doesn't help him.

When somebody identifies themself as "new to JS", the best answer
is that you can't do that.


--
 
S

Steve Swift

When somebody identifies themself as "new to JS", the best answer
is that you can't do that.

I've always found that the best *question* normally contains an element
of "I'm certain this cannot be done".

In my experience, that drives all sorts of people to bust their guts
trying to prove me wrong by showing just how it *can* be done. :)

In the process, I get my answer. I should have taken my degree in
Psychology, not Physics. I did spend a lot of time lurking in the
Psychology department, but that was only because they had better
licenses for their PDP11 software, so always got new releases earlier
than us Physicists.
 
E

Evertjan.

Steve Swift wrote on 14 aug 2007 in comp.lang.javascript:
I've always found that the best *question* normally contains an element
of "I'm certain this cannot be done".

Steve, you read Pointed wrongly.

He just ment [if fathoming that is possible] that one should not be "new to
JS" as an excuse of not reading the FAQ, the specs and thinking logically.

That excuse is being reserved for the more experienced under us.
 
D

Dr J R Stockton

In comp.lang.javascript message <f9qf8c$9u0$1$8300dec7@news.demon.co.uk>
Thomas 'PointedEars' Lahn wrote:
Age, experience and collaborating through my employers with Netscape
on the original design.


Be aware that Thomas's age is increasing each year by a much greater
percentage than yours is, though in his case the normal consequential
improvements are not in evidence.
 
T

The Magpie

Thomas said:
I'd like to see *some* reference material on that, Mrs/M(r)s. Anonymous,
before I am even considering to believe that.
No problem, if you are really interested. But it would be better
outside Usenet.
But, whatever your possible connection to Netscape, you are missing the
point. If what you have stated is true, you of all people should know that
JavaScript (and its incarnations) has evolved since Netscape 2.0 from being
a programming language bound to the object model designed for one browser
into an all-purpose programming language that can be used for any means as
long as the execution environment provides the corresponding API. Which
makes especially Gecko-based browsers using XUL, which can do much (maybe
all) of what the OP asked, this successful.
Absolutely! I agree 100% that it has grown up from effectively a "bit
of a toy" into something very real and very useful and that can do a
hell of a lot more than it was ever imagined it would at the start. No
doubt at all. Except that it can't do what the OP suggested because he
wants OS commands and Javascript is OS neutral.
And on Microsoft Windows, the Windows Script Host which can be triggered
from Internet Explorer provides the execution environment and API for
JScript to do all of what the OP asked.
Oh sure - here I do agree totally.Other systems that can use
Javascript can certainly trigger specific commands.

I use one myself - I use OpenOffice.org Base to link to a MySQL
database and Javascript macros to fire off embedded triggers. In a
specific environment, you can use it for whatever the environment will
let it do. But that doesn't mean Javascript itself can do it. It can
do it in combination with a tool to extend Javascript's reach.
 
T

Thomas 'PointedEars' Lahn

The said:
No problem, if you are really interested. But it would be better
outside Usenet.

Yes, please.
Oh sure - here I do agree totally.Other systems that can use
Javascript can certainly trigger specific commands.

I use one myself - I use OpenOffice.org Base to link to a MySQL
database and Javascript macros to fire off embedded triggers. In a
specific environment, you can use it for whatever the environment will
let it do. But that doesn't mean Javascript itself can do it. It can
do it in combination with a tool to extend Javascript's reach.

I think you are attempting tetrapilotomy here. From the Subject "shell or
system call from JS" and the OPs question "How [can] a JS can shell to
operating system, call [a]nother program and get back to what it used to
do...[?]" I would always say that it is possible, under certain conditions.
Because, as I said, the execution environment and the API it provides is
inherently connected to the language implementations. Try to show me some
practically useful script that does not make use of a host object, and you
see what I mean.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,519
Latest member
OtisLucket

Latest Threads

Top