Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

FileExplorer

  • Last UpdatedFeb 19, 2025
  • 3 minute read

The FileExplorer node provides a set of functions to explore the content of the file system. It does not support any functionality to create/copy/move or delete entries. The FileExplorer node is included in the Importers Plugin.

Platform support

This node is supported on XR-Windows platform only.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

No support

No support

No support

No support

Full support

No support

No support

No support

No support

Directory content representation

The listDirectoryContent field gets the full content of a directory path. It returns an stable. The table is empty if the provided path does not exist.

These are the columns in the table.

Column

Description

Type

Identifies directories (returned value:dir) and files (returned value:file) types.

Name

A directory or file name. The extension is included for files.

Ext

The file extension. Provided only for files.

Size

The dimension in bytes. Provided only for files.

CreationDate

The creation date and time.

ModifiedDate

The last writing date and time.

Code example

This is a code example for the FieldExplorer node.

<!-- first register plugin the create the FileExplorer -->

<plugin file="plugins\Importers\ImportersPlugin.dll" />

<FileExplorer name="dirInfo" />

<!-- list box to host the directory content -->

<ListBox2D name="directory" templateInfo="ListBox2D|directory" position="28 297" size="600 600" visible="true" items="" selectedIndex="0" active="true" />

<!-- some useful variables -->

<var name="filesTable" type="stable" />

<var name="dirPath" type="sstring" value="" />

<!-- initial set-up -->

<Command name="cmd_startup" execute="true">

<set name="dirPath.value" value="C:\" />

<execute command="cmd_listFiles" dirPath="[@dirPath.value]" />

</Command>

<!-- command to update the listbox with the content of the directory -->

<Command name="cmd_listFiles" args="dirPath=sstring">

<local name="files" type="stable" value="[@dirInfo.listDirectoryContent.execute([@%dirPath%])]" />

<set name="filesTable.value" value="[@%files%]" />

<local name="idx" type="sint" value="0" />

<local name="type" type="sstring" value="" />

<local name="val" type="sstring" value="" />

<local name="names" type="mstring" value="" />

<while condition="@%idx%@&lt;[@%files%.rows]" >

<set name="type" value="[@%files%.elementAtColumn([@%idx%],Type)]" />

<set name="val" value="[@%files%.elementAtColumn([@%idx%],Name)]" />

<modify name="names" op="add" value="[@%val%]" condition="[@%type%]==file" />

<modify name="names" op="add" value="\[[@%val%]\]" condition="[@%type%]==dir" />

<set name="idx" value="#[@%idx%]+1#" />

</while>

<set name="directory.items" value="[@%names%]" />

</Command>

FileExplorer fields

These are the fields for FileExplorer node. Only the node-specific fields are indicated, not fields obtained by inheritance.

Field inheritance: NodeBase > FileExplorer

Fields

Type

Use

Default value

Description

getFileSystemInfo

sfunction

Optional

Returns a JSON string of all the files/subfolders/file and subfolder under the given root folders using the convention of name|path::<filterOption>

For example: name|path::file or name|path::folder or name|path::all or name|path without any filter option. The expected parameter is a list if key/value pairs separated by the pipe symbol and followed by "::"

For the filter option, filter options can be file/folder/all. The filter option is optional; not specifying is equivalent to specifying all.

The file filter option is the only one that does not parse the file system recursively.

The JSON string can be used exactly as returns for the FileExplorerUI Module input.

getWorkingDir

sfunction

Optional

Returns the executable working directory that corresponds in most cases to the project folder.

sstring getWorkingDir.execute()

listDirectoryContent

sfunction

Optional

Returns a stable with the contents of the provided directory path.

stable listDirectoryContent.execute(sstring path)

listDrives

sfunction

Optional

Returns a comma-separated list of the drives available on the machine.

mstring listDrives.execute()

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in