【问题标题】:Applescript is end telling without reasonApplescript 无缘无故地结束了
【发布时间】:2016-03-11 03:39:22
【问题描述】:

Applescript 结果是 Display "end tell"

我不知道为什么会这样,需要修复它。 当我第二次点击下一页时,它会随机“结束”

这是脚本:

display dialog "What would you like to launch? choose wisely!" buttons
    {"Next Page", "cancel", "Google Chrome"} default button "Next Page"

if result = {button returned:"Google Chrome"} then
    tell application "Google Chrome" to activate

else if result = {button returned:"cancel"} then

else if result = {button returned:"Next Page"} then
    display dialog "Page 2" buttons {"Next page", "Mari0", "Minecraft"} default button "Next page"

    if result = {button returned:"Minecraft"} then
        tell application "Minecraft" to activate

    else if result = {button returned:"Mari0"} then
        tell application "Terminal"
            activate
            do script with command "open /Users/_________/Desktop/Mari0.app/"
            delay 1
            quit
        end tell

    else if return = {button returned:"Next page"} then
        display dialog "Page 3" buttons {"Safari", "Roblox", "Next Page"} default button "Next  Page"


        if result = {button returned:"Roblox"} then
            tell application "Google Chrome" to open location "http://www.roblox.com/home"

        else if result = {button returned:"Safari"} then
            tell application "Safari" to activate

        else if return = {button returned:"Next Page"} then
            display dialog "Final Page" buttons {"iMessages", "Applescript Folder", "Back to Start"} default button "Back to start"

            if return = {button returned:"Back to start"} then
                run script (open applications)

            else if return = {button returned:"iMessages"} then
                tell application "Messages" to activate

            else if return = {button returned:"Applescript Folder"} then
                do shell script "open /Users/__________/Desktop/Applescript/"



            end if
        end if
    end if
end if

这些是脚本的结果:

告诉应用程序“脚本编辑器”

显示对话框“您想启动什么?明智地选择!” 按钮 {“下一页”、“取消”、“Google Chrome”} 默认按钮“下一页” 页面"
--> {按钮返回:“下一页”}
显示对话框“第 2 页” 按钮 {“下一页”、“Mari0”、“我的世界”} 默认按钮“下一页” --> {按钮返回:“下一页”}
结束讲述

【问题讨论】:

  • 它只是显示“end tell”还是中途停止执行?问题不清楚。

标签: applescript


【解决方案1】:

由于您在脚本编辑器中运行此测试,因此您告诉脚本编辑器运行它。自然地,tell 块以 end tell 结束。脚本已结束,脚本编辑器已完成其工作。

【讨论】:

  • 我建议使用“从列表中选择”对话框,它允许用户直接选择要运行的应用程序,而不是所有这些对话框。它应该更加用户友好。
  • 我同意。从列表中选择更有效。
  • 那么,您是否断言“end tell”实际上是由脚本编辑器而不是脚本产生的?如果是这种情况,它应该与任何其他脚本相同。
  • 是的,我愿意。所有输出的东西都由一个tell脚本编辑器开始,并以一个end tell结束。它由脚本编辑器生成,与任何其他脚本相同。
猜你喜欢
  • 1970-01-01
  • 2023-03-10
  • 1970-01-01
  • 1970-01-01
  • 2014-07-09
  • 1970-01-01
  • 2020-03-06
  • 2019-01-13
  • 2012-09-06
相关资源
最近更新 更多