;;=====================================================================================----- 
;;FUNCTION       GetExtFileProperties()   
;; 
;;ACTION         Get Extended File Properties / Attributes of Files    
;; 
;;AUTHOR         Allen Powell    
;; 
;;VERSION        1.2.2 - 2013/03/06 
;; 
;;HISTORY        1.0.0 - 2006/04/18 - Original Release 
;;               1.0.1 - 2006/11/18 - Updated with a more efficient method of determining 
;;                                    the same information 
;;               1.2.0 - 2007/03/02 - Updated to work with Vista, can now use the name or 
;;                                    number of the Attribute/Property 
;;               1.2.1 - 2009/06/11 - Added Table for Win-7, no changes in code 
;;               1.2.2 - 2013/03/06 - Updated to work with Win-8, Added Table for Win-8 
;; 
;;SYNTAX         GetExtFileProperties($FQFN, $attribute)   
;; 
;;PARAMETERS      
;;               FQFN - Required - String 
;;               - Full Path Name and File name   
;;               Attribute - Required - String 
;;               - Number or Name from Attribute Table (see notes) 
;;  
;;REMARKS        Please notice that attributes are specific to the OS.  This means that 
;;               not only can the Attribute number be different from one OS to the next, 
;;               but the Attribute Name can be different as well.       
;; 
;;RETURNS        String of Attribute(s) or nothing if there is an error. 
;;               Check @ERROR for problems.   
;; 
;;DEPENDENCIES   None 
;; 
;TESTED WITH     Kixtart 4.53   
;; 
;;EXAMPLES        
;  ; Using Windows XP and Attribute Number   
;  $MP3="C:\MP3s\Ac--Dc - Back In Black.mp3"   
;  $duration=GetExtFileProperties($mp3,21)    
;  ? $duration   
; 
;  ;Using Windows XP and Attribute Name   
;  $MP3="C:\MP3s\Ac--Dc - Back In Black.mp3"   
;  $duration=GetExtFileProperties($mp3,"Duration")    
;  ? $duration   
; 
;  ;Using Windows Vista and Attribute Name   
;  $MP3="C:\MP3s\Ac--Dc - Back In Black.mp3"   
;  $duration=GetExtFileProperties($mp3,"Length")    
;  ? $duration   
; 
function GetExtFileProperties($FQFN, $attribute)
  dim $objShell, $objFolder,$i,$found
  if exist($FQFN)
    $objShell=CreateObject("Shell.Application")
    $objFolder=$objShell.Namespace(left($FQFN,instrrev($FQFN,"\")))
    if $objFolder
      if vartypename($attribute)="string"
        While $i<298 and $found=0
          if $attribute=$objFolder.GetDetailsOf($objFolder.Items, $i)
            $attribute=$i
            $found=1
          endif
          $i=$i+1
        loop
      endif 
      if vartypename($attribute)="long" ; Number   
        $GetExtFileProperties=$objFolder.GetDetailsOf($objFolder.ParseName(right($FQFN,len($FQFN)-instrrev($FQFN,"\"))),$attribute)
      else
        exit -1 
      endif
    else
      exit @error
    endif
  else
    exit 2
  endif
endfunction