IO (Input/Output) Library Elements

General

The Input/Output section of the library elements contains many additional functions available in Soley Studio that are not part of the original GrGen in-built functions.
Input/output operations are available for project paths and for files. You can call, create, write on, and delete external files using these functions.

Find an example of how to use these functions here.

Library elements for Input/Output actions

There are following helper library elements available for files and projects:

For project paths:

NameDescription
IO_combineIntoPathcombines two strings into a full path and returns it
IO_getProjectFullPathreturns a full path to a file or a folder relative to the project.
IO_getProjectPathreturns a full path to the project’s folder

For files (see this article for an example):

NameDescription
IO_appendTextToFileThis procedure opens a file given a specified path, appends the text at the end of it and closes it. If the file does not exist, then it creates a new one.
IO_closeFileThis procedure closes a file that was opened before.
IO_deleteFileThis function deletes a file by the specified path.
IO_fileExistsReturns boolean true if a file exists by the given path. Else returns false.
IO_openFileThis function opens a file and returns it as an object. If the file does not exist, it will create a new one.
IO_readFileLinesThis function opens a file, reads its content, closes the file and returns the content as an array of strings (a string for each line)
IO_readFileText This function opens a file, reads its content, closes the file and returns the whole content as a single string
IO_readGraphFromFileThis function opens a file, reads its content, closes the file and returns the content as a graph.
IO_writeCurrentGraphToFileThis function opens a file, writes the current host graph to it and closes it. If the file already exists then it will be overwritten.
IO_writeFileThis procedure writes text to an open file. In comparison to IO_writeTextToFile, it requires the opening of the file before, and its closing after.
IO_writeGraphToFileThis function opens a file, writes the graph to it and closes it. If the file already exists it will be overwritten.
IO_writeLineFile This procedure writes a line to a file and appends a newline at the end. It is similar to IO_writeFile, only the text is written on the same line as the existing text but on a new line.
IO_writeTextToFileThis procedure opens a file given a specified path, writes the text to it and closes it. If the file does not exist, it creates a new one. If it does, it overwrites it.

Further Information

If these functions do not fit your needs, you can have a look at the Global Function section of the Soley Help Center.

Was this article helpful?

Related Articles