Jump to content

Recommended Posts

Posted (edited)

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

;===============================================================================
; 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!!

ExtProp.au3

Edited by Simucal
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)
  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

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

Posted

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

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

Posted

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)
  • 2 weeks later...
Posted

Very useful this! Thumbs up!

Regards

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

Posted

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

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!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Posted

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!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Posted

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!
  • 3 weeks later...
Posted

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

Posted

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!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...