I am reading and writing to a file created by the eBook and all is well under XP. However, if the setup program is run under Windows 7 (administrator of course, to be able to run setup) I can’t access the file to write to (although reading is fine), when logged on as another user.
Does anyone know the Delphi/HRML Executable call to set the file permissions to read/write for anyone. I could do this at setup time if necessary.
It can work on Windows 7 if you do not write the file in restricted areas like C:\Program Files…
HTML Executable provides you with a storage folder where you are sure that you can always write and read data for your publication.
The location to the storage folder is available in the HEPubStorageLocation variable.
See the doc at: http://www.htmlexe.com/help/samplescript3 and http://www.htmlexe.com/help/globalvariables
Your solution works fine but this was part of a larger problem.
The data in the file mentioned above is used by the eBook and is read and written by the user at any time.
Now, when we upgrade their system say from version 12 to version 13 we will want to save their date from the previous version to be used in the next. I can create javascript buttons to save and retrieve the files OK but I am having problems knowing where to put them (in some sort of common or shared area that both versions have read/write access to) so that they are available to both versions. The storage area you mentioned is not used when a new version is loaded and the HEPublicationPath is not writeable by a non-administrative user.
This problem only applies to users running the eBook who are not administrators. Any answer to this or any other solution gratefully accepted.
Does this mean that clients who are accessing the eBook from a windows 7 user which is not set up with administrator rights, will be able to read and write to files in this area?
Does it also mean that the distributed version we sell has to be installed as a ‘Portable’ version?
Sorry to confuse you, your quote is only for portable publications. AFAIK, you are not making a portable publication, so the storage folder is on the end user’s hard drive, at a writeable place.
I used this link because in case you are making a portable publication, data is written in the same folder as the EXE file (that’s normal: a portable publication shouldn’t write data on the end user’s computer, but on the device where it is stored, like a USB stick).
But in your case, you don’t make a portable pub, so it won’t happen: the publication will store its data into the storage folder. HTMLExe gives you an option to change the name of this storage folder.
So the question is, is there a folder somewhere where I can write to files that is accessible to both administrator and non-administrator users? Alternatively, is it possible to change permissions on a file to make it writeable for example, in the programme folder?
Yes but when I load a new version of eBook the location will change. I need a known location (that is writeable) I can copy the notes file to from version 12 that can then be read in by version 13 to maintain continuity.
Currently they in locations like this which I don’t know how to find:
You could use the same publication GUID for your two versions, thus the same storage folder will be used:
If you don’t want to have “HTML Executable\UserPublication{3D2A93BF-C54A-40FD-AB4C-75E6F53E6FAB}” but a custom name, like “MyFolder”, enter “MyFolder” here:
Do that for your two publications (old and new one).
Further to this, we need to move the created files to a place the user (who may be on a variety of systems) can read/write to even if they are not administrators and can find easily.
GDG suggested using the My Documents folder which would be ideal. Is there a preset Global Variable I can use to access this location?
ReadRegStr is an HEScript function, so it must be called from an HEScript script.
Please check the documentation about writing HEScript scripts, and calling them from JavaScript.