Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to uncheck the windows attribute readonly
Message
De
26/01/2004 16:54:24
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
26/01/2004 16:43:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00870776
Message ID:
00870789
Vues:
6
>I use this to make it readonly using WSH:
>
>IF FILE("C:\scanned2903.tif") THEN
> oFSO = CREATEOBJECT("Scripting.FileSystemObject")
> oFile = oFSO.GetFile("C:\scanned2903.tif")
> * Set the read-only bit.
> oFile.Attributes = BITOR(oFile.Attributes, 1)
>ENDIF
>######################################
>I use BITOR to make it read only.
>I don't know how to reverse the BITOR.
>
>Thank you..

The following involves some quick guesses; you have to do some experimenting:

Pressumably, in the above example, the R/O attribute would be the last bit. To use BITOR, etc., you may also have to know how many bytes you have in total. Assuming it is 8 bits:

BITOR(oFile.Attributes, 1) would set the value of the very last bit to 1.

BITAND(oFile.Attributes, 254) would set the last bit to 0. 254 in binary is 11111110.

Without knowing how many attribute bits you have, you may be able to use the following combination:

First, use

BITOR(oFile.Attributes, 1)

to set the bit. Then, use

BITXOR(oFile.Attributes, 1)

This would toggle the last bit.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform