Question

I have recently been working on a project that requires the user's password to be copied to the clipboard. I have this much:

set usr to short user name of (system info)
repeat
    display dialog "Please enter login password to continue:" default answer "" buttons {"Submit"} with title "Enter password" with icon stop with hidden answer
    set pswd to text returned of the result
    try
        set a to do shell script "echo test" user name usr password pswd with administrator privileges
        exit repeat
        end try
end repeat
set the clipboard to a

However, the clipboard simply sets to "test," presumably from where it says "echo test"

How do I fix this problem to set the password entered to the clipboard?

Was it helpful?

Solution

Try:

set the clipboard to pswd
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top