Cocoa-Applescript:在 applescript 中放置 GUI

Cocoa-Applescript: Placing a GUI in an applescript

好的,这是我的第一个 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,当您按下一个按钮时,根据按下的按钮,它将 'thechoice' 设置为 "new", "folder"、"version" 或 "settings" 然后脚本的其余部分继续。我已经在 Xcode 中制作了 GUI: [我没有足够的声誉来 post 图片,但是 GUI 看起来像这样:

Make New Project
Import to Existing Project
Edit Existing Project

Settings

并将每个按钮链接到一个处理程序(例如 "Make New Project" 按钮):

on NewProject_(sender)
    set thechoice to "new"
end

每个按钮都有类似的处理程序。问题是,在我按下按钮后,它不会继续执行脚本的其余部分 - 它只是停止了。因此,如果有人知道 Cocoa-Applescripts 是如何工作的,我将不胜感激。

对于初学者的 ASOC 介绍,请在此处观看 "INTRO VIDEO": http://www.macosxautomation.com/applescript/develop/index.html 或者去这里: http://asobjcresources.weebly.com

或者阅读 Shane Stanley 的优秀书籍 "AppleScriptObjC Explored",您可以在上面列出的介绍视频框下在线购买。