Hi Yvan.
your script gives me the following error.
tell application “VeraCrypt”
activate
activate
end tell
tell application “System Events”
set frontmost of process “System Preferences” to true
→ error number -1728 from process “System Preferences”
Result:
error “System Events got an error: Can’t set process "System Preferences" to true.” number -10006 from process “System Preferences”
PS VeryCrypt is a brilliant open source application free to use.