When using ssh-keygen if you don't specify a default directory the default directory is shown:
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
I need to get the path and file name, "/Users/monkeypunch/.ssh/id_rsa".
How about this:
to getDefaultKeyPath()
try
do shell script ("ssh-keygen")
on error response
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"(", ")"}
set defaultKeyPath to text item 2 of response
set AppleScript's text item delimiters to oldDelim
end try
return defaultKeyPath
end getDefaultKeyPath
getDefaultKeyPath() will return /Users/monkeypunch/.ssh/id_rsa
.