cp4w wrote:hello,
What would be the best way to set up a Neobook application.
It would seem that if the application would want to write and read data it would use the[pubdir] variable to write and read from the folder is executing from.
But correct me if I am wrong, that could cause problems because the user would have to be an administrator to write to the program files folder.
Wouldn't it be better to somehow write to a folder in "programdata".
and if so, is there a variable to support this?
how is this being handled?
If you try to write directly to a Program Files folder (or Program Files x86 folder) where your PubDir might be stored, you may get an "access denied" error (and your program won't work). The Windows Temp folder should be used to write and read temporary files. The example below writes to the Windows Temp folder and then reads back the file. It sets the Windows Temp folder as the current directory and uses DOS to write a file (test.txt) of the directory to the Windows Temp folder.
- Code: Select all
SetVar "[CurrentDir]" "[TempDir]"
DOSCommand "dir" "> %~p0test.txt" "Normal"
TextWindow "" "-1" "-1" "450" "500" "%~p0test.txt" "Wordwrap"
Notice the %~p0 before the filename. It is the path to the new file we just wrote.
Windows uses two directories: one that contains the program, and one that contains the file to write or read to.
In fact, you can be in a third directory and call a program from one directory to write or read to another directory.
Of course you will normally use the Neobook [FileWrite] or [ExtractFile] actions. For example:
- Code: Select all
FileWrite "[TempDir]test.txt" "All" "Some Text"
TextWindow "" "-1" "-1" "450" "500" "[TempDir]test.txt" "Wordwrap"
.