home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>SetAttr Statement [Runtime]</title><meta name="filename" content="text/sbasic/common/03020414"/><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="setattr" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:link Id="66554">SetAttr Statement [Runtime]</help:link></p> <p class="Paragraph">Sets the attribute information for a specified file.</p> </help:to-be-embedded> <p class="Paragraph"><span class="T1">Syntax</span>:</p> <p class="Paragraph">SetAttr FileName As String, Attribute As Integer <help:key-word value="SetAttr" tag="kw66554_1" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><span class="T1">Parameter</span>:</p> <p class="Paragraph">FileName: Name of the file, including path, for which to test attributes. If no path specification is given, <span class="T1">SetAttr</span> searches for the file in the current directory. 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">Attribute: Bit pattern defining the attributes to be set or to be cleared:</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">32 : File was changed since last backup (Archive bit).</p> <p class="Paragraph">You can set multiple attributes by combining the respective values with a logic OR statement.</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>