我正在为我的世界创建一个Mod安装程序,这是只为Mac。它使用多个应用程序分别完成一项任务(每个应用程序都是一个applescript应用程序)。但今天我开始做一个能做所有事情的应用程序。当我完成脚本并试图编译它时,出现语法错误:预期的行尾等,但找到脚本的末尾。我想我做的一切都是对的,但是我不知道是什么导致了这个问题。代码如下:
say "You are running iCraft version one point one for minecraft version 1.2.5"
display dialog "Which tool do you want to use?" buttons {"Mod Installer", "Backup", "Restore"} default button 3
set the button_pressed to the button returned of the result
if the button_pressed is "Mod Installer" then
do shell script "~/desktop/iCraft/iCraft.app/contents/resources/scripts/installer.sh"
display dialog "Insert all mod files into the Mods folder."
display dialog "Have you inserted all Mod files into the Mods folder?" buttons {"Yes", "No"} default button 2
if the button_pressed is "Yes" then
do shell script "~/desktop/iCraft/iCraft.app/contents/resources/scripts/installer2.sh"
display dialog "Finished"
else
display dialog "Insert mod files into the Mods folder and restart iCraft.app."
end if
if the button_pressed is "Backup" then
display dialog "Are you sure you want to backup your Minecraft.jar in it's current state?" buttons {"Yes", "No"} default button 2
if the button_pressed is "Yes" then
do shell script "~/desktop/iCraft/iCraft.app/contents/resources/scripts/backup.sh"
display dialog "Finished, find it in your Backups directory in the iCraft folder"
else
display dialog "Backup aborted"
end if
else
display dialog "Are you sure you want to restore your Minecraft.jar with your backup?" buttons {"Yes", "No"} default button 2
if the button_pressed is "Yes" then
do shell script "~/desktop/iCraft/iCraft.app/contents/resources/scripts/restore.sh"
display dialog "Restore finished"
else
display dialog "Restore aborted"
end if
end发布于 2012-06-11 00:22:25
最后一个end if实际上是缩进的if的结尾,留下外部if没有end if。或者反之亦然,不管你怎么看它。
换句话说,在最后一行之前添加另一个end if。
发布于 2014-02-21 00:56:16
这将会起作用:
say "You are running iCraft version one point one for minecraft version 1.2.5"
display dialog "Which tool do you want to use?" buttons {"Mod Installer", "Backup", "Restore"} default button 3
set the button_pressed to the button returned of the result
if the button_pressed is "Mod Installer" then
do shell script "~/desktop/iCraft/iCraft.app/contents/resources/scripts/installer.sh"
display dialog "Insert all mod files into the Mods folder."
display dialog "Have you inserted all Mod files into the Mods folder?" buttons {"Yes", "No"} default button 2
if the button_pressed is "Yes" then
do shell script "~/desktop/iCraft/iCraft.app/contents/resources/scripts/installer2.sh"
display dialog "Finished"
else
display dialog "Insert mod files into the Mods folder and restart iCraft.app."
end if
if the button_pressed is "Backup" then
display dialog "Are you sure you want to backup your Minecraft.jar in it's current state?" buttons {"Yes", "No"} default button 2
if the button_pressed is "Yes" then
do shell script "~/desktop/iCraft/iCraft.app/contents/resources/scripts/backup.sh"
display dialog "Finished, find it in your Backups directory in the iCraft folder"
else
display dialog "Backup aborted"
end if
else
display dialog "Are you sure you want to restore your Minecraft.jar with your backup?" buttons {"Yes", "No"} default button 2
if the button_pressed is "Yes" then
do shell script "~/desktop/iCraft/iCraft.app/contents/resources/scripts/restore.sh"
display dialog "Restore finished"
else
display dialog "Restore aborted"
end if
end if
end ifhttps://stackoverflow.com/questions/10970207
复制相似问题