eBook authors eBook Software - create and publish your own ebooks
Create your own eBooks
 
   
EBookApprentice.com
Learn How To Create, Publish & Market E-Books
 
   
EBookCompiler.com
E-Book Creation Software
 
   
EBookPower.com
Add sophisticated multimedia to your E-Books
 
   
CoverFactory.com
Create E-Book covers in minutes
 
 
  EBookSubmit.com
E-Book Marketing & Promotion made easy
 
  EBookJungle.com
Search engine for E-Books
 
  EBookInterviews.com
Interviews with eBook authors
 
  EBookEnhance.com
Tools for building better eBooks
 
 
 
Archived Message:

File Statements


 
Grandmaster Does anyone here know how to effectively use the new forms feature of the new beta version to write to text files?
I've tried using the file statment FILEWRITE without success.

Posted on: 5:40 pm on March 23, 2002
EBookCompiler index.htm

<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="#!writefile.as">
Name<BR>
<INPUT TYPE="TEXT" NAME="fname" SIZE=32>
<BR><BR>
Address 1<BR>
<INPUT TYPE="TEXT" NAME="faddress1" SIZE=32>
<BR><BR>
Address 2<BR>
<INPUT TYPE="TEXT" NAME="faddress2" SIZE=32>
<BR><BR>
City<BR>
<INPUT TYPE="TEXT" NAME="fcity" SIZE=32>
<BR><BR>
State<BR>
<INPUT TYPE="TEXT" NAME="fstate" SIZE=2>
<BR><BR>
ZIP<BR>
<INPUT TYPE="TEXT" NAME="fzip" SIZE=10>

<BR><BR>
<INPUT TYPE="SUBMIT" VALUE=" OK ">
</FORM>
</BODY>
</HTML>

writefile.as

REM next line necessary for 4.20 (see note in README)
SET('bok',0)

REM retrieve fields from form in Activ Variables of same name
FSET('fname','fname')
FSET('faddress1','faddress1')
FSET('faddress2','faddress2')
FSET('fcity','fcity')
FSET('fstate','fstate')
FSET('fzip','fzip')

REM build a long string of the text
SET('longstr','{fname}{return}{linefeed}')
SET('longstr','{longstr}{faddress1}{return}{linefeed}')
SET('longstr','{longstr}{faddress2}{return}{linefeed}')
SET('longstr','{longstr}{fcity}{return}{linefeed}')
SET('longstr','{longstr}{fstate}{return}{linefeed}')
SET('longstr','{longstr}{fzip}{return}{linefeed}')

REM prompt for file name
FILESAVEPROMPT('bsave','filepath','Save Address Info','','')
IF({bsave})
      FILEWRITE('bok','{filepath}','{longstr}')
      MESSAGEBOX('bok is {bok}')
      IF({bok})
              MESSAGEBOX('File saved okay')        
      ELSE
              MESSAGEBOX('File save error')        
      ENDIF
ELSE
       MESSAGEBOX('The address was not saved')
ENDIF


Note:

SET('bok',0) is necessary because in 4.00, 4.01 and 4.20 (not 4.21) expressions in nested/conditional statements are still evaluated even though the rest of the code doesn't execute.  This is fixed in 4.21, so in 4.21 you can delete this line.

(If you've ever used some UNIX shell scripts, you're probably familiar with a similar "feature"


Posted on: 2:14 am on March 26, 2002
Grandmaster Thanks you so much for this script.  It's a life saver. I started playing with it with the aid of the help file.
I added on to it with success.
I have recently download the beta version of 4.20.  I wasn't aware that there was a 4.20  Is this is the non-beta version of 4.20.
Thanks again.
This script helped me to understand Active Script a little better. NOw I'm going to find a way to get the information that is posted in a form to be displayed... kind of a database type thing.

Posted on: 4:40 pm on March 26, 2002
EBookCompiler 4.20 is still beta (see the thread with 4.20 in the title)

In next day or two, we will have 4.21 *beta* ready.  4.21 beta basically fixes the bugs that were found in the 4.20 beta

4.21 beta is also a "release candidate".  This means if the beta performance is satisfactory, then it will become the official release.  If it isn't then we repeat the cycle and going to 4.22.


Posted on: 1:45 am on March 27, 2002
Grandmaster Ok. Very Good. These are bugs I haven't found myself. Can't wait to download it and try it out too.
BTW, I made a script that utilized the FILEEXIST and the FILEREAD statements that were successful.
But I can only make the contents of a text file display in a message box and not back on an html page or back in the form text boxes for editing ease.
I've been checking out some VBscript tutorials. I've "messed" around with VB6 before. I probably should try to use Jscript since I've done more with javascript than I have with microsoft languages.
I just want to know more about VB script because it looks so easy to use.

Posted on: 12:40 pm on March 27, 2002
EBookCompiler Try using DISPLAY

Build a long string with all the HTML tags (including the HTML header etc) and then use DISPLAY

or

Try creating a temporary file containing the HTML and use NAVIGATE or NAVIGATEEXT to display it.  For NAVIGATE make sure the file is in the {ebook} directory.  For NAVIGATEEXT make the file anywhere, but include the full path in the parameter

A good cheat method is to include 1 or 2 extra sort of "template" files on your source folder, these contain the top and bottom of the HTML page.  Read these in, and add your stuff in the middle before using DISPLAY/NAVIGATE/NAVIGATEEXT.  If these extra template files are in your source folder, don't end their names with .htm or .html if you have Security for HTML files set to High (Advanced Security) or else you won't be able to read them using FILEREAD


Posted on: 4:19 pm on March 27, 2002
Grandmaster I've managed to have the variables displayed back into a form for editing purposes. (retrieving the data and placing the information back into a form for editing)
Now I've got a new question. I know you're a busy man and I'm trying not to bother you too much... but
I'd like to APPEND the data into db file. So far, I've decided hold the information in .as files rather than txt files.
The problem is FILEWRITE over writes the information with new information that I input.
How could I append this information at the end of the file (adding to what's already there)???


Posted on: 6:28 am on April 1, 2002
EBookCompiler Read in the old info into a string using FILEREAD
Add the new stuff on the end
Write it out with FILEWRITE

or

Another way would be to store all the parameters in a INI format file.  You could have set an item called COUNT which had the total number of items, then use item 1, 2, 3, etc. to store the items

or

Both the above would work if this is not too demanding an application.  If you have a lot of data or need speed, a better solution might be to use an external program, or the API to write the file handling stuff in a conventional programming language.  Using the API (if the language is C++) you can call the file writing functions from Activ Script, or you could use the RUN command to run the programs to do the adding, etc.


Posted on: 4:14 am on April 2, 2002

Go to Active Discussion Thread

Participate in Current/New Discussions

List All Archived Forums



Copyright © 2000-2015, Answers 2000 Limited.

With any business, it is up to the individual owner of said business to ensure the success of the business. You may make more or less than any sample figures or results that might be quoted on our web sites or other publications. All business involves risk, and many businesses do not succeed. Further, Answers 2000 Limited does NOT represent that any particular individual or business is typical, or that any results or experiences achieved by any particular individual/business is necessarily typical.

Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures

Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy.

Contact Us    About and Terms Of Use    Privacy    Advertising/Endorsements Disclosures