How read my file inside my project (Drag&Drop)?

Hi, I Drag & Drop my CSS directory inside my XoJo project.
Inside CSS directory I have two files: “index.html” and “scr.js”.

First question:
how write the code for read my index.html ?
See the code in attachment image

Second question: is normal .html and .js are hide in XoJo progect ?
See the attachment again

I need to keep the src.js file inside the project because I will have to modify it during the program (at runtime).

When you drop a file in the IDE, it becomes a string literal with the name of the file minus the extension. So, yes, it is normal for the .js to be removed. You can access it directly by name like any other string variable.

Edit: I just saw your comment about needing it as a file at runtime. Use a Build Step to copy the files into the built app. Note, however, that you should copy them at run time to ApplicationSupport (if they are not already there) and modify them there. You most likely won’t be allowed by the OS to modify the files inside your app’s folder.

What’s the 1000-foot view of what you’re trying to do?

Yes, in fact I’m off track. You are right.

It is better that:

  1. at program start, create two files and save them in the FolderItem (" ").Child(“CSS”)
  2. at runtime I modify them as needed, and then I will read them whenever I need them :slight_smile: .

Thanks (quick help!).

Just be aware that FolderItem("").Child(“CSS”) may not be a writable location. It would be better to use SpecialFolder.ApplicationData.Child(“my app”).Child(“CSS”).

1 Like