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

Why file.modified failed to get file modified date (jsx)

New Here ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

In JSX script, I can use file.modified gets the modified date of the file, but displays null on MacOS

TOPICS
How to , Scripting

Views

137

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 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

my jsx like this:

 

#target "illustrator"
#targetengine "main"

var myFolder = File("~/Desktop");
var myFiles = new File(myFolder.getFiles("test.ai"));
var myFileDate = myFiles.modified;
alert(myFileDate);

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
Advocate ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

Bonjour,

Le chemin est bien /Users/Desktop  ?

var myFolder = "~/Desktop";
var myFiles = new File(myFolder+"/test.ai");
alert(myFiles.exists)
var myFileDate = myFiles.modified;
alert(myFileDate);
var myFileDate = myFiles.created;
alert(myFileDate);

 

 

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
Advisor ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

It works for me (Windows).  If you're getting "null", then the file is not being accessed.  Try the full path?

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 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

It works in Windows,but getting "null" in macos

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
Advocate ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

renl80416020_0-1655802412979.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
New Here ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

I too am getting this issue, after trying a lot of things and trying to get an answer through searching online, I have arrived here.

 

I have code that works for InDesign but errors with Illustrator for getting a modified date for a file

 

Full File Path obscured, but catch never fires off anyways as the $.fileName returns correctly

try{
   var CurrentScript = File($.fileName)
} catch (err) {
   var CurrentScript = File("/Users/Folders.../ScriptName.jsx")
}
alert(CurrentScript.exists + "\n" + CurrentScript.modified)
 
Here are the results to the alert. indesign sees the file and returns the modification date.
Illustrator sees the file but returns null for some reason. Anyone have any insight into this?
Screen Shot 2022-09-13 at 5.06.47 PM.pngScreen Shot 2022-09-13 at 5.06.54 PM.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
Contributor ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

LATEST

Pretty sure the .modified() method is just broken on the Mac for whatever reason. We discussed it here as well.

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