![](/img/trans.png)
[英]In Itext7, how can i go through a string and see if my current font can display the string correctly?
[英]AppleScript - How can I get this string to properly go through?
set UserName to do shell script "whoami"
set AD to do shell script ("dscl "/Active Directory/YC/All Domains/" read /Users/" & UserName)
我的错误:应为“,”,但找到标识符
所以我试图在活动目录中找到一个用户 SMBHome,因为我们基于它映射了我们的驱动器。 但该命令的问题是双字符串。 "/Active Directory/YC/All Domains/" 有一个字符串,否则它不会正确排队。
但是要执行shell脚本(“COMMAND HERE”)也必须是一个字符串..
我该如何解决这个问题?
有没有更简单的方法来做到这一点?
完整脚本:
set UserName to do shell script "whoami"
set AD to do shell script ("dscl "/Active Directory/YC/All Domains/" read /Users/" & UserName)
if AD contains "StaffShare" then
set SMBHome to "smb://domain/StaffShare"
else
set SMBHome to "smb://domain/EmployeeShare"
end if
set mounted_disk to list disk
mount volume SMBHome as user name UserName
没关系,我真的想通了。 类似于 Lua "dscl \\"/Active Directory/YC/All Domains/\\" read /Users/" & UserName
虽然我仍然想看看是否有人对此有更好的解决方案。 :)
您可以使用单引号:
set AD to do shell script "dscl '/Active Directory/YC/All Domains/' read $HOME"
但是你这样做的方式,通过转义双引号,它完全合法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.