Page 1 of 1

Embedded Text Files

PostPosted: Tue May 02, 2017 12:52 pm
by StarterPack
Guys, Im missing something here.
When I'm still in my NB program and [Embedded] a Text File. I can read the [Embedded]Libraries.txt file into a ListBox.
But when I compile my program, I get an error message "Cannot open file *C:\embedded:\Libraries.txt. The filename, directory name, or volume label syntax is incorrect"

On Startup ( Page Enter ) I use: FileRead "[Embedded]Libraries.txt" "All" "[ListBox]"

Any Suggestions

Re: Embedded Text Files

PostPosted: Tue May 02, 2017 2:44 pm
by HPW
Hello,

Have you embed your Libraries.txt in Book\EmbedddFiles\ properly?
Does the file still in that path used in the embedd-dialog?

The global var [Embedded] translates to 'embedded:\\\' which tell neobook to read from internal file-System.

Regards

Re: Embedded Text Files

PostPosted: Tue May 02, 2017 3:31 pm
by Gaev
But when I compile my program, I get an error message "Cannot open file *C:\embedded:\Libraries.txt. The filename, directory name, or volume label syntax is incorrect"

On Startup ( Page Enter ) I use: FileRead "[Embedded]Libraries.txt" "All" "[ListBox]"

Not clear if you get the error message at compile time ... or when you invoke your .exe file (and NeoBook tries to service the FileRead command).

Note that when you test your .pub (using F8, F9 or F10), Neobook does not bother embedding the files ... it uses the external file specified using menu Book >>> Embedded Files ...

Also not clear if your FileRead is in the Startup or PageEnter section of your pub ... note that when you test using F8 or F10, the Startup section code is NOT invoked ... so if it is in the Startup section, you need to test it with F9 to have the command invoked/serviced.

Re: Embedded Text Files

PostPosted: Tue May 02, 2017 10:42 pm
by StarterPack
Hi HPW and Gaev

Thanks for the reply

Yes, I've Embedded the file in Book\Embedded Files\Libraries.txt properly and the error is not at compile time, but when i invoke (run) my .exe
Also I moved my FileRead "[Embedded]Libraries.txt" "All" "ListBox" from PageEnter to a button, but it still gives me the error when i press the button.

Also I just start a new pub, with a button and ListBox and [Embedded]Libraries.txt to test if it's something else in my program that prevent it to read into ListBox, but that also gives me the error. Can [Embedded].txt files been read into ListBox?

Maybe i must just extract the file first and then read from there.

Re: Embedded Text Files

PostPosted: Tue May 02, 2017 11:22 pm
by HPW
Hello,

Maybe this helps from the doc:

FileToVar
Purpose: Read the contents of a file into a variable. This is similar to using FileRead with the “All” option, but unlike FileRead, FileToVar can be used with Embedded files.


Regards

Re: Embedded Text Files

PostPosted: Wed May 03, 2017 7:17 am
by StarterPack
HPW..... EXCELENT!!!

Thank You!