Jump to content



Photo

Udf: Get Extended File Property


  • Please log in to reply
64 replies to this topic

#1 Simucal

Simucal

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 777 posts

Posted 09 May 2006 - 12:18 AM

Alright, so maybe you all havent been waiting for something like this. None the less, I think it is neat.

This function will give you an extended property of a file. Examples would be the width or height of a video or image. Or the duration/bitrate of a song or video. How about the artist/album/song number of an mp3/wma music file? The list goes on.

Enjoy :).

-Simucal

Plain Text         
;=============================================================================== ; Function Name:    _GetExtProperty($sPath,$iProp) ; Description:    Returns an extended property of a given file. ; Parameter(s):  $sPath - The path to the file you are attempting to retrieve an extended property from. ;                  $iProp - The numerical value for the property you want returned. If $iProp is is set ;                            to -1 then all properties will be returned in a 1 dimensional array in their corresponding order. ;                           The properties are as follows: ;                           Name = 0 ;                           Size = 1 ;                           Type = 2 ;                           DateModified = 3 ;                           DateCreated = 4 ;                           DateAccessed = 5 ;                           Attributes = 6 ;                           Status = 7 ;                           Owner = 8 ;                           Author = 9 ;                           Title = 10 ;                           Subject = 11 ;                           Category = 12 ;                           Pages = 13 ;                           Comments = 14 ;                           Copyright = 15 ;                           Artist = 16 ;                           AlbumTitle = 17 ;                           Year = 18 ;                           TrackNumber = 19 ;                           Genre = 20 ;                           Duration = 21 ;                           BitRate = 22 ;                           Protected = 23 ;                           CameraModel = 24 ;                           DatePictureTaken = 25 ;                           Dimensions = 26 ;                           Width = 27 ;                           Height = 28 ;                           Company = 30 ;                           Description = 31 ;                           FileVersion = 32 ;                           ProductName = 33 ;                           ProductVersion = 34 ; Requirement(s):   File specified in $spath must exist. ; Return Value(s):  On Success - The extended file property, or if $iProp = -1 then an array with all properties ;                  On Failure - 0, @Error - 1 (If file does not exist) ; Author(s):        Simucal (Simucal@gmail.com) ; Note(s): ; ;===============================================================================


Example:
#include <extprop.au3> $path = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)") $prop = _GetExtProperty($path,21) ConsoleWrite("Property #"&$i&": "&$prop&@CRLF)


Example2:
#include <extprop.au3> #include <array.au3> $path = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)") $prop = _GetExtProperty($path,-1) _ArrayDisplay($prop,"Property Array")


EDIT: Have added a "-1" option that will return an array with all properties.
EDIT: Also, have added some error checking to ensure the file exists.
EDIT: Requires Beta!!

Attached Files


Edited by Simucal, 27 July 2006 - 05:55 PM.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)





#2 spyrorocks

spyrorocks

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 728 posts

Posted 09 May 2006 - 12:44 AM

I like it. If you could make a function to change the tags of a mp3 file i would be in heaven. :)

#3 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,315 posts

Posted 10 May 2006 - 06:55 PM

Looks good Simucal but it doesn't show any version informations on AutoIt EXEs :)

#4 blindwig

blindwig

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 772 posts

Posted 10 May 2006 - 07:03 PM

Nice info function. How about a new feature:
If I give you -1 for $i_prop, you give me an array with all the info in it.

See also my _FileListToArray2() function

#5 Simucal

Simucal

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 777 posts

Posted 10 May 2006 - 08:52 PM

Nice info function. How about a new feature:
If I give you -1 for $i_prop, you give me an array with all the info in it.

See also my _FileListToArray2() function


Nice suggestion, I'll implement this tonight.
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

#6 HardCopy

HardCopy

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 305 posts

Posted 10 May 2006 - 09:24 PM

Nice suggestion, I'll implement this tonight.



Very Useful simucal.


Thanks for the contribution, added to my Custom UDFs

Thanks

HardCopy

Looking forward to the update as suggested by blindwig
Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

#7 Simucal

Simucal

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 777 posts

