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:

String concatination in Activ Script


 
pborow I'm new to Activ Script but have some experience with other scripting languages.

I would like to format the text returned in a MESSAGEBOX; simple things like a blank line between two statements.

For example, some languages allow the following:

MESSAGEBOX('String 1' + chr(13) + chr(13) + 'String  2'), which yields two lines of text separated by a blank line.

How might this be done in ActivScript?

Thanks


Posted on: 1:21 pm on April 25, 2006
mythos
In your case, you can set a variable to be a blank string expression, something like this:

<script>
window.external.ActivSet( 'nothing', ' ' ) ;
</SCRIPT>

MESSAGEBOX('{String1}{nothing}{String2}')

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

There are a number of formats that are allowed for string expressions:

Single Quotes

If you enclose a string in single quotes, then Activ Variables within the string, that are enclosed in curly braces ({}), will be expanded into their values.

For example, the following statement, will display the title of the E-Book in a message box:

MESSAGEBOX('{title}')


Note: The string may contain multiple Activ Variables, and may also contain other text, so the following is also perfectly valid:

MESSAGEBOX('The title of this E-Book is {doublequote}{title}{doublequote}')


Non Expanding Quotes

If you enclose a string in single quotes, preceded by a tilde character (~), then Activ Variables are not expanded.

For example, the following statement, will actually display {title} in a message box:

MESSAGEBOX(~'{title}')


Numerical Expressions

It is actually possible to use a numerical expression in places where a string expression would be required. The numerical expression will be evaluated, and the result value converted into a string.

For example, the following statement, will display the number 4 (the result of evaluating 2+2 as a numerical expression and converting the result value to a string), in a message box:

MESSAGEBOX(2+2)

In contrast, the following statement will actually display 2+2 in a message box:

MESSAGEBOX('2+2')


Posted on: 3:33 pm on April 25, 2006
mythos Or something like this might be better:

----------

SCRIPT
var getit = ('String 1' + chr(13) + chr(13) + 'String  2'),
window.external.ActivSet( 'showit', getit ) ;
/SCRIPT

MESSAGEBOX('{showit}')

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

showit will be expanded into its value.


Posted on: 3:41 pm on April 25, 2006
mythos
Actually, line breaks  br >  in script alerts and confirm boxes are     \n\n

Some programming languages will use  |   for a line break.

I'm not sure what Activ Ebook uses for a line break in its message boxes - I haven't found it yet either...


Posted on: 4:11 pm on April 25, 2006
mythos
OK I finally got it... Here's the one that actually works:
---------


<.SCRIPT>
var getit="String 1" + "\r" + "\r" + "String 2" ;
window.external.ActivSet( 'showit', getit ) ;
<./SCRIPT>
<.A HREF="##MESSAGEBOX('{showit}')">Click Here<./A>

---------
(to use it remove .dots from tags)


Posted on: 4:44 pm on April 25, 2006
mythos
Of course you can shorten the code by using only the JavaScript alert:

<.SCRIPT>
var getit="String 1" + "\r" + "\r" + "String 2" ;
alert(getit);
<./SCRIPT>

But the Activ Ebook messages are like those in Visual Basic: You can use four different icons and up to seven different button values. Well worth the extra lines of code!


Posted on: 5:41 pm on April 25, 2006

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