【发布时间】:2016-04-05 10:40:02
【问题描述】:
好的,这是我的第一个 Xcode 项目,我正在从现有的 applescript 制作一个新的应用程序,使用 Cocoa-applescript 为它制作一个 GUI(这是主要的变化)。我阅读了所有我能找到的关于 cocoa applescript 中的 GUI,我想把它转换一下:
choose from list baseactions with title "Version Control" default items defaultaction with prompt "What do you want to do?" OK button name "Go" cancel button name "Quit"
set choice1 to result as string
if choice1 = false then
error number -128
else if choice1 = "Make New Project" then
set thechoice to "new"
else if choice1 = "Edit Existing Project" then
set choice2 to button returned of (display dialog "What would you like to do with the existing Project?" buttons {"Quit", "Make new version", "Create Project Folder"} default button 3 with title "Version Control" with icon "Icon.png")
if choice2 = "Quit" then
error number -128
else if choice2 = "Create Project Folder" then
set thechoice to "folder"
else if choice2 = "Make new version" then
set thechoice to "version"
end if
else if choice1 = "Change Settings" then
set thechoice to "settings"
end if
到一个 GUI,它不是多个对话框,而是一个流畅的 GUI,当您按下按钮时,根据按下的按钮,它将“选择”设置为“新”、“文件夹”、“版本” " 或 "设置" 然后脚本的其余部分继续。我已经在 Xcode 中制作了 GUI: [我没有足够的声望来发布图片,但 GUI 看起来像这样:
Make New Project
Import to Existing Project
Edit Existing Project
Settings
并将每个按钮链接到一个处理程序(例如“创建新项目”按钮):
on NewProject_(sender)
set thechoice to "new"
end
每个按钮都有类似的处理程序。问题是,在我按下按钮后,它不会继续执行脚本的其余部分 - 它只是停止。因此,对于任何知道 Cocoa-Applescripts 如何工作的人,我将不胜感激。
【问题讨论】:
标签: xcode cocoa user-interface applescript-objc