Skip to main content
BrianDavison
Known Participant
August 26, 2022
Answered

Extendscript currentProject Unknown Exception Error

  • August 26, 2022
  • 1 reply
  • 1362 views

In my script, I start by running this code lifted straight from the PPro Github:

 

var viewIDs = app.getProjectViewIDs();
for (var a = 0; a < app.projects.numProjects; a++) {
var currentProject = app.getProjectFromViewID(viewIDs[a]);
if (currentProject) {
if (currentProject.documentID === app.project.documentID) { // We're in the right project!
//here's where my actual script goes, but that doesn't really matter
}
}
}
 
Sometimes it'll work and script runs as intended, but many times it doens't run and when I do a debug I get an "Unknown error exception" on the line:
if (currentProject.documentID === app.project.documentID)
 
I've tried messing around and found that occasionally one of the currentProject will show up like the attached. Any idea why?
 
Thanks!
 
This topic has been closed for replies.
Correct answer Bruce Bullis

Great idea, I'd been toying around with something of that nature. I'm still working on isolating, and it seems running it while having multiples views of one project causes the issue. BUT I've also found that after having , say a bin of one project open in addition to the project panel and then closing the bin view, app.getProjectViewIDs() still returns a viewID associated with that view (presumably, I just know that it returns too many viewIDs for the amount of views open) even though it's no longer open.  Switching between workspaces seems to fix that issue and get PPro to retun the proper amount of viewIDs.

 


Good info! Yes, we're tracking that issue as DVAPR-4237895; work has not yet been scheduled.

1 reply

Bruce Bullis
Legend
August 29, 2022

Any idea why?

 

None! 🙂

I think the key will be in figuring out the 'sometimes', in 'sometimes it'll work'...

Can you provide any necessary project(s), as well as step-by-step instructions that, if followed, reliably reproduce the problem? 

BrianDavison
Known Participant
September 1, 2022

Ahh, therein lies the issue! It seems completely at random. It's not necessarily one project that produces the error. Somtimes I'll get the error when I'm trying to run the script on a particualr project, then close a few other projects I have open and then, boom, works again. Almost always it'll work on a fresh restart if i'm running the script on the only project I have open.  But, I"ll try to do some sleuthing and report back, thanks!

Bruce Bullis
Legend
September 1, 2022

Speculative: Perhaps having multiple views into one project open (e.g., one open project panel, and another panel showing the contents of a bin from within that project) helps confuse PPro?