--
set dialogMessage to "Passwort:"
set dialogTitle to "FileVault-Schutz für Neustart aufheben"
set dialogButtonCancel to "Abbrechen"
set dialogButtonRestart to "Neustart"
--
tell application "System Events"
--
set dialogButtons to {dialogButtonCancel, dialogButtonRestart}
--
set dialogResult to display dialog dialogMessage default answer "" with title dialogTitle buttons dialogButtons default button 2 with text and hidden answer
--
set passphrase to text returned of dialogResult
if (length of passphrase < 1) then
return false
end if
--
end tell
--
-- display alert "Passwort" message passphrase
--
set plistFilePath to my getPlistFilePath()
if (length of plistFilePath < 1) then
return false
end if
--
-- display alert "plist path" message plistFilePath
--
tell application "System Events"
--
set plistDictionary to make new property list item with properties {kind:record}
--
set plistFile to make new property list file with properties {contents:plistDictionary, name:plistFilePath}
--
tell property list items of plistFile
--
make new property list item at end with properties {kind:string, name:"Password", value:passphrase}
--
end tell
--
end tell
--
set needsRestart to false
--
try
--
do shell script "fdesetup authrestart -delayminutes -1 -inputplist < " & quoted form of plistFilePath with administrator privileges
--
my removePlistFile()
--
set needsRestart to true
--
on error errorText number errorNumber
--
my removePlistFile()
--
display alert errorNumber as warning message errorText
--
end try
--
if (needsRestart is true) then
tell application "Finder" to restart
end if
--
on getPlistFilePath()
--
set folderPath to (POSIX path of (path to trash folder))
if (length of folderPath < 1) then
return ""
end if
--
set filePath to folderPath & ".sf34dfsdf30sdf23fd1.plist"
if (length of filePath < 1) then
return ""
end if
--
return filePath
--
end getPlistFilePath
--
on removePlistFile()
--
set filePath to my getPlistFilePath()
if (length of filePath < 1) then
return false
end if
--
do shell script "rm " & quoted form of filePath
--
return true
--
end removePlistFile
--