我正在尝试启动一个已选中复选框的对话框,但没有多少研究显示我如何执行此操作。包含我的脚本,打开对话框:
mount volume "smb://xyz-server/user-share/servervolume"
mount volume "smb://xyz-server/useradmin-share/servervolume"
答案 0 :(得分:0)
Applescript的标准对话框中没有复选框对话框。您可以在这里使用“从列表中选择”吗?类似的东西:
property serverList : {"smb://xyz-server/user-share/servervolume", "smb://xyz-server/useradmin-share/servervolume"}
set serverChoice to (choose from list serverList with prompt "Please select the volume(s) to mount" default items (item 1 of serverList) OK button name {"Mount"} cancel button name {"Cancel"} with multiple selections allowed)
repeat with thisPath in serverChoice
tell application "Finder"
mount volume thisPath
end tell
end repeat
答案 1 :(得分:0)
很抱歉,但简单的AppleScript对话框等没有复选框,但您可以使用带有自定义按钮的对话框,例如。
set isOver13 to the button returned of (display dialog "Are you 13 or older?" buttons {"Cancel", "No", "Yes"})
(returns "Yes" or "No" for the button selected)
或者像“jweaks”所说,你也可以使用像列表中选择的东西,例如
set isOver13 to item 1 of (choose from list {"Yes", "No"})
(returns "Yes" or "No" for the item choosen)
但是如果你绝对想要使用复选框,那么还有另外一种方法:-o
你需要跨越到cocoa-applescript(ASObjC),这基本上是applecript编码的下一步,ASObjC几乎是Objective-C动作,命令等......但是在AppleScript编码语言中:o。要做到这一点,你需要获得Xcode,并查看AppleScript Objective-C教程;)
Hope this Helped :D
答案 2 :(得分:0)
该窗口属于进程NetAuthAgent
,您只能使用GUI脚本单击该复选框。
tell application "System Events"
repeat until exists window 1 of process "NetAuthAgent"
delay 0.2
end repeat
tell process "NetAuthAgent"
click checkbox 1 of window 1
end tell
end tell