2.1.45 RootFolder


Description

Syntax

VB: Property Get/Set RootFolder As Folder
C++: Folder RootFolder
C#: Folder RootFolder

Remark

Examples

This example demonstration the following:

  1. Adding new folders starting from the root
  2. Get specific folder by fullpath
  3. Get parent level folder given current folder object

VB

Private Sub CommandButton_Click()
    Dim app As Origin.Application
    Dim fldr As Origin.folder
    Dim pathCurrent As String
    Set app = New Origin.ApplicationSI
    'save current folder
    Set fldr = app.ActiveFolder
    pathActive = fldr.Path
    'Create a new folder named "Testing" and sub folders
    app.RootFolder.folders.Add("Testing").folders.Add("Private").folders.Add ("Some Graphs")
    'Activate the folder "Graphs"
    Set fldr = app.RootFolder.folders.FolderFromPath("Testing\Private\Some Graphs")
    fldr.Activate
    app.GraphPages.Add ("origin") 'Add a new Graph to the new folder
    Dim f2 As Origin.folder
    Set f2 = fldr.Parent 'Get the parent level folder
    Set fldr = f2.folders.Add("Some WorkSheets") 'Create new Sub Folder
    fldr.Activate 'Activate
    app.WorksheetPages.Add ("origin") 'Add a new Workbook to the new folder
    Set fldr = app.RootFolder.folders.FolderFromPath(pathActive)
    app.ActiveFolder = fldr  ' restore active folder
End Sub

Python

import OriginExt as O
app = O.Application(); app.Visible = app.MAINWND_SHOW
# Save the current folder
fldOld = app.ActiveFolder
pathActive = fldOld.Path
# Create a new folder named "Testing" and sub folders
app.RootFolder.Folders.Add("Testing").Folders.Add("Private").Folders.Add("Some Graphs")
# Activate the folder "Graphs"
fldr = app.RootFolder.Folders.FolderFromPath("Testing\\Private\\Some Graphs")
fldr.Activate()
# Add a new Graph to the new folder
app.GraphPages.Add("origin")
# Get the parent level folder
f2 = fldr.Parent
fldr = f2.Folders.Add("Some Worksheets")
fldr.Activate()
# Add a new Workbook to the new folder
app.WorksheetPages.Add("origin")
fldr = app.RootFolder.Folders.FolderFromPath(pathActive)
# restore active folder
app.ActiveFolder = fldOld

Version Information

8.0SR2

See Also