Skip to content

Instantly share code, notes, and snippets.

@surajsau
Created May 24, 2020 10:22
Show Gist options
  • Save surajsau/7001807f48fc56390f381c06a986bc61 to your computer and use it in GitHub Desktop.
Save surajsau/7001807f48fc56390f381c06a986bc61 to your computer and use it in GitHub Desktop.
Applescript for password retrieval from file
on readPassword()
try
-- (1)
set logFile to (path to documents folder) as text
set theFolder to POSIX path of logFile
set passwordFile to theFolder & "password.txt"
-- (2)
open for access passwordFile
-- (3)
set fileContents to paragraphs of (read passwordFile)
close access passwordFile
return fileContents
on error errorMsg
return {}
end try
end readPassword
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment