Page 2 of 2

Re: Get File properties

Posted: 25 Oct 2012 23:05
by mfu
<<btw, you posted in the wrong post. can you post back in the original place?>>

Oops. Yes. Thx.

Re: Get File properties

Posted: 18 Jun 2013 17:32
by serendipity
Moved script to the first page. Might actually be useful to someone. :)

Re: Get File properties

Posted: 18 Jun 2013 20:41
by TheQwerty
serendipity wrote:Moved script to the first page. Might actually be useful to someone. :)
It's really not worth it but since you forced this thread to show up in my unread posts view... :P
EDIT: Rather my changes & suggestions may not be worthwhile but the script itself is definitely one everyone should have!

The array usage is a great trick but in this instance I'd suggest using a HEREDOC instead. It could save you at least 116 stepping dialogs and would mean not having to keep count or have a total variable.

Also the Text dialog has a copy button making it easier (and nicer) to just let the user copy the data if they want.

I've taken the liberty of making those changes if you want them - if not I understand.
Properties-v3.xys
My HEREDOC take on a classic.... code below!
(2.75 KiB) Downloaded 392 times

A more challenging task would be to attempt to condense the list to unique property values, listing all of the properties (named or indices) that return the same value. For example:

Code: Select all

2.50 KB = #1
2565 = Size
6/18/2013 12:44 PM = #4, #5
6/18/2013 2:00 PM = #3
6/18/2013 4:44:04 PM = Access, Create
6/18/2013 6:00:52 PM = Write
A = Attrib, Attributes, #6
Properties-v2.xys = Name
XYS File = Type, #2
But that is pretty messy in plaintext without inserting white space, so generating HTML would look better and causes me to lose interest. :lol:


Code: Select all

//Properties-v3 - Gets file properties. 

//This has two parts: 
//Part-1: Uses known property names to get file properties, mostly it will help english users. 
//Part-2: Since its impossible to include property names from all languages, the script simply scans through property IDs 1-500 and get its values.
//Note1: If you want to scan more than 500 then increase the value of WHILE argument in the second part of the script
//Note2: Some values will be redundant as I use two different methods.

//PART-1: Get known property names

  $item = "<curitem>";

  $propertyList = <<<#PROPERTY_LIST
Access
Album
AllocSize
Aperture
Artist
Attrib
Attributes
AttributesDescription
Audio Format
Audio Sample Size
BitDepth
Bitrate
CameraModel
Capacity
Channels
ColorSpace
Company
Compression
Copyright
Create
CSCStatus
Data Rate
DateDeleted
DeletedFrom
Dimensions
Directory
Distance
DocAppName
DocAuthor
DocByteCount
DocCategory
DocCharCount
DocComments
DocCompany
DocCreatedTm
DocEditTime
DocHiddenCount
DocKeywords
DocLastAuthor
DocLastPrinted
DocLastSavedTm
DocLineCount
DocManager
DocNoteCount
DocPageCount
DocParaCount
DocPresentationTarget
DocRevNumber
DocSlideCount
DocSubject
DocTemplate
DocTitle
DocWordCount
DRM Description
Duration
EquipMake
ExposureBias
ExposureProg
ExposureTime
FaxCallerID
FaxCSID
FaxRecipientName
FaxRecipientNumber
FaxRouting
FaxSenderName
FaxTime
FaxTSID
FileDescription
FileSystem
FileType
FileVersion
Flash
FlashEnergy
FNumber
FocalLength
Frame Rate
FrameCount
FreeSpace
Genre
ImageX
ImageY
ISOSpeed
LightSource
LinksUpToDate
LinkTarget
Lyrics
Manager
MeteringMode
MMClipCount
Name
Owner
Play Count
Play Expires
Play Starts
PresentationTarget
ProductName
ProductVersion
Project
Protected
Rank
Rating
ResolutionX
ResolutionY
Sample Rate
Scale
ShutterSpeed
Size
Software
Status
Stream Name
SyncCopyIn
Track
Type
Video Sample Size
WhenTaken
Write
Year
#LinkTarget
#ShortcutTarget
#JunctionTarget
#ResolveJunctions
#ResolveJunctionsAll
#Label
#Tags
#Comment
#HardLinks
#PROPERTY_LIST;

  // Provides a little tolerance and sorting to the property list.
  $propertyList = FormatList($propertyList, 'dents', "<crlf>");
  
  // String building is fun...
  $result = '';

  // Enumerate through all named properties.
  foreach ($key, $propertyList, "<crlf>") {
    if ($key) {
      $value = Property($key, $item);
      if ($value) {
        $result = $result . "$key = $value<crlf>";
      }
    }
  }

  // For: The properties whose names we do not know....
  $i = 0; while ($i <= 500) { $i++;
    $value = Property("#$i", $item);
    if ($value) {
        $result = $result . "#$i = $value<crlf>";
    }
  }


  Text $result;
