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

Get file size value for export to .txt

Community Expert ,
Jul 24, 2011 Jul 24, 2011

I have created a script to export metadata using the XMP Script Library.  I am able to get all the properties I need except one: image file size (not dimensions, but the size of the file itself in MB).  File size is not included in any XMP namespaces and it isn't in any TIFF tags as far as I can tell.

Getting the file name is very straightforward: exportFile.write (thumb.name), but I can't find any method to get the file size.

Any ideas would be a big help.

Thanks in advance,

Greg Reser

TOPICS
Scripting
774
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
Valorous Hero ,
Jul 25, 2011 Jul 25, 2011


var sels = app.document.selections;
alert(sels[0].spec.length);


This will get you the file size in bytes, then you can divide to get Mbytes.

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
Guru ,
Jul 25, 2011 Jul 25, 2011

or…

var sels = app.document.selections;
alert( sels[0].core.immediate.size );

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 ,
Jul 25, 2011 Jul 25, 2011
LATEST

Paul and Mark,

Thank you!  Both methods work perfectly!

Greg

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