?
Solved

how to do commandline execution in html

Posted on 2003-03-04
12
Medium Priority
?
133 Views
Last Modified: 2010-04-09
   There are two textboxes to which 2 filenames are selected by means of "Browse..." buttons. I want to compare these 2 files using an existing software. How to run the software when I click the "compare files" button (In HTML)taking these 2 files as parameters.

   The file comparison software can be run in commandline as :     software_name file1 file2
please help
deepa
0
Comment
Question by:deepaot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 17

Accepted Solution

by:
dorward earned 200 total points
ID: 8065471
I'd submit the form to a server side process that saves the files, runs them through diff (pretty standard on UNIX and UNIX like systems), processes the output and then delete the temp files.
0
 
LVL 1

Expert Comment

by:tripst3r
ID: 8065642
Expanding on what dorward said, you can't just call command line execution from a browser. Would you want a web page running a delete function on your hard drive?



0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8067875
Try this:


<html>
<head>
<script>
function doCompare(){
 oldFileName=document.forms[0].oldFile.value;
 newFileName=document.forms[0].newFile.value;
 if(oldFileName=="" || newFileName=="") return false;
 var tempFile = "F:\\temp\\compres.txt"
 var WshShell = new ActiveXObject("WScript.Shell");
 var oExec = WshShell.Exec("cmd /K fc "+oldFileName+" "+newFileName+" > "+tempFile+" & exit");
 while (oExec.Status == 0){
     //WScript.Sleep(100);
 }
 var ForReading = 1;
 fso = new ActiveXObject("Scripting.FileSystemObject");
 f = fso.OpenTextFile(tempFile, ForReading);
 alert(f.ReadAll())

 var fso = new ActiveXObject("Scripting.FileSystemObject");
}
</script>
</head>
<body>
<form>
<table>
<tr><td>
OldFile:</td><td>
<input type=file name=oldFile>
</td></tr>
<tr><td>
NewFile:</td><td>
<input type=file name=newFile>
</td></tr>
</table>
<input type=button value=Comapre
onClick="doCompare()">
<p>
</form>
</body>
</html>

Good luck,
Zvonko

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:substand
ID: 8075184
you can't do it in html.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8075283
Is my code no html?
0
 
LVL 10

Expert Comment

by:substand
ID: 8075422
it includes javascript.  (at least it looks like javascript)

0
 
LVL 17

Expert Comment

by:dorward
ID: 8075490
JavaScript, Windows Scripting Host, and ActiveX.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8077963
Oh, two guys who can read!!! Or are you girls :-)

Hello deepa, did you try my proposal?

0
 
LVL 2

Expert Comment

by:cocojohn
ID: 8079168
Zvonko's script can work only on IE with Scripting Host installed and script security set quite low.
It may be used in an intranet, but never on the web.

For all other browsers and configurations:
You can't compare files in the browser, you have to upload them and compare server-side.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8820479
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9012169
It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
points to dorward

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

0
 
LVL 10

Expert Comment

by:substand
ID: 9012903
i think the question was answered in at least three different ways (dorward, zvonko, and substand) and all are correct, depending on the user's requirements (if they can do "no html" instead of wanting the answer "in html" as they said)

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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?
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

777 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