Change Project Explorer directory or go to root folder
Command Line Usage
1. pe_cd ..; // Moves active folder of Project Explorer up one level.
2. pe_cd /; // Moves active folder of Project Explorer to root folder of project.
3. pe_cd path:= "../subfolder1"; // Moves active folder of Project Explorer to another folder at the same level as the active folder.
4. pe_cd path:="abc"; // Moves active folder of Project Explorer to a subfolder of the currently active folder.
|| Path of the folder to activate (move in to).
This X-Function is used to active (move in to) a folder or subfolder in the Project Explorer for the current Origin project. Both absolute and relative paths are supported (e.g. pe_path path:="/abc/def"; or pe_path path:="...abc/def";). When absolute paths are specified, the project name can be omitted from the path string.
The example below utilizes four related X-Functions to reorganize an Origin project by creating and moving workbooks of imported data into folders that are named after the file extension of the files that were imported into the workbooks. The X-Functions that are used include: pe_cd, pe_mkdir, pe_path, and pe_move. Also illustrated is using the LabTalk document command as well as the String::GetFileExt()$ method.
// Use pe_cd X-function to change Project Explorer folder to the root folder for the Project.
// Loop through every workbook in the project.
document -e W
// Get the imported file name from page info tree of workbook (if it exists).
string strFileName$ = page.info.system.import.filename$;
// If the workboox does not contain imported data, the go to next workbook in loop.
if (0 == strFileName.GetLength())
// Use the pe_mkdir X-Function to create a subfolder in the Project Explorer root folder named
// after the file extension of the imported file. Note, the X-Function is specified to check
// if the folder already exists before creating it.
// strFolderPath$ will contain the full path once the X-Function returns.
pe_mkdir folder:="Imported %(strFileName.GetFileExt()$) Files" chk:=1 cd:=0 path:=strFolderPath$;
// Now use the pe_path X-Function to get the full Project Explorer path to where the workbook currently resides.
// strBookPath$ will contain the full path once the X-Function returns.
pe_path page:="%(page.name$)" path:=strBookPath$ type:=0 active:=0;
// Check to see if the workbook is already in the newly-created (or existing) folder by comparing the two paths.
// If it is not, then use the pe_move X-Function to move the workbook into the folder from its current location.
if (strBookPath$ != strFolderPath$)
pe_move -sb move:="%(page.name$)" path:="%(strFolderPath$)";