#DEFINE FILE_ATTRIBUTE_READONLY 0x01 #DEFINE FILE_ATTRIBUTE_HIDDEN 0x02 #DEFINE FILE_ATTRIBUTE_SYSTEM 0x04 #DEFINE FILE_ATTRIBUTE_DIRECTORY 0x10 #DEFINE FILE_ATTRIBUTE_ARCHIVE 0x20 #DEFINE FILE_ATTRIBUTE_NORMAL 0x80 #DEFINE FILE_ATTRIBUTE_TEMPORARY 0x0100 declare Integer GetFileAttributes in win32api string @ declare Integer SetFileAttributes in win32api string @, Integer function FileResetReadOnly(FileName) local fa fa = GetFileAttributes(@FileName) if( fa == -1 ) return .F. endif if( empty(bitand(fa, FILE_ATTRIBUTE_READONLY)) ) && file was not readonly return .F. endif fa = bitand(fa, bitnot(FILE_ATTRIBUTE_READONLY)) if( empty(SetFileAttributes(@FileName, fa)) ) return .F. endif endfuncWith WSH:
#define READONLY 1 #define HIDDEN 2 #define SYSTEM 4 #define ARCHIVE 32 oFSO = CreateObject("Scripting.FileSystemObject") oFile = oFSO.GetFile("c:\xyz.doc") oFile.Attributes = READONLY && changes to RO>Hallo