View Full Version : retrieve information from a files properties
Autoplayit07
11-28-2007, 10:30 AM
Hello.
is it possible to retrieve the information from a files properties,
the information I am reffering to is the information you see when you right clik a file and chose advance/simple or summary.
if if so , how is this done?
allso how to get ams to display this information in a paragraph box
thank you.
Dermot
11-28-2007, 11:36 AM
Look up the File.GetAttributes action in the help file.
Autoplayit07
11-28-2007, 01:12 PM
hey thank you Dermot.
but i tried to retrieve the infotmation and put it into a text file like this
result = File.GetAttributes(_ProgramFilesFolder.."\\AutoPlay Media Studio 7.0\\ams70.exe")
TextFile.WriteFromString("C:\\MyFile.txt", ""..result, true);
but i get an error "attempt to index global result (a nil value)"
something like that.
my code looks to simple, am pretty sure i am missing somthing here.
Dermot
11-28-2007, 03:52 PM
If you read the help file topic, it clearly states that it returns a table of values. So you have to access the info return like this
CreationDate = result.CreationDate
ReadOnly = result.ReaOnly
and so on....
From the help file.
Description
Returns a table containing all of the attributes for a specific file.
Parameters
Filename
(string) The path to the file.
Returns
(table) A table containing the file attributes indexed by name. If the file does not exist or an error occurs, this action returns nil.
If the file exists, the following attributes will be stored in the table:
KEY
TYPE
DESCRIPTION
CreationDate
string
The date the file was created (Monday, May 26, 2003).
CreationDateISO
string
The date the file was created, in ISO format (2003-05-26T16:57:52).
AccessDate
string
The last date the file was accessed (Wednesday, June 18, 2003).
AccessDateISO
string
The last date the file was accessed, in ISO format (2003-06-18T15:11:44).
WriteDate
string
The last date the file was written to (Wednedsay, June 18, 2003).
WriteDateISO
string
The last date the file was written to, in ISO format (2003-06-18T14:55:05).
Directory
boolean
True if the directory attribute is set.
Archived
boolean
True if the archive file attribute is set.
ReadOnly
boolean
True if the read-only file attribute is set.
Compressed
boolean
True if the compressed file attribute is set.
System
boolean
True if the system file attribute is set.
Hidden
boolean
True if the hidden file attribute is set.
Temporary
boolean
True if the temporary file attribute is set.
Normal
boolean
True if none of the boolean attributes are set.
Autoplayit07
11-29-2007, 04:31 AM
Hi Dermot!
thank for pointing that out, i know what you mean, but i have a hard time understanding how to set up a table.
is there any good and easy table example you could point me to, i've searched the forums ,but i can't find a easy example,that explains the details of how to setup a table,
i've allso looked in the tutorials for an tutorial on this.
allso the attributes i would like to retrieve into the table is not the creation date. or size of mb and sutge. its more like the information about the file. what media type and sutge.
hope i am not asking to much here.
i am new to this and i would realy like to learn,but some of the scripting is hard to learn ,what to combine with what and sutge.
thank you.
Dermot
11-29-2007, 02:19 PM
Tables are explained very well in the help file but in this case you don't have to create a table. The action returns a table.
if you do this:
result = File.GetAttributes(_ProgramFilesFolder.."\\AutoPlay Media Studio 7.0\\ams70.exe")
result will now be a table that holds all the values that are described in the help file. You access them like this; result.CreationDate, result.ReadOnly and so on.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.