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

Folder alias in extendscript

Explorer ,
Jun 06, 2021 Jun 06, 2021

Copy link to clipboard

Copied

sadasdasd.png

var folderAliasName="untitled folder alias"
var folder=new Folder(Folder.desktop+"/"+folderAliasName)
alert(folder.exists) //true
alert(folder.alias)  //true
alert(folder) //~/Desktop/untitled%20folder%20alias
//does not appear to do anything..
alert(folder.resolve()) //~/Desktop/untitled%20folder%20alias
//- despite there being few files
alert(folder.getFiles("*")) //""

 

I am trying to access folder through alias(aka shortcut) in extendscript with no success.

I am under macOS.

What I am doing wrong? 

 

Thanks in advance!

TOPICS
Bug , Scripting , Tools

Views

441

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

Explorer , Jun 07, 2021 Jun 07, 2021

So it seems, in Illustrator resolving folder aliases is broken 😞

ooo.png

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 06, 2021 Jun 06, 2021

Copy link to clipboard

Copied

I think you have to resolve the alias.

folder.resolve().getFiles()

In my quick test I did (Big Sur) the path

Folder.desktop + "/" + folderAliasName + "/" + fileThatExists

didn't work unless I switched the resolved folder name for the folderAliasName. 

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
Community Expert ,
Jun 06, 2021 Jun 06, 2021

Copy link to clipboard

Copied

Hi,

See below snippet. 

var folderAliasName = "untitled folder alias"
var folder = new Folder(Folder.desktop + "/" + folderAliasName);
if (folder.exists) {
    var newFolder = folder.resolve();
    alert(newFolder instanceof File) //returns true in Illustrator and false in Indesign
    $.writeln(newFolder.getFiles("*"));
}

 

I run this code in Indesign and Illustrator, It runs perfectly fine in Indesign but in Illustrator, it gives an error by saying getFiles is not the function. This is happening because, newFolder is a instance of File in Illustrator which is a wrong but it return false in Indesign which is correct.

 

Best regards

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 ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

So it seems, in Illustrator resolving folder aliases is broken 😞

ooo.png

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
Community Expert ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

LATEST

Yes, it seems because here type of the alias folder returns as a File and File object does not have the getFiles function attached to it.

 

Best regards

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