Hi,
kann mir jemand eine Code oder Link posten, wie man mit PB Datei - Attribute setzt bzw. aufhebt (z. B. schreibgeschützt).
Danke schon mal
Hanniball
Datei - Attribute setzen
Ich sag nur eines:
http://forums.purebasic.com/german/search.php
Das liefert folgende Ergebnisse zu Tage:
http://forums.purebasic.com/german/view ... iattribute
http://forums.purebasic.com/german/view ... iattribute
http://forums.purebasic.com/german/search.php
Das liefert folgende Ergebnisse zu Tage:
http://forums.purebasic.com/german/view ... iattribute
http://forums.purebasic.com/german/view ... iattribute
PB 4.30
Code: Alles auswählen
Macro Happy
;-)
EndMacro
Happy End
Code: Alles auswählen
; English forum: http://purebasic.myforums.net/viewtopic.php?t=6065&highlight=
; Author: PB
; Date: 05. May 2003
Procedure.s GetAttribMask(file$)
mask$="-----" : r=GetFileAttributes_(file$)
If r & #FILE_ATTRIBUTE_ARCHIVE : mask$="A"+Mid(mask$,2,5) : EndIf
If r & #FILE_ATTRIBUTE_COMPRESSED : mask$=Left(mask$,1)+"C"+Mid(mask$,3,3) : EndIf
If r & #FILE_ATTRIBUTE_HIDDEN : mask$=Left(mask$,2)+"H"+Mid(mask$,4,2) : EndIf
If r & #FILE_ATTRIBUTE_READONLY : mask$=Left(mask$,3)+"R"+Mid(mask$,5,1) : EndIf
If r & #FILE_ATTRIBUTE_SYSTEM : mask$=Left(mask$,4)+"S" : EndIf
ProcedureReturn mask$
EndProcedure
;
;
; eigener Gehirnschmalz von uweb :
;
Procedure.s SetAttribMask(file$,a,c,h,r,s)
Attribute=0 << 32
If a : Attribute = Attribute | #FILE_ATTRIBUTE_ARCHIVE : EndIf
If c : Attribute = Attribute | #FILE_ATTRIBUTE_COMPRESSED : EndIf
If h : Attribute = Attribute | #FILE_ATTRIBUTE_HIDDEN : EndIf
If r : Attribute = Attribute | #FILE_ATTRIBUTE_READONLY : EndIf
If s : Attribute = Attribute | #FILE_ATTRIBUTE_SYSTEM : EndIf
SetFileAttributes_(file$,Attribute)
EndProcedure
Procedure.s AddAttribMask(file$,a,c,h,r,s)
Attribute=GetFileAttributes_(file$)
If a : Attribute = Attribute | #FILE_ATTRIBUTE_ARCHIVE : EndIf
If c : Attribute = Attribute | #FILE_ATTRIBUTE_COMPRESSED : EndIf
If h : Attribute = Attribute | #FILE_ATTRIBUTE_HIDDEN : EndIf
If r : Attribute = Attribute | #FILE_ATTRIBUTE_READONLY : EndIf
If s : Attribute = Attribute | #FILE_ATTRIBUTE_SYSTEM : EndIf
SetFileAttributes_(file$,Attribute)
EndProcedure
Debug "Achtung ausgewählte Date enthält am Ende nur Archiv-Attribut"
File.s = OpenFileRequester("Achtung ausgewählte Date enthält am Ende nur Archiv-Attribut", "", "Alle Dateien (*.*)|*.*", 0)
Debug GetAttribMask(File.s)
AddAttribMask(File.s,0,0,1,0,0)
Debug GetAttribMask(File.s)
SetAttribMask(File.s,1,0,0,0,0)
Debug GetAttribMask(File.s)
Danke sehr!
@uweb
Vielen Dank, jetzt habe ich es kapiert. Und es funzt prima!
Gruß Hanniball
Vielen Dank, jetzt habe ich es kapiert. Und es funzt prima!
Gruß Hanniball