GetAttr Function

Returns a bit pattern that identifies the file type or the name of a volume or a directory.

แƒกแƒ˜แƒœแƒขแƒแƒฅแƒกแƒ˜


Asc (แƒขแƒ”แƒฅแƒกแƒขแƒ˜ แƒ แƒแƒ’แƒแƒ แƒช แƒกแƒขแƒ แƒ˜แƒฅแƒแƒœแƒ˜)

แƒ“แƒแƒ‘แƒ แƒฃแƒœแƒ”แƒ‘แƒฃแƒšแƒ˜ แƒ›แƒœแƒ˜แƒจแƒ•แƒœแƒ”แƒšแƒแƒ‘แƒ:

แƒ›แƒ—แƒ”แƒšแƒ˜ แƒ แƒ˜แƒชแƒฎแƒ•แƒ˜

Parameters:

Text: Any string expression that contains an unambiguous file specification. You can also use URL notation.

This function determines the attributes for a specified file and returns the bit pattern that can help you to identify the following file attributes:

Error codes:

D'oh! You found a bug (text/sbasic/shared/00000003.xhp#err5 not found).

D'oh! You found a bug (text/sbasic/shared/00000003.xhp#err53 not found).

แƒ›แƒœแƒ˜แƒจแƒ•แƒœแƒ”แƒšแƒแƒ‘แƒ

Named constant

แƒ›แƒœแƒ˜แƒจแƒ•แƒœแƒ”แƒšแƒแƒ‘แƒ

แƒ’แƒแƒœแƒกแƒแƒ–แƒฆแƒ•แƒ แƒ”แƒ‘แƒ

ATTR_NORMAL

0

Normal files.

ATTR_READONLY

1

Read-only files.

ATTR_HIDDEN

2

Hidden file

ATTR_SYSTEM

4

แƒกแƒ˜แƒกแƒขแƒ”แƒ›แƒฃแƒ แƒ˜ แƒคแƒแƒ˜แƒšแƒ˜

ATTR_VOLUME

8

Returns the name of the volume

ATTR_DIRECTORY

16

Returns the name of the directory only.

ATTR_ARCHIVE

32

File was changed since last backup (Archive bit).


If you want to know if a bit of the attribute byte is set, use the following query method:

แƒ›แƒแƒ’แƒแƒšแƒ˜แƒ—แƒ˜:


Sub ExampleSetGetAttr
On Error GoTo ErrorHandler ' Define target for error handler
 If Dir("C:\test",16)="" Then MkDir "C:\test"
 If Dir("C:\test\autoexec.sav")="" Then FileCopy "c:\autoexec.bat", "c:\test\autoexec.sav"
 SetAttr "c:\test\autoexec.sav" ,0
 FileCopy "c:\autoexec.bat", "c:\test\autoexec.sav"
 SetAttr "c:\test\autoexec.sav" ,1
 Print GetAttr( "c:\test\autoexec.sav" )
 End
ErrorHandler:
 Print Error
 End
End Sub

Please support us!