我正在为Minecraft创建一个仅适用于Mac的Mod安装程序。它使用多个应用程序来执行每个任务(每个都是一个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
答案 0 :(得分:2)
最后end if
实际上结束了缩进的if
,而外if
没有end if
。反之亦然,但是你想看看它。
换句话说,在最后一行之前添加另一个end if
。
答案 1 :(得分:1)
这将有效:
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 if