Project.close - how to define closeProjectOptions

Hi,

I´m trying to close the active Project via UXP but can´t really find out on how to define the closeProjectOptions.

Tried something like this:

var activeProject = await ppro.Project.getActiveProject();
await activeProject.close({promptIfDirty: true, showCancelButton: false, isAppBeingPreparedToQuit: false, saveWorkspace: true});

or this:

const activeProject = await ppro.Project.getActiveProject();
const opts = new ppro.CloseProjectOptions()
    .setPromptIfDirty(true)
    .setShowCancelButton(true)
    .setSaveWorkspace(true)
    .setIsAppBeingPreparedToQuit(false);
await project.close(opts);

But nothing seems to work so far. Any ideas on this!

Thanks for your help!

Cheers,

Jannis

If lucky, it might be as simple as providing the correct variable name ?

Try replacing the last line:
await project.close(opts);
with
await activeProject.close(opts);

1 Like

Whoopsie. Yes, this actually was the problem.
Thanks!

Is there an option to close any other Project than the active one?
I mean other projects can be found with ppro.Projects.getProject(UID), but there is no function that returns all open projects I think.

Edit: ppro.ProjectUtils.getProjectViewIds(); actually returns all GUIDs of currently open Projects.