Copy link to clipboard
Copied
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!
So it seems, in Illustrator resolving folder aliases is broken 😞
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.
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.
Copy link to clipboard
Copied
So it seems, in Illustrator resolving folder aliases is broken 😞
Copy link to clipboard
Copied
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.