简体   繁体   English

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

[英]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" 但是,剪贴板只是设置为“测试”,大概是从它说"echo test"

How do I fix this problem to set the password entered to the clipboard? 如何解决此问题以设置输入剪贴板的密码?

尝试:

set the clipboard to pswd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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