0
我最近正在研究一個AppleScript項目,該項目需要將用戶的密碼複製到剪貼板供以後使用。我已經有了提示用戶輸入密碼的部分,但是如何將返回的文本(他們的密碼)設置到剪貼板。我當前的代碼給我的錯誤:Can’t make text returned of «script» into type text.
這是我到目前爲止有:如何將剪貼板設置爲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
do shell script "echo test" user name usr password pswd with administrator privileges
exit repeat
end try
end repeat
set a to (text returned) as list
set AppleScript's text item delimiters to linefeed
set a to a as text
set the clipboard to a