首页 > 解决方案 > Applescript 应为“”,但发现脚本结尾

问题描述

所以,这就是我到目前为止所写的,出于隐私原因,网络链接受到审查。我制作了这个脚本,这样我就可以轻松地访问我所有的课程链接。在我告诉程序完成任务后退出后,它不会为我的生命保存。这是我的代码:

display dialog "Where would you like to go?" buttons {"Math", "English", "Other"} default button 3
set the button_pressed to the button returned of the result
if the button_pressed is "Math" then
    display dialog "Select which math you would like to access." buttons {"Math", "Science", "Quit"} default button 3
    set the button_pressed to the button returned of the result
    if the button_pressed is "Math" then
        display dialog "Select which math you would like to access." buttons {"Mathway", "Powerschool", "Quit"} default button 3
        set the button_pressed to the button returned of the result
        if the button_pressed is "Mathway" then
            tell application "Google Chrome"
                activate
                open location "https://www.mathway.com/Algebra"
            end tell
            delay 1
            tell application "Google Chrome" to activate
            tell application "School Shortcuts" to quit
        else if the button_pressed is "Powerschool" then
            tell application "Google Chrome"
                activate
                open location "_"
            end tell
            delay 1
            tell application "Google Chrome" to activate
        else
            tell application "School Shortcuts" to quit
        end if
    else if the button_pressed is "English" then
        display dialog "Select which math you would like to access." buttons {"Science Calculators", "Powerschool", "Quit"} default button 3
        set the button_pressed to the button returned of the result
        if the button_pressed is "Science Calculators" then
            tell application "Google Chrome"
                activate
                open location "https://www.google.com/search?q=science+calculator&oq=science+calculator&aqs=chrome..69i57j0l9.6020j0j7&sourceid=chrome&ie=UTF-8"
            end tell
            delay 1
            tell application "Google Chrome" to activate
            tell application "School Shortcuts" to quit
        else if the button_pressed is "Powerschool" then
            tell application "Google Chrome"
                activate
                open location "_"
            end tell
            delay 1
            tell application "Google Chrome" to activate
        else
            tell application "School Shortcuts" to quit
        end if
    else
        tell application "School Shortcuts" to quit
    end if
else
    display dialog "Select which you would like to access." buttons {"Spanish", "Comp Tech", "Quit"} default button 3
    set the button_pressed to the button returned of the result
    if the button_pressed is "Spanish" then
        display dialog "Spanish" buttons {"Google Classroom", "Translate", "Quit"} default button 3
        set the button_pressed to the button returned of the result
        if the button_pressed is "Google Classroom" then
            tell application "Google Chrome"
                activate
                open location "_"
            end tell
            delay 1
            tell application "Google Chrome" to activate
        else if the button_pressed is "Translate" then
            tell application "Google Chrome"
                activate
                open location "https://www.google.com/search?q=translate&oq=translate&aqs=chrome.0.69i59j0j0i433j0j0i433j69i60l3.1944j0j7&sourceid=chrome&ie=UTF-8"
            end tell
            delay 1
            tell application "Google Chrome" to activate
        else
            tell application "School Shortcuts" to quit
        end if
    else if the button_pressed is "Comp Tech" then
        display dialog "Comp Tech" buttons {"Google Classroom", "Youtube", "Quit"} default button 3
        set the button_pressed to the button returned of the result
        if the button_pressed is "Google Classroom" then
            tell application "Google Chrome"
                activate
                open location "_"
            end tell
            delay 1
            tell application "Google Chrome" to activate
            
        else if the button_pressed is "Youtube" then
            tell application "Google Chrome"
                activate
                open location "youtube.com"
            end tell
            delay 1
            tell application "Google Chrome" to activate
        else
            tell application "School Shortcuts" to quit" to quit
        end if
        
    else
        
    end if
    
end if


end

如果您对它为什么这样做有任何想法,我将不胜感激。

标签: syntax-errorapplescript

解决方案


错误

预期的“” 但发现脚本结束

表示不平衡的双引号。

在脚本的末尾是

tell application "School Shortcuts" to quit" to quit

删除(最后一个)双引号和该行的其余部分

tell application "School Shortcuts" to quit

推荐阅读