Is there any way to read files in DXScript?

Where can you use "Custom Files"?

Is there any way to open and read a text file from inside of DXScript? If not, what can you really do with the "Custom Files" that you can add on the summary page?

Thanks, anyone
3,738 views 2 replies
Reply #1 Top
You can do this very easily. Simply use the FileScriptingObject TextStream.

For example:

Dim FSO
Dim textStream

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

'Called when the script is executed
Sub Object_OnScriptEnter
Set FSO = CreateObject("Scripting.FileSystemObject")
Set textStream = FSO.OpenTextFile("c:\temp\mytextfile.txt", ForReading, -2)
textdata = textStream.ReadAll()
msgbox textdata
Set textStream = Nothing
Set FSO = Nothing
End Sub

Docs on this are readily available on the web, just search Google.

As for other things you can use Custom Files for:
attach a PDF as a help file for your object.
Add images that can be assigned to objects under certain circustances.
etc etc
Reply #2 Top
Thanks for the help. The docs that I had tried to use before your post left something out and I was getting script errors.