[/size]

Re: Get File properties

Posted: 18 Jun 2013 21:07
by serendipity
TheQwerty wrote:It's really not worth it but since you forced this thread to show up in my unread posts view... :P
EDIT: Rather my changes & suggestions may not be worthwhile but the script itself is definitely one everyone should have!
Thanks! I am basically too lazy to improve any script unless absolutely necessary.
But you are right, Heredoc will save stepping and copy clipboard was redundant since new text window already has the copy button.
Do you mind if I placed this version in the first page for easier access?

Re: Get File properties

Posted: 18 Jun 2013 21:40
by TheQwerty
serendipity wrote:Do you mind if I placed this version in the first page for easier access?
Not at all.. you can even claim it as your own and sell it for all I care. ;)

Re: Get File properties

Posted: 30 Apr 2014 04:27
by binocular222
@Don: This is definitely better than File > Metadata
Do you intend to update XY's "File > Metadata" ?

Re: Get File properties

Posted: 30 Apr 2014 08:50
by admin
"This?" Sorry, but no time to reread a whole ancient thread... :whistle:

But if it is about template driven metadata support, this is already coded and but I never documented it hence you don't know it. :P

Re: Get File properties

Posted: 02 Aug 2014 02:58
by CookieMonster
admin wrote:"This?" Sorry, but no time to reread a whole ancient thread... :whistle:

But if it is about template driven metadata support, this is already coded and but I never documented it hence you don't know it. :P
The scripts in this thread are useless as it's embedded into XY ?

Re: Get File properties

Posted: 16 Oct 2014 14:17
by highend
My version of the script...

I personally find the output easier to read and it separates used from unused properties, etc.

The #hash.xxx values are commented out (via a ";" in front of each line). If you want them back, just remove the semicolon for any of them.

Current:
Properties-v5.zip
(1.49 KiB) Downloaded 386 times
Old:
Properties-v4.zip
(1.42 KiB) Downloaded 404 times

Re: Get File properties

Posted: 18 Oct 2014 10:06
by FluxTorpedoe
Cool!
That's a script that always came in handy!
Now your version makes it even fancier… ;)

Re: Get File properties

Posted: 19 Jun 2017 09:18
by admin
highend wrote:Current:
Properties-v5.zip
There seems to be a bug in that script (a missing closing parenthesis), here is my fix:

Code: Select all

OLD:      } elseif (regexmatches($propValue, "[^\s]+") {
NEW:      } elseif (regexmatches($propValue, "[^\s]+")) {
I only wonder why nobody noted this for almost 3 years. :veryconfused:

Apart from that: useful script! :tup:

Re: Get File properties

Posted: 19 Jun 2017 10:57
by highend
I only wonder why nobody noted this for almost 3 years
Good question...

Nonetheless, here is v5.1...
Properties_v5.1.zip
(1.5 KiB) Downloaded 624 times

Re: Get File properties

Posted: 22 Apr 2018 10:32
by chasster123
Thanks for a quick response to my seeking all Original files - however, i'm no longer around programmers as a general rule and would appreciate a bit of additional text.
What i'm hoping for is an instruction that might suggest that i drop the script (ref. 5.1) into the scripts folder (or other instruction) so that this tweak will work all the time.

Re: Get File properties

Posted: 22 Apr 2018 11:37
by highend
This thread contains different methods to execute a script: viewtopic.php?f=7&t=6560

At the end of the thread under: B.) How to execute an script by loading it from an file