Re: [R] Mot de passe sur un dossier
Posté : mer. 22 déc. 2010 16:12
Comme ça :
Tésté et approuvé.
Code : Tout sélectionner
Global $title = "Coffre fort avec un mot de passe"
If FileExists(@ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}") Then ouvre()
If Not FileExists(@ScriptDir & "\Coffre") Then coffre()
confirm()
Func confirm()
$mMsgbox = MsgBox(4, $title, "Voulez-vous vérouiller le dossier Coffre ?")
If $mMsgbox = 6 Then
ferme()
ElseIf $mMsgbox = 7 Then
fin()
Else
confirm()
EndIf
EndFunc ;==>confirm
Func ferme()
DirMove(@ScriptDir & "\Coffre", @ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}")
FileSetAttrib(@ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}", "+HS")
MsgBox(0, $title, "Le dossier Coffre a été vérouillé")
fin()
EndFunc ;==>ferme
Func ouvre()
$vMdP = InputBox($title, "Mot de passe pour ouvrir le coffre", "", "|")
If Not $vMdP = "pass" Then niet()
FileSetAttrib(@ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}", "-HS")
DirMove(@ScriptDir & "\Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}", "Coffre")
MsgBox(0, $title, "Le dossier Coffre est ouvert")
fin()
EndFunc ;==>ouvre
Func niet()
MsgBox(0, $title, "Mot de passe incorrect")
fin()
EndFunc ;==>niet
Func coffre()
DirCreate("Coffre")
MsgBox(0, $title, "Le dossier Coffre est crée")
fin()
EndFunc ;==>coffre
Func fin()
Exit
EndFunc ;==>fin