1

Mac専用のMinecraft用のModインストーラーを作成しています。複数のアプリを使用して、それぞれ1つのタスクを実行しました(それぞれがAppleScriptアプリでした)。しかし、今日、私はすべてを実行する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
4

2 に答える 2

2

最後end ifは、実際にはifインデントされた を終了し、外側ifend if. またはその逆ですが、あなたはそれを見たいと思っています。

end ifつまり、最後の行の前にもう 1 つ追加します。

于 2012-06-10T16:22:24.630 に答える
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
于 2014-02-20T16:56:16.317 に答える