Applescript代码凌乱,如何修复

Applescript代码凌乱,如何修复,applescript,Applescript,这是我的代码,它是一团糟。有人能帮我修理吗?它永远不会加载在脚本中提供帮助并不容易,因为阅读它时,我不明白您想做什么。但是,您没有正确使用“Result”变量。此变量始终包含上一个对话框的结果,因此当您有两个对话框时,对该变量的任何测试都将始终给出第二个对话框的结果,而不是第一个对话框的结果 解决方案是将结果指定给单独的变量,如下面的示例: display dialog "Play Nillys Realm?" buttons {"Yes please", "No"} default butto

这是我的代码,它是一团糟。有人能帮我修理吗?它永远不会加载

在脚本中提供帮助并不容易,因为阅读它时,我不明白您想做什么。但是,您没有正确使用“Result”变量。此变量始终包含上一个对话框的结果,因此当您有两个对话框时,对该变量的任何测试都将始终给出第二个对话框的结果,而不是第一个对话框的结果

解决方案是将结果指定给单独的变量,如下面的示例:

display dialog "Play Nillys Realm?" buttons {"Yes please", "No"} default button 1

if result = {button returned: "Yes please"} then
  display dialog "Long time loading, u think?" buttons {"Yes", "No"} 
end if

if result = {button returned:"No"} then
  tell application "Google Chrome"
    repeat 5 times
        open location "http://test.nillysrealm.com"
        activate
    end repeat


    if result = {button returned:"Yes"} then
      tell application "Google Chrome"
        repeat 10 times
          open location "http://test.nillysrealm.com"
          activate
        end repeat
set Dialog1 to display dialog "do you agree ?" buttons {"Yes please", "No"} default button 1
if button returned of Dialog1 is "Yes please" then
-- do something here when user click "yes please"
else
-- do somthing here when user click "No"
end if