In the project settings dialog you can specify a project directory. If this field is left empty, the project directory is the directory of the project file. The project directory is used additionally to the current working directory when UltraEdit tries to find a file with a relative path and a project is currently open.
You don't have access to the internal variable containing the project directory string from within a script or macro. But you can use the project directory in user tools or project tools. See in help of UltraEdit / UEStudio the page Tool Configuration command (Advanced menu)
The configurations of the general user tools are saved in the INI file and are available project independent, but can nevertheless use project variables. The configurations of the project tools are saved in the project file and therefore are project specific.
To get the project directory from within a script or macro you have to configure a user tool which for example copies the project directory into the Windows clipboard or saves it into a file or just prints it to standard output and UE/UES captures that output to a new file. For example to copy the project directory to windows clipboard you can use a user tool with following command line:
echo "%rp" | path to tool