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:

Advanced Tips


 
Carlos Advanced TIPS:

Did you know that:

1. You already have a FILE OPEN PROMPT to open any file?
Yes, although it's not an Activ Script File Statement the HTML code provides you a way to do this, by using  "<input type=file>".

Example:[code]
<form name="form1">
<input type="file" name="filename">
<input type="button" onClick="openFile(this.form.filename.value)" value="Open a File">
</form>[/code]

Then with a javascript function you can get the data from the file with an Activ Script or just display the contents of the file:

[code]<SCRIPT LANGUAGE="JavaScript">
function openFile(file) {
var fileToOpen = file;

// TO SEE THE FILE THAT WILL BE OPENED
alert("File to open: " + fileToOpen);

// THEN YOU CAN GET DATA FROM FILE USING AN ACTIV SCRIPT
// Add the file name to an Activ variable
window.external.ActivSet( 'FileName', file ) ;
// Read the file
window.external.ActivRun("#!read_file.as";
// Put the data retrieved from the file into a javascript variable
var FileData = window.external.ActivGet('{FileData}');

// Do whatever you want with the FileData variable
... code

// OR OPEN THE FILE CONTENTS IN THE BOOK
window.location= 'file:///' + file;
}
</SCRIPT>[/code]

The read_file.as can be something like:[code]
FILEREAD('isok','{FileData}','{FileName}')[/code]

Notes:
a) This is a simple javascript function. You can have off course code to test if file name is provided and to test if file was successfuly opened.
b) You cannot control the default directory to open the files. User must navigate to the directory to open it.
c) You should also limit the file types to be opened by checking the file extension. This feature allows users to open any type of file.

----------------------

2. INI files can be saved in other locations than the system file?
Just add the Predifined Directories and Drive letters variables before the INI file name.

Example to save the INI file in the the directory where the E-Book EXE file is located:
[code]INIWRITE('John Doe','{app}\userdata.ini','USER DATA','Name')
INIWRITE('johndoe@mail.com','{app}\userdata.ini','USER DATA','Email')[/code]

The ini file will have the following data:
[code][USER DATA]
Name=John Doe
Email=johndoe@mail.com[/code]


Activ Script INI Files Statement
INIWRITE(s1,s2,s3,s4)
s1 is the value to write.
s2 is the name of the INI file.
s3 is the application name to write the key under.
s4 is the key name

-----------------------

3. You can use INIWRITE to save files with a TXT extension?
Just change the .ini extension with .txt in the name of the file.

Example to save a txt file using INIWRITE in the eBook folder:

[code]INIWRITE('John Doe','{app}\userdata.txt','USER DATA','Name')
INIWRITE('johndoe@mail.com','{app}\userdata.txt','USER DATA','Email')[/code]

The beauty of this is that the txt file is saved in the same format as an INI file, in other words, you can store different application names each one with several keys and values. With same immagination and creativity you can create great eBooks with database files, by using this feature.


Note: INIWRITE currently allows you to save files with any extension.


Carlos

(Edited by Carlos at 9:41 pm on Jan. 29, 2003)


Posted on: 9:37 pm on January 29, 2003

Search

List All Archived Forums



Copyright © 2000-2021, 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.

Click privacy for information about our company's privacy, data collection and data retention policies, and your rights.

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