Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

lanuch .exe using javascript

Status
Not open for further replies.

rmkh33

Technical User
Aug 2, 2003
7
CA
Hi, I'm new to this forum and was wondering if anyone can tell me how to launch an .exe file/program using javascript. Can this even be done?
 
No.

For security reasons that would never be allowed.

However, if you try to open an EXE in the web browser you are always prompted with:

"[ SAVE ] [ RUN FROM CURRENT LOCATION ]"

Javascript can bring up this question without the user clicking a link with:

<SCRIPT>location.href=&quot;myProgram.exe&quot;;</SCRIPT>
 
does that .exe have an interface? in what software have u developed it?

Known is handfull, Unknown is worldfull
 
It wouldn't matter. It can never be allowed due to the relaxed security inherent to client-side applications.

If you could -ever- automatically launch any executable via a web browser, you could instantly compromise that user's computer.

This means no self-respecting vendor of web browsers will ever allow it. Sure, you could write a web browser with no security and persuade users to use that instead... but it itself will still be subject to the [RUN/SAVE] dialogue.

In conclusion, the requested scenario is simply not possible. HTA also require user permission before it can be launched for the same reason.

You can do a lot with Javascript/DHTML that would make most EXE redundant and that may avoid the issue but there is no workaround.
 
Thanks for your help!

I was wondering how I can create a program that would:
1. ask for a users name, password and length of time
2. after the user enters this info the next screen gives the user a menu with several options to run different programs (.exe/applications)
3. the time alloted for using the app, once it's lanuched, is timed (based on what the user entered initially)
4. when the time expires the entire application logs the user off (if the user uses less time than what they indicated initially the remaining balance needs to be tracked so that when they log in again they can use up the remaining hours)

Can the user info and time be stored in a database that can communicate with JS?
 
stormbind:
the only reason i asked that was because if the exe is generated in director then it can be converted to IE format(.dcr). it works just like the EXE....


and rmkh: that is not possible using javascript. try using ASP,PHP.....

Known is handfull, Unknown is worldfull
 
Thanks again...

Do you know how much it would cost to have this sort of program written? I don't know PHP or ASP. Any ideas?
 
To do what you want, best write it in VisualBasic or C

There's always a better way. The fun is trying to find it!
 
tviman, could you help me write the program using visual basic?

Thanks
 
what he means is ActiveX components that can be embedded inot html files. they give the look and feel of VB. but then activex is not a wise choice. some browsers will not aloow the activex to be displayed...

Known is handfull, Unknown is worldfull
 
I need some help asap and would be greatful if someone could help me write this program using visual basic.

To write this program would be difficult for me because I'm not sure how to address the following:
1. could vb be used to generate unique usernames and passwords?
2. how would the vb application talk to a database that also keeps track of usernames, passwords and how long a user has been logged on
3. how can the vb application shut down or log the user out once his/her time has expired

Your help is appreciated.

 
then it is best to use asp or php and u can get asap help in the respective forums...

Known is handfull, Unknown is worldfull
 
Executing Exe IN JavaScript/WScript/winmgmts/sendingKeys
<code>
var winmg = GetObject(&quot;winmgmts:win32_process&quot;);
var WShell = new ActiveXObject(&quot;WScript.Shell&quot;);
obj = winmg.Create(&quot;Xcalc.exe&quot;, null,null);
WScript.Sleep(500);
WShell.SendKeys(&quot;any App Arguments or commands you have~&quot;);
WScript.Sleep(50) //minimum, 100 recommended for long hual apps/commands/or aurguments then you can send more keys
</code>
 
that works only in IE...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top