How to open subfolders of a CD or a disk?
- I want to create a compiled website on a CD; the .exe is in the root of the CD and this website needs to open subfolders of the CD in Windows Explorer.
- How can I do that?
This can be made without any problem, but you need to make some changes to your HTML code. The best would be to use a HEScript script function. This function would be invoked from your HTML code: it will open the subfolder you specify with a parameter.
Just follow these steps:
- We create the HEScript function. Open your HTML Executable project and select the "Behavior & Scripting" tab.
Then double-click on the "UserMain" script to open the script editor as shown on the figure.
- Add this function code:
procedure OpenSubFolder(FolderName: String);
var
EbookPath, MyFolder: String;
begin
EbookPath := GetGlobalVar("HEPublicationPath", "");
MyFolder := EbookPath + FolderName + "\";
OpenFile(MyFolder, "", SW_SHOWNORMAL);
End;
- Choose Save & edit the HTML page with the links that should open the subfolders. Just replace the links with that code.
For instance, you have this CD structure:
ROOT
Mycompiledwebsite.exe (the compiled .exe file)
--
Folder1
--
Folder2
If you want a link that opens "
Folder1", use this HTML code:
<a href="hescript://UserMain.OpenSubFolder|Folder1">Open Folder 1</a>
Just specify the name of the folder after the | character. Note that folders shouldn’t have spaces (or use the %20 characters like for URLs).
Compile your project and that's all.