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

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

Community Beginner ,
Jun 20, 2022 Jun 20, 2022

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

TOPICS
Scripting
404
Translate
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 Beginner ,
Jun 20, 2022 Jun 20, 2022

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);

Translate
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

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);

 

 

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

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

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

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

Translate
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

renl80416020_0-1655802412979.pngexpand image

 

Translate
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

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.pngexpand imageScreen Shot 2022-09-13 at 5.06.54 PM.pngexpand image
Translate
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 ,
Sep 13, 2022 Sep 13, 2022
LATEST

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

Translate
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