Source language: Translate to:

Pipe Symbol

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Pipe Symbol

Postby Wrangler » Tue Feb 15, 2011 10:46 am

Neobook's use of the pipe symbol when reading and writing files is a pain in the butt. I'm trying to code a simple file merge:

FileErase "[pubdir]Quiz 1 - 1000\miscellaneous.dat"

FileList "[pubdir]Quiz 1 - 1000\*.txt" "Files" "[files]"
StrParse "[files]" "[#13]" "[part]" "[numparsed]"

Loop "1" "[numparsed]" "[x]"
../ remove first 2 lines in file
FileDelLine "[pubdir]Quiz 1 - 1000\[part[x]]" "1"
FileDelLine "[pubdir]Quiz 1 - 1000\[part[x]]" "1"
FileToVar "[pubdir]Quiz 1 - 1000\[part[x]]" "[data]"
StrReplace "[data]" "|" "[#13][#10]" "[data2]" ""
FileWrite "[pubdir]Quiz 1 - 1000\miscellaneous.dat" "Append" "[data2]"
endloop

It works fine except it puts the pipe symbol in for a carriage return when writing the file. Note the strreplace didn't work because all this goes on when WRITING THE FILE. The only workaround I see is reading each file line for line and writing line for line. Not very efficient when you have a couple hundred files.

So I guess my question is, why can't nb write carriage returns properly to a text file? Can this be addressed in the next update?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Neosoft Support » Tue Feb 15, 2011 11:21 am

Try this:

FileWrite "[pubdir]Quiz 1 - 1000\miscellaneous.dat" "Append" "![data2]"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Wrangler » Tue Feb 15, 2011 11:25 am

OK. Is there any reason nb can't do it without us having to remember the exclamation point? It doesn't appear to be documented anywhere.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Using help file

Postby virger » Tue Feb 15, 2011 1:02 pm

I use all time; Neobook, has a good help.

In the section, Action Command Reference, Variables, you can read:

Normally, if value contains a valid mathematical formula, NeoBook will compute the formula and store the results in the variable. If for some reason, you want the variable to contain the actual formula instead of formula's computed result, insert an exclamation point “!” at the beginning of value. For example, the following statement:

SetVar "[Test]" "1+1"

will set the variable [Test] to "2". This is because NeoBook knows that "1+1" is a mathematical equation and adds the two numbers together. By adding an exclamation point you can instruct NeoBook to ignore the formula. For example:

SetVar "[Text]" "!1+1"

will set the variable [Test] to "1+1". (Note: The exclamation point is removed by NeoBook.) You can use this technique in any NeoBook Action where numeric parameters are allowed.


Maybe I help you

PURA VIDA
DESDE COSTA RICA
OXIGENANDO AL MUNDO
User avatar
virger
 
Posts: 523
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests