Referencing Files in a Workbook - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Create Maple Workbooks and Manage Attachments : worksheet/workbook/uri

Referencing Files in a Workbook

You can refer to the contents of data and Maple code files added to your workbook using Maple Workbook URIs.

 

Using a Workbook URI to Refer to Workbook Files

Workbook URI Syntax

Using a Workbook URI to Refer to Workbook Files

The Workbook URI (Uniform Resource Identifier) is used to represent the identity and location of files within a Maple workbook or files residing inside another workbook in a given file directory.

A URI  would look like this:

 exampleURIthis:///MyCode.mpl

 

Workbook URI Syntax

The Basics

Using the URI mentioned above as an example,

 exampleURIthis:///MyCode.mpl

The substring, "this://" identifies this URI as a reference to the current open workbook.

The third slash represents the root directory of the Maple workbook.

Finally, "MyCode.mpl" represents the Maple code file located in the root directory of the current workbook.   

In general, the URI syntax is "this:///<path to file in workbook>/<filename>".

 Relative vs Absolute Paths

Consider the following URI:

this:///NewFolder/NewSubFolder/Sections.png

This URI contains an absolute path to the image file "Sections.png". In other words, the complete file path is explicitly stated. Within the workbook that contains "Sections.png", the URI could also have been defined as

this://Sections.png

This URI contains a relative file path. With respect to the current open workbook, the file can be located anywhere, at any level in the workbook directory.

Note: Using a relative file path only works if there are no other files called "Sections.png" at any level in the workbook.

 Referencing Files in Another Workbook

While URIs of the form "this:///<path to file>/<filename>" are used to represent files within a workbook, it is also possible to reference files contained in other workbooks.

The syntax for such a URI is:

"maple://<file path to workbook>/<path within other workbook>/<filename>"

Creating a Workbook URI on Windows

The file separator on a Windows operating system is backslash "\". However, the backslash is also an escape character. So in order to use the backslash as a file separator, a second backslash is required.

A example of a workbook URI on Windows would be:

maple://C:\\foo\\bar.maple\\Images\\Image.png

 

Creating a Workbook URI on Linux or Mac OS X

The forward slash "/" character is the valid file separator on Linux or Mac OS X.

An example of a workbook URI on Linux or Mac OS X would be:

maple:///foo/bar.maple/Images/Image.png

 

See Also

Linking to a Workbook Attachment

Workbook Overview