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

Scripting: attachProxy if exists

Explorer ,
Jun 23, 2022 Jun 23, 2022

Copy link to clipboard

Copied

Is there a way to check if a file exists before using attachProxy() ?

This is my workaround:

if (app.sourceMonitor.openFilePath(proxyFileURL)){
    pItem.attachProxy(proxyFileURL,0);
}

 It works well, but I was wondering if there was a cleaner way?

 

TOPICS
SDK

Views

119

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 , Jun 23, 2022 Jun 23, 2022

Hi ReginaldUser555,

Great question. File Object might help you, it's documented here:

https://extendscript.docsforadobe.dev/file-system-access/file-object.html#file-object

 

so, for example, if you have a file named blahblah.prproj on your desktop;

var myProj = new File('/Users/<myusername>/Desktop/blahblah.prproj');

if (myProj){
if (myProj.exists){
alert("Yay, " + myProj.fsName + " exists!");
} else {
alert("Boo, " + myProj.fsName + " does not exist!");
}
}

Thanks for contributing to forums,

...

Votes

Translate

Translate
Adobe Employee ,
Jun 23, 2022 Jun 23, 2022

Copy link to clipboard

Copied

Hi ReginaldUser555,

Great question. File Object might help you, it's documented here:

https://extendscript.docsforadobe.dev/file-system-access/file-object.html#file-object

 

so, for example, if you have a file named blahblah.prproj on your desktop;

var myProj = new File('/Users/<myusername>/Desktop/blahblah.prproj');

if (myProj){
if (myProj.exists){
alert("Yay, " + myProj.fsName + " exists!");
} else {
alert("Boo, " + myProj.fsName + " does not exist!");
}
}

Thanks for contributing to forums,

-Dan

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
Explorer ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

LATEST

That works a treat, thanks Dan

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