将剪贴板设置为返回AppleScript的文本

时间:2014-04-30 16:42:04

标签: passwords applescript

我最近一直致力于一个需要将用户密码复制到剪贴板的项目。我有这么多:

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

但是,剪贴板只需设置为" test,"可能来自"echo test"

的地方

如何修复此问题以设置输入到剪贴板的密码?

1 个答案:

答案 0 :(得分:1)

尝试:

set the clipboard to pswd