【发布时间】:2014-02-04 21:21:20
【问题描述】:
在我的部门,我们使用 samba 共享服务器作为员工的存储空间。对于使用 Apple 机器的员工,我们正在尝试使用 AppleScript 应用程序来获取用户的用户名和密码,然后使用它们来安装驱动器。当用户输入包含转义字符的密码时,就会出现问题;例如 abcdefg/。这是设置用户名和密码变量的对话框代码:
set user_name_dialog to display dialog "Enter your User ID: " default answer "" buttons {"Next"} default button "Next"
set user_name to text returned of user_name_dialog
--this line prompts the user for their password and sets the returned result as the variable "user_password"
set user_password_dialog to display dialog "Enter your Password. " & return & return & "WARNING: If you are running Panther (MacOS 10.3), your input will be displayed in this box as clear text." default answer "" buttons {"Next"} default button "Next" with hidden answer
set user_password to text returned of user_password_dialog
这是为安装驱动器而运行的 shell 脚本行:
do shell script "mount -t smbfs //" & user_name & ":" & user_password & "@SOME IP ADDRESS/SOME FOLDER/ /SOME MOUNT POINT/" & user_name & "-SOME SHARE"
现在我从一项小研究中知道,它可能只是某处的额外引号,我什至尝试过
quoted form of
没有任何运气。输入带有转义字符的字符串时收到的错误消息如下:
error "mount_smbfs: server connection failed: No route to host" number 68
任何帮助都会非常感谢,因为我对 AppleScript 的经验非常有限。
【问题讨论】:
标签: applescript