Posted 10 May 2006 - 11:39 PM

Very Useful simucal.
Thanks for the contribution, added to my Custom UDFs

Thanks

HardCopy

Looking forward to the update as suggested by blindwig


Just updated it. Now has a -1 option to return all to array and added some error checking.
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

#8 marfdaman

marfdaman

    ...and when you wake, the morning showers you with light...

  • Active Members
  • PipPipPipPipPipPip
  • 405 posts

Posted 21 May 2006 - 07:02 PM

Very useful this! Thumbs up!

Regards
Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#9 Simucal

Simucal

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 777 posts

Posted 21 May 2006 - 07:19 PM

Thank you.

I'm thinking about cleaning it up and submitting it to be included with AutoIt. I think being able to get a files extended properties should be easily available.
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

#10 marfdaman

marfdaman

    ...and when you wake, the morning showers you with light...

  • Active Members
  • PipPipPipPipPipPip
  • 405 posts

Posted 22 May 2006 - 04:49 AM

Yes that's true IMHO, all these properties can come very handy in a lot of situations.
Personally, I'm implementing it into my mediaplayer, this works *way* better than some of the ID-3 udf's I have seen on this forum.

Regards
Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#11 rakudave

rakudave

    Polymath

  • Active Members
  • PipPipPipPip
  • 245 posts

Posted 22 May 2006 - 10:01 AM

this is VERY cool!
thanks Simucal

#12 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 22 May 2006 - 06:24 PM

Good job, Thanks. Very useful

#13 peter1234

peter1234

    Adventurer

  • Active Members
  • PipPip
  • 116 posts

Posted 24 May 2006 - 03:24 AM

Simucal,
Is there an option to get the sample rate of a wave file?

#14 Confuzzled

Confuzzled

    Mouse moved. Please restart Windows for changes to take effect.

  • Active Members
  • PipPipPipPipPipPip
  • 1,000 posts

Posted 24 May 2006 - 11:26 AM

BitRate = 22???

#15 marfdaman

marfdaman

    ...and when you wake, the morning showers you with light...

  • Active Members
  • PipPipPipPipPipPip
  • 405 posts

Posted 24 May 2006 - 12:05 PM

BitRate = 22???

No no sample rate is something different from the bitrate: the sample rate shows to what frequency the soundstage extends (for example 44 khz, this means that the 2 channels [stereo] each have a soundstage up to
22 khz), the bitrate shows how much space is used per time unit (seconds).

Regards
Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#16 trids

trids

    Hmmm .. and what have we here?

  • Active Members
  • PipPipPipPipPipPip
  • 1,004 posts

Posted 31 May 2006 - 06:13 AM

Very cool :)

I'm thinking about cleaning it up and submitting it to be included with AutoIt. I think being able to get a files extended properties should be easily available.

.. I agree 100% .. good luck!

#17 tazlikesrobots

tazlikesrobots

    Seeker

  • Active Members
  • 20 posts

Posted 31 May 2006 - 02:27 PM

Is there a way to retreive the original file name property.

#18 Briegel

Briegel

    Polymath

  • Active Members
  • PipPipPipPip
  • 237 posts

Posted 16 June 2006 - 07:39 AM

I'm thinking about cleaning it up and submitting it to be included with AutoIt. I think being able to get a files extended properties should be easily available.


Good job, that's what I'm looking for, thanks

#19 piccaso

piccaso

    Rock me, Amadeus!

  • MVPs
  • 893 posts

Posted 17 June 2006 - 01:29 AM

is there a way to alter/set the 'FileVersion' property ?
Posted Image CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

#20 randall

randall

    Seeker

  • Active Members
  • 22 posts

Posted 22 June 2006 - 08:58 AM

I'm thinking about cleaning it up and submitting it to be included with AutoIt. I think being able to get a files extended properties should be easily available.


I totally agree!!!
This is essential, you can use it for a million things, and it goes very well with the initial purpose of autoit as a macro and Windows automation language.

I am going to use it for some image processing to get the width and height, but i am sure it will also be useful in the future.

Thank you very much!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users