Sponsors: Michael Fertik - Best JAVA Web hosting Company & 30% off


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-19-2010, 10:25 AM
Member
 
Join Date: Mar 2010
Posts: 1
Rep Power: 0
looselispssinkships is on a distinguished road
Default Browse for and append
Hi,

I am absolutely new to java and was lead here because of my occasional use of HTML.

The original code I wanted was to open and append a file (AutoCAD can use HTML in some instances such as help files). The code for I worked on for this works perfectly however I also wanted to insert an option to browse for a particular file, hit append and have that file append its text contents instead. The reason for this is because 9 out of 10 times the accaddoc.lsp file (text based) is located when its installed by default, however 1 out of 10 time the file is moved because of an administrative decision, in that case I need to be able to browse for my file.

I see my code opens the default files to append using java hens why I’m posting my question here.

I will include the entire code including the html to give a better picture of whats happening.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Append acaddoc.lsp</title>
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
body {
  margin: 5px 5px 5px 5px;
  background-color: #ffffff;
}
/* ========== Text Styles ========== */
hr { color: #000000}
body, table /* Normal text */
{
 font-size: 10pt;
 font-family: 'Arial', 'Helvetica', sans-serif;
 font-style: normal;
 font-weight: normal;
 color: #000000;
 text-decoration: none;
}
span.rvts1 /* Heading */
{
 font-weight: bold;
 color: #0000ff;
}
span.rvts2 /* Subheading */
{
 font-weight: bold;
 color: #000080;
}
span.rvts3 /* Keywords */
{
 font-style: italic;
 color: #800000;
}
a.rvts4, span.rvts4 /* Jump 1 */
{
 color: #000080;
 text-decoration: underline;
}
a.rvts5, span.rvts5 /* Jump 2 */
{
 color: #000080;
 text-decoration: underline;
}
span.rvts6 /* Font Hint */
{
 color: #aca899;
}
span.rvts7 /* Font Hint Title */
{
 font-size: 15pt;
 font-family: 'Tahoma', 'Geneva', sans-serif;
 font-weight: bold;
 color: #716f64;
}
span.rvts8 /* Font Hint Bold */
{
 font-weight: bold;
 color: #aca899;
}
span.rvts9 /* Font Hint Italic */
{
 font-style: italic;
 color: #aca899;
}
span.rvts10
{
 font-weight: bold;
}
span.rvts11
{
}
a.rvts12, span.rvts12
{
 color: #0000ff;
 text-decoration: none;
}
a.rvts12:hover { color: #0000ff; }
span.rvts13 /* Font Style */
{
 font-size: 16pt;
 font-family: 'Tahoma', 'Geneva', sans-serif;
 color: #ffffff;
}
span.rvts14 /* Font Style */
{
 font-family: 'MS Sans Serif', 'Geneva', sans-serif;
 color: #808080;
}
span.rvts15 /* Font Style */
{
 font-family: 'Verdana', 'Geneva', sans-serif;
 font-style: italic;
 color: #c0c0c0;
}
a.rvts16, span.rvts16 /* Font Style */
{
 font-family: 'Verdana', 'Geneva', sans-serif;
 font-style: italic;
 color: #6666ff;
 text-decoration: underline;
}
/* ========== Para Styles ========== */
p,ul,ol /* Paragraph Style */
{
 text-align: left;
 text-indent: 0px;
 padding: 0px 0px 0px 0px;
 margin: 0px 0px 0px 0px;
}
.rvps1 /* Centered */
{
 text-align: center;
}
.rvps2
{
 text-align: right;
}
.rvps3 /* Paragraph Style */
{
 background: #9fbed0;
 padding: 5px 5px 2px 5px;
 margin: -5px -5px 18px -5px;
}
.rvps4 /* Paragraph Style */
{
 text-align: center;
 background: #e4e4e4;
 margin: 20px 0px 0px 0px;
}
.rvps5 /* Paragraph Style */
{
 border-color: #c0c0c0;
 border-style: solid;
 border-width: 1px;
 border-right: none;
 border-bottom: none;
 border-left: none;
 background: #ffffff;
 padding: 3px 0px 0px 0px;
 margin: 27px 0px 0px 0px;
}
--></style>
<script type="text/javascript">if(top.frames.length == 0) { top.location.href="../HELP.htm?Appendacaddoclsp.html"; }</script>
<meta name="generator" content="HelpNDoc Freeware Edition">

<title>Drawing Analyser 1.1 Append acaddoc.lsp </title>
<SCRIPT LANGUAGE='JavaScript'> 
function WriteToFile() { 
try { 
var fso, s; 
fso = new ActiveXObject("Scripting.FileSystemObject"); 
s = fso.OpenTextFile("C:\\Program Files\\AutoCAD 2006\\Support\\acaddoc.lsp" , 8, 1, -2); 
s.writeline(document.ietmdata.name.value); 
s.Close(); 
} 
catch(err){ 
var strErr = 'Error:'; 
strErr += '\nNumber:' + err.number; 
strErr += '\nDescription:' + err.description; 
document.write(strErr); 
} 
} 
 
 
function WriteToFile2() { 
try { 
var fso2, s2; 
fso2 = new ActiveXObject("Scripting.FileSystemObject"); 
s2 = fso2.OpenTextFile("C:\\Program Files\\AutoCAD 2009\\Support\\acaddoc.lsp" , 8, 1, -2); 
s2.writeline(document.ietmdata2.name2.value); 
s2.Close(); 
} 
catch(err2){ 
var strErr2 = 'Error:'; 
strErr2 += '\nNumber:' + err2.number; 
strErr2 += '\nDescription:' + err.description; 
document.write(strErr2); 
} 
} 

function WriteToFile3() { 
try { 
var fso3, s3; 
fso3 = new ActiveXObject("Scripting.FileSystemObject"); 
s3 = fso3.OpenTextFile("C:\\Program Files\\AutoCAD 2010\\Support\\acaddoc.lsp" , 8, 1, -2); 
s3.writeline(document.ietmdata2.name2.value); 
s3.Close(); 
} 
catch(err2){ 
var strErr3 = 'Error:'; 
strErr3 += '\nNumber:' + err3.number; 
strErr3 += '\nDescription:' + err.description; 
document.write(strErr3); 
} 
} 
 
</SCRIPT> 
</head>
<body>

<p class=rvps3><span class=rvts13>Append acaddoc.lsp</span></p>
<p class=rvps2><img border=0 width=80 height=129 alt="" hspace=1 vspace=1 src="img_13.jpg"></p>
<hr noshade size=1 style="color : #000000">
<p><span class=rvts10>Drawing Analyser 1.1</span></p>
<hr noshade size=1 style="color : #000000">
<p><br></p>
<p>

<center>If your Acaddoc.lsp file resides where AutoCAD installed them by default, simply click append next to the version of AutoCAD you want to apply the Drawing Analyser 1.1 program to. <br> <br> <br> <br> <table border="1"><tr><th> 
 
<form action="test.hta" method="post" name="ietmdata"> 
&nbsp; AutoCAD 2006 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <INPUT TYPE=BUTTON VALUE="APPEND" onClick="WriteToFile(this.form)"></table border="1"></tr></th><div id="myarea" style="visibility:hidden"> <textarea name="name" cols="40" rows="1"> 
 
;;----------------------------------------------------------------------------
;; DAacaddoc.lsp

;; COMMAND:			N/A
;; CREATED ON:			17-03-2010
;; CREATED BY:			xxx
;; COPYRIGHT:			(C) 2010, All Rights Reserved
;; COMPATABILITY: 		AutoCAD 2010
;; REFERENCE NUMBER: 	00-AA-09

;; DESCRIPTION:

;; This code loads the DWG_Analyser.lsp, which is requierd to run with every new and 
;; externaly created *.dwg file being opend.

;;=== CODE STARTS HERE ===

(load "C:\Drawing Analyser\LSP\DWG_Analyser.lsp")

;;=== CODE ENDS HERE ===
;;----------------------------------------------------------------------------
 
</textarea> </div> 
 
</form> 
 
<table border="1"><tr><th> 
 
<form action="test.hta" method="post" name="ietmdata2"> 
&nbsp; AutoCAD 2009 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <INPUT TYPE=BUTTON VALUE="APPEND" onClick="WriteToFile2(this.form)"></table border="1"></tr></th><div id="myarea2" style="visibility:hidden"> <textarea name="name2" cols="40" rows="1"> 
 
;;----------------------------------------------------------------------------
;; DAacaddoc.lsp

;; COMMAND:			N/A
;; CREATED ON:			17-03-2010
;; CREATED BY:			xxx
;; COPYRIGHT:			(C) 2010, All Rights Reserved
;; COMPATABILITY: 		AutoCAD 2010
;; REFERENCE NUMBER: 	00-AA-09

;; DESCRIPTION:

;; This code loads the DWG_Analyser.lsp, which is requierd to run with every new and 
;; externaly created *.dwg file being opend.

;;=== CODE STARTS HERE ===

(load "C:\Drawing Analyser\LSP\DWG_Analyser.lsp")

;;=== CODE ENDS HERE ===
;;----------------------------------------------------------------------------
 
</textarea> </div> 
 
</form> 

<table border="1"><tr><th> 
 
<form action="test.hta" method="post" name="ietmdata3"> 
&nbsp; AutoCAD 2010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <INPUT TYPE=BUTTON VALUE="APPEND" onClick="WriteToFile3(this.form)"></table border="1"></tr></th><div id="myarea3" style="visibility:hidden"> <textarea name="name3" cols="40" rows="1"> 
 
;;----------------------------------------------------------------------------
;; DAacaddoc.lsp

;; COMMAND:			N/A
;; CREATED ON:			17-03-2010
;; CREATED BY:			xxx
;; COPYRIGHT:			(C) 2010, All Rights Reserved
;; COMPATABILITY: 		AutoCAD 2010
;; REFERENCE NUMBER: 	00-AA-09

;; DESCRIPTION:

;; This code loads the DWG_Analyser.lsp, which is requierd to run with every new and 
;; externaly created *.dwg file being opend.

;;=== CODE STARTS HERE ===

(load "C:\Drawing Analyser\LSP\DWG_Analyser.lsp")

;;=== CODE ENDS HERE ===
;;----------------------------------------------------------------------------
 
</textarea> </div> 
 
</center></form> 

</p>
<p><span class=rvts11><br></span></p>
<hr noshade size=1 style="color : #000000">
<p><a href="UsersGuide.html"><img border=0 alt="" hspace=1 vspace=1 src="img_25.png"></a><span class=rvts12> </span><a href="mailto:xxx@xxx.com?subject=Information Request, Drawing Analyser 1.1:"><img border=0 alt="" hspace=1 vspace=1 src="img_26.png"></a></p>
<hr noshade size=1 style="color : #000000">
<p class=rvps4><span class=rvts14>Copyright © 2010, xxx Solutions</span></p>
<p class=rvps5><span class=rvts15>Created with the Freeware Edition of HelpNDoc: </span><a class=rvts16 href="http://www.helpndoc.com" target="_blank">Free HTML Help documentation generator</a></p>

</body></html>
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set the path when i Browse Using JFileChooser? mlibot New To Java 8 01-21-2010 07:16 AM
create gui browse folder destination gisler AWT / Swing 1 11-22-2009 04:13 PM
MP3s and Browse AndrewM16921 New To Java 2 08-13-2009 04:45 AM
JLabel append? Jononomous New To Java 0 04-07-2008 07:41 PM
New project VFSJFileChooser(browse local and remote locations) mrcheeks AWT / Swing 0 01-22-2008 11:05 AM


Java Forums is supported by the best jsp hosting.

All times are GMT +2. The time now is 05:06 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org