• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Extendscript currentProject Unknown Exception Error

Contributor ,
Aug 26, 2022 Aug 26, 2022

Copy link to clipboard

Copied

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!
 
TOPICS
Error or problem , SDK

Views

560

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Sep 08, 2022 Sep 08, 2022

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

Votes

Translate

Translate
Adobe Employee ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

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? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 01, 2022 Sep 01, 2022

Copy link to clipboard

Copied

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 01, 2022 Sep 01, 2022

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 06, 2022 Sep 06, 2022

Copy link to clipboard

Copied

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.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 08, 2022 Sep 08, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

LATEST

This one kept bugging me over the past years and I think I figured out what was going on.

 

We're suing the loop:

for (var a = 0; a < app.projects.numProjects; a++) {
That generally will work, but as we know, there's sometimes an error when you have bins open. I finally realized that it may be because we're testing projects by using viewIDs, but somtimes we have more view IDs than projects. So, say we have 5 viewIDs (because a bin is open in a window) but only 4 projects, since our loop stops when we hit our numProjects, there's a chance that one of the viewIDs hasn't been tested and if that viewID relates to the project we want, we get the error. So, changing the line to
for (var a = 0; a < viewIDs.length; a++) {
ensures that we now will test all the view IDs. Seems to work at least in my recent tests.
 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines