How to open a txt file

I believe he wants to Launch the file

then use the “launch” function of the folderItem
but it will only “launch” if there is an associated app defined to the operating system

Before the screen shot, I was starting to think at a joke.

Luka: try to really explain what you want to do. With what you wrote it is absolutely impossible to understand what you want to do.

@Sasha: I forgot about this :wink:

There are multiple ways to use external TXT Files with your project. I’d say the 3 main methods are:

  1. Drag & Drop a Textfile into your Project in the Xojo Development IDE. Xojo will create a Constant which can be accessed in Code and IDE via the Name in the Navigator (which can be altered in the Ide).
  2. Copy a TXT File into the Project Folder. Add a CopyFile Step to the Build Process and access the TXT File with Code like the one i posted above.
  3. Resolve the native Path to real TXT File with a FolderItem and launch it. This will open the TXT File with the App the OS asociates with TXT Files.

At this point, we do not really know what you are trying to achive. Please try to explain it with other words or more screenshots or a video? :slight_smile:

… and if this is really a Read Me file, I am sure that you will want to have styled text, not raw text … once you read this message (or once the current feature is done). This kind of things often happens to me.

Drag the file called readme.txt into your project

In your ‘ReadMe’ menu item event, you create the file if it does not exist, write the contents to it, and then launch it.
It will open IF your system has a way to open TXT files automatically

The code in your menu could look like this:

[code]Dim t As TextOutputStream
Dim f As FolderItem = specialfolder.documents.child('myapp_readme.txt")

If f <> Nil Then
If f.Exists Then

//do nothing
else

Try
  t = TextOutputStream.create(f)
  t.writeline   readme   //readme is how the readme.txt file will be known if it is embedded in your project
 t.close
 Catch 
     MsgBox("Error accessing file.")
End Try

End If

End If
if f.exists then f.launch[/code]

You can use the same method to create an RTF file, with styled data, or an HTML file.
If you have a website, you might just launch a URL if you can assume that people have an internet connection.