QX.js API Reference

Project

app. Project

new Project(projectID)

The Project class represents the real QuarkXPress project in java scripting world. You can interact with the QuarkXPress project using its properties and methods.
Example
let myProject = new app.Project(projectId);
let myProject = app.activeProject();
Parameters:
Name Type Description
projectID number Id of the project.

Members

projectID :number

Id of the project
Type:
  • number

Methods

closeProject(closeType) → {boolean|app.APIError}

Closes the Project represented by this object.
Parameters:
Name Type Description
closeType app.constants.projectCloseTypes See projectCloseTypes for all available close types.
Returns:
Returns true on success else APIError.
Type
boolean | app.APIError

createLayout(layoutName, layoutMediaTypesopt, layoutOptionsopt) → {app.layout|app.APIError}

Creates a new layout and attaches it to the project represented by this object.
Parameters:
Name Type Attributes Default Description
layoutName string Name of the new layout.
layoutMediaTypes app.constants.layoutMediaTypes <optional>
app.constants.layoutMediaTypes.PRINT_MEDIA_TYPE See layoutMediaTypes for all available layout types.
layoutOptions app.PrintLayoutOptions <optional>
See PrintLayoutOptions for all available layout options.
Returns:
Type
app.layout | app.APIError

getAssets(assetType) → {assetInfo|app.APIError}

Gets a project's asset information like style sheets, colors, etc.
Parameters:
Name Type Description
assetType app.constants.assetTypes See assetTypes for all available asset types.
Returns:
Returns array of assetInfo on success else APIError.
Type
assetInfo | app.APIError

getLayoutByIndex(index) → {app.Layout|app.APIError}

It gives the layout in the project as per the given index.
Parameters:
Name Type Description
index Number Index (0 based) of the layout in the project.
Returns:
Returns the instance of app.Layout on success else APIError
Type
app.Layout | app.APIError

getLayoutCount() → {Number|app.APIError}

It gives the number of layouts in the project.
Returns:
Returns number of layouts on success else APIError
Type
Number | app.APIError

getLocation() → {projectLocation|app.APIError}

This function is used to return the file path and saved state of the project/template represented by this object.
Returns:
Type
projectLocation | app.APIError

isLocked() → {boolean}

Checks if the project is locked or not
Returns:
Returns true if project is locked else false.
Type
boolean

saveAsProject(filepath, downSave) → {boolean|app.APIError}

Saves the Project represented by this object. If the project already has a file, the filepath is optional, which means save in the current location.
Parameters:
Name Type Description
filepath string Destination where the file is to be saved. Can be null or undefined.
downSave boolean True if want to down save the project in previous version of QuarkXPress.
Returns:
Type
boolean | app.APIError

saveProject(filepathopt) → {boolean|app.APIError}

Saves the Project represented by this object. If the project already has a file, the filepath is optional, which means save it in the current location.
Parameters:
Name Type Attributes Description
filepath string <optional>
Destination where the file is to be saved. Can be null or undefined.
Returns:
Type
boolean | app.APIError