Page 1 of 1

No pipe with [#124]

PostPosted: Sat Feb 17, 2007 6:54 am
by Dorjee
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.

PostPosted: Sat Feb 17, 2007 7:08 am
by Gaev
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.

Solution !

PostPosted: Sat Feb 17, 2007 10:36 am
by Dorjee
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!

PostPosted: Sat Feb 17, 2007 12:38 pm
by Gaev
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.