Highlighted

Troubleshooting inability to access/write to File and Folder objects in jsx

Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

Hi, I have a client running a script I wrote, and it appears they are unable to access/write to folders or files on their Mac Mojave 10.14.6. They said their drives were formatted with APFS Volume, and were wondering if maybe that was the issue. They were able to access files and folders on their server, so it's something to do with permissions on their local machine. Anyone ever encountered this/have a solution? The following works fine on my Mac Catalina 10.15.4. Thanks. 

 

 

//Log function
var log = function(fol, msg) { 
    try {
        var today = new Date();
        var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
        var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
        var dateTime = date + " " + time;
        
        var f = File(fol.fsName + "/hyperlink_error_log.txt");
        f.encoding = "UTF-8";
        f.open("w");
        f.writeln(dateTime + ": " + msg);
        f.close();
    }
    catch(e) {}
};

//call log function
log(Folder("~/Desktop/"), "Starting script");

 

 

Topics

Scripting

Views

47

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

Troubleshooting inability to access/write to File and Folder objects in jsx

Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

Hi, I have a client running a script I wrote, and it appears they are unable to access/write to folders or files on their Mac Mojave 10.14.6. They said their drives were formatted with APFS Volume, and were wondering if maybe that was the issue. They were able to access files and folders on their server, so it's something to do with permissions on their local machine. Anyone ever encountered this/have a solution? The following works fine on my Mac Catalina 10.15.4. Thanks. 

 

 

//Log function
var log = function(fol, msg) { 
    try {
        var today = new Date();
        var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
        var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
        var dateTime = date + " " + time;
        
        var f = File(fol.fsName + "/hyperlink_error_log.txt");
        f.encoding = "UTF-8";
        f.open("w");
        f.writeln(dateTime + ": " + msg);
        f.close();
    }
    catch(e) {}
};

//call log function
log(Folder("~/Desktop/"), "Starting script");

 

 

Topics

Scripting

Views

48

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

Have something to add?

Join the conversation