home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>GetAttr Function [Runtime]</title><meta name="filename" content="text/sbasic/common/03020409"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css"> p.P1{ } span.T1{ font-weight:bold;} </style></head><body> <help:to-be-embedded Eid="getattr" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:link Id="66583">GetAttr Function [Runtime]</help:link></p> <p class="Paragraph">Returns a bit pattern which identifies the file type or shows whether it has a name of a volume or a directory.</p> </help:to-be-embedded> <p class="Paragraph"><span class="T1">Syntax</span>:</p> <p class="Paragraph">GetAttr (Text As String) <help:key-word value="GetAttr" tag="kw66583_1" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><span class="T1">Return value</span>:</p> <p class="Paragraph">Integer</p> <p class="Paragraph"><span class="T1">Parameter</span>:</p> <p class="Paragraph">Text: Any string expression that contains an unambiguous file specification. The <help:link Id="66636" Eid="urllocal" xmlns:help="http://openoffice.org/2000/help">URL notation</help:link> can also be used here.</p> <p class="Paragraph">This function is used to determine the MS-Dos file attributes for a specified file. This function returns as a result a bit pattern which helps you to identify the file attributes as follows:</p> <p class="Paragraph"><span class="T1">Value</span></p> <p class="Paragraph">0 : Normal files.</p> <p class="Paragraph">1 : Read-only files.</p> <p class="Paragraph">2 : Hidden files.</p> <p class="Paragraph">4 : System files.</p> <p class="Paragraph">8 : Returns the name of the volume</p> <p class="Paragraph">16 : Returns the name of the directory only.</p> <p class="Paragraph">32 : File was changed since last backup (Archive bit).</p> <p class="Paragraph">If you want to know whether a bit of the attribute byte is set, please use the following query method:</p> <p class="Paragraph"><span class="T1">Example:</span></p> <p class="PropText">Sub ExampleSetGetAttr</p> <p class="PropText">On Error Goto ErrorHandler REM Define target for error-handler</p> <p class="PropText">If Dir("C:\test",16)="" Then MkDir "C:\test"</p> <p class="PropText">If Dir("C:\test\autoexec.sav")="" THEN Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"</p> <p class="PropText">SetAttr "c:\test\autoexec.sav" ,0</p> <p class="PropText">Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"</p> <p class="PropText">SetAttr "c:\test\autoexec.sav" ,1</p> <p class="PropText">print GetAttr( "c:\test\autoexec.sav" )</p> <p class="PropText">end</p> <p class="PropText">ErrorHandler:</p> <p class="PropText">Print Error</p> <p class="PropText">end</p> <p class="PropText">end sub</p> </body></html>