Source language: Translate to:

No pipe with [#124]

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

No pipe with [#124]

Postby Dorjee » Sat Feb 17, 2007 6:54 am

Hi!

I created an HTML code generator and I want to generate the code below:

Code: Select all
var DHTML = (document.getElementById || document.all || document.layers);


The problem is that of the pipe characters |. The classic solution is to use the entity [#124]. That gives:

Code: Select all
SetVar "[Html]" "[Html]var DHTML = (document.getElementById [#124][#124] document.all [#124][#124] document.layers);[#13][#10]"


The problem now is that NB does not interpret [#124] as |, but as a break line, so the code generated is:

Code: Select all
var DHTML = (document.getElementById


document.all


document.layers);


So my DHTML don't work with that kind of empty lines! :cry:

Any solution? Thanks in advance.
Dorjee the Neobooker
Dorjee
 
Posts: 27
Joined: Thu Nov 17, 2005 12:15 am

Postby Gaev » Sat Feb 17, 2007 7:08 am

Dorjee:

Try ...
Code: Select all
SetVar "[Html]" "![Html]var DHTML = (document.getElementById [#124][#124] document.all [#124][#124] document.layers);[#13][#10]"

The ! character before the "[Html]var DHTML = ..." tells NeoBook to use the remaining content for this parameter AS IS ... i.e. no Math or any other type of interpretation of the content.
User avatar
Gaev
 
Posts: 3734
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Solution !

Postby Dorjee » Sat Feb 17, 2007 10:36 am

Thanks for the suggestion!

So the ! character put where you said does not work at all, the result is the same.

I tested some tricks. First I saw that the displaying of the [Html] variable in a Text shows | character for the [#124] entity.

After several tests I guess that the problem is with the FileWrite command:

Code: Select all
FileWrite "temp.html" "All" "[Html]"


Because the misinterpretation is made in the temp.html file. Suddenly an idea... and I tried your suggestion in this command, puting ! character just before the name of the variable for FileWrite considers this variable AS IS...

Code: Select all
FileWrite "temp.html" "All" "![Html]"


... and it works fine! :D

What is strange is that the other entities like [#34], [#10], etc. don't need the as-ising of the variable. Why only [#124]? Mysterious...

Thanks again, bye!
Dorjee the Neobooker
Dorjee
 
Posts: 27
Joined: Thu Nov 17, 2005 12:15 am

Postby Gaev » Sat Feb 17, 2007 12:38 pm

Dorjee:
What is strange is that the other entities like [#34], [#10], etc. don't need the as-ising of the variable. Why only [#124]? Mysterious...

NeoBook interprets the pipe character ("|") as a new line ... so you need to tell it to NOT do this by prefixing the parameter content with the "!" character.

Generally, there is no harm in specifying this prefix whenever in doubt ... other places where it comes in handy is in something like ...
Code: Select all
SetVar "[myDate]" "2/17/2007"

... where NeoBook will try and do math on the second parameter i.e. 2 divide by 17 divide by 2007 ... and store a very small number in the variable [myDate].

Also, when specifying URL values like http://www.abc.com/xyz.htm.
User avatar
Gaev
 
Posts: 3734
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 2 guests