Project#
Singleton for handling the current project. More...
import Script
Properties#
| Name | |
|---|---|
| string | currentDocument | 
| array<string> | documents | 
| string | root | 
Methods#
| Name | |
|---|---|
| array<string> | allFiles(PathType type = RelativeToRoot) | 
| array<string> | allFilesWithExtension(string extension, PathType type = RelativeToRoot) | 
| array<string> | allFilesWithExtensions(array<string> extensions, PathType type = RelativeToRoot) | 
| closeAll() | |
| Document | get(string fileName) | 
| Document | open(string fileName) | 
| openPrevious(int index = 1) | |
| saveAllDocuments() | 
Detailed Description#
The Project object is not meant to open multiple projects, but only open one.
Property Documentation#
string currentDocument#
Current document opened in the project.
array<string> documents#
Return all documents opened in the project.
string root#
Current root path of the project, this can be set only once.
Method Documentation#
array<string> allFiles(PathType type = RelativeToRoot)#
Returns all files in the current project.
type defines the type of path, and can be one of those values:
- Project.FullPath
- Project.RelativeToRoot
array<string> allFilesWithExtension(string extension, PathType type = RelativeToRoot)#
Returns all files with the extension given in the current project.
type defines the type of path, and can be one of those values:
- Project.FullPath
- Project.RelativeToRoot
array<string> allFilesWithExtensions(array<string> extensions, PathType type = RelativeToRoot)#
Returns all files with an extension from extensions in the current project.
type defines the type of path, and can be one of those values:
- Project.FullPath
- Project.RelativeToRoot
closeAll()#
Close all documents. If the document has some changes, save the changes.
Document get(string fileName)#
Gets the document for the given fileName. If the document is not opened yet, open it. If the document
is already opened, returns the same instance, a document can't be open twice. If the fileName is relative, use the
root path as the base.
If the document does not exist, creates a new document (but don't save it yet).
Note
This command does not change the current document.
Document open(string fileName)#
Opens or creates a document for the given fileName and make it current. If the document is already opened, returns
the same instance, a document can't be open twice. If the fileName is relative, use the root path as the base.
If the document does not exist, creates a new document (but don't save it yet).
openPrevious(int index = 1)#
Open a previously opened document. index is the position of this document in the last opened document.
document.openPrevious(1) (the default) opens the last document, like Ctrl+Tab in any editors.
saveAllDocuments()#
Save all Documents opened in project.