Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OS file properties
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01308997
Message ID:
01316422
Views:
22
I left in misc. comments and displays.
* aai_FilePropertiesUT.prg
*=============================================================================*
LPARAMETERS tcFolder, tcFile
* DO c:\aai_FilePropertiesUT with 'your folder', ['your file']
* DO c:\aai_FilePropertiesUT with ;
*					'C:\Documents and Settings\All Users\Documents\My Music\Sample Music\', ;
* 					"Beethoven's Symphony No. 9 (Scherzo).wma"

lcFolder	= IIF((VARTYPE(tcFolder) = 'C' AND  NOT EMPTY(tcFolder)), ;
				 tcFolder, "")
lcFile		= IIF(VARTYPE(tcFile) = 'C' AND  NOT EMPTY(tcFile), ;
				 tcFile, "")

lcDir = lcFolder

oShell = Createobject ("Shell.Application")		&& object reference to shell
oFolder = oShell.Namespace (lcdir)				&& object reference to folder

lccom="CREATE CURSOR Temp (filename c(50)"		&& cursor to hold field information, max filename length 50
lalength=50										&& max 50 file detail attributes

lcFile = UPPER(lcFile)

For i = 1 to laLength							&& loop for detail attributes for fieldnames
	lcfieldname = oFolder.GetDetailsOf(oFolder.Items, i)	&& 
	IF NOT EMPTY(lcfieldname) 						&& not empty
		IF TYPE("alen(arrHeaders)")#"N"
			Dime arrHeaders(1,2)
		ELSE
			Dime arrHeaders(ALEN(arrHeaders,1)+1,2)
		endif

		arrHeaders(ALEN(arrHeaders,1),2) = i
		lcfieldname=LEFT(CHRTRAN(lcfieldname," ",""),9)		&& make a field name
		IF lcfieldname $lccom
			ia=0
			DO WHILE lcfieldname$lccom
				lcfieldname=LEFT(lcfieldname,8)+TRANSFORM(ia)
			enddo
		ENDIF
		
		lccom=lccom+ ", " + lcfieldname +" C(25)"
	endif													&& not empty
NEXT
lccom=lccom+", shortname c(15), fileattr c(4),ownerinfo c(50))"	&& add a few more fields
&lccom														&& make the file structure

For Each strFileName in oFolder.Items

		IF lcFile = UPPER(strFileName.Name)
		APPEND BLANK
		REPLACE (FIELD(1)) WITH strFileName.Name
		For i = 1 to alen(arrHeaders,1)
		REPLACE (FIELD(i+1)) WITH TRANSFORM(oFolder.GetDetailsOf (strFileName, arrHeaders[i,2]))
		NEXT
		ENDIF
		
Next

LOCATE FOR UPPER(lcFile) = UPPER(filename)

IF FOUND()
	IF 'cvsrevisi' $ lcCom
		WAIT WINDOW ALLTRIM(cvsrevisi) NOWAIT NOCLEAR
	ENDIF
	BROWSE LAST NOWAIT SAVE 
	LOCATE FOR UPPER(lcFile) = UPPER(filename)
ENDIF

RETURN


TEXT


2008-04-09T14:39:23
	TEMP
            FILENAME C( 50) = "Beethoven's Symphony No. 9 (Scherzo).wma"
                SIZE C( 25) = "600 KB"
                TYPE C( 25) = "Windows Media Audio file"
           DATEMODIF C( 25) = "8/29/2002 8:00 AM"
           DATECREAT C( 25) = "12/14/2005 4:01 PM"
           DATEACCES C( 25) = "4/9/2008 2:35 PM"
           ATTRIBUTE C( 25) = "A"
              STATUS C( 25) = "Online"
               OWNER C( 25) = "Administrators"
              AUTHOR C( 25) = "Ludwig van Beethoven, com"
               TITLE C( 25) = "Symphony No. 9 (Scherzo)"
             SUBJECT C( 25) = ""
            CATEGORY C( 25) = "Classical"
               PAGES C( 25) = ""
            COMMENTS C( 25) = ""
           COPYRIGHT C( 25) = ""
              ARTIST C( 25) = "Ludwig van Beethoven, com"
           ALBUMTITL C( 25) = ""
                YEAR C( 25) = ""
           TRACKNUMB C( 25) = "1"
               GENRE C( 25) = "Classical"
            DURATION C( 25) = "0:01:15"
             BITRATE C( 25) = "64kbps"
           PROTECTED C( 25) = "No"
           CAMERAMOD C( 25) = ""
           DATEPICTU C( 25) = ""
           DIMENSION C( 25) = ""
           EPISODENA C( 25) = ""
           PROGRAMDE C( 25) = ""
           AUDIOSAMP C( 25) = "16 bit"
           AUDIOSAM0 C( 25) = "44 kHz"
            CHANNELS C( 25) = "2 (stereo)"
             COMPANY C( 25) = ""
           DESCRIPTI C( 25) = ""
           FILEVERSI C( 25) = ""
           PRODUCTNA C( 25) = ""
           PRODUCTVE C( 25) = ""
            KEYWORDS C( 25) = ""
           SHORTNAME C( 15) = ""
            FILEATTR C(  4) = ""
           OWNERINFO C( 50) = ""


ENDTEXT
>>That's correct, just reading it.
>>What is the trick to post code on the UT?
>>
>>Al
>>
>Just use PRE tags. Is this procedure in the VCX or in a PRG? If the former, you can get the whole code by opening the library in the Class Browser and then View Code.
Previous
Reply
Map
View

Click here to load this message in the networking platform