简体   繁体   中英

Set clipboard to text returned AppleScript

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?

尝试:

set the clipboard to pswd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM