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

Scripting: attachProxy if exists

Participant ,
Jun 23, 2022 Jun 23, 2022

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
337
Translate
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,

...
Translate
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,

-Dan

Translate
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
Participant ,
Jul 13, 2022 Jul 13, 2022
LATEST

That works a treat, thanks Dan

Translate
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