Folder alias in extendscript

New Here ,
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

232

Likes

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

Likes

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 Community Professional ,
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

Likes

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

Copy link to clipboard

Copied

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

ooo.png

Likes

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 Community Professional ,
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

Likes

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