以下是一个使用AppleScript的例子,展示了如何创建一个具有多行按钮对话框的脚本:
set buttonList to {"Button 1", "Button 2", "Button 3"} -- 按钮列表
set dialogTitle to "多行按钮对话框" -- 对话框标题
set dialogPrompt to "请选择一个按钮:" -- 对话框提示
-- 创建按钮对话框
display dialog dialogPrompt with title dialogTitle buttons buttonList default button 1
-- 获取用户的选择
set buttonChoice to button returned of result
-- 根据选择执行相应的操作
if buttonChoice is "Button 1" then
display dialog "你选择了 Button 1"
else if buttonChoice is "Button 2" then
display dialog "你选择了 Button 2"
else if buttonChoice is "Button 3" then
display dialog "你选择了 Button 3"
else
display dialog "没有选择任何按钮"
end if
这个脚本创建了一个带有三个按钮的对话框,并显示一个提示信息。用户可以选择其中一个按钮,并根据选择执行相应的操作。
请注意,按钮的顺序与其在按钮列表中的位置相对应。在上面的代码中,默认按钮是列表中的第一个按钮(即索引为1的按钮)。
你可以根据需要修改按钮列表、对话框标题和提示信息。根据按钮的选择,你还可以执行不同的操作。