3 Replies Latest reply: May 21, 2012 9:32 AM by Manuel Federanko
Manuel Federanko Level 1 Level 1 (0 points)

Hi everyone I have a big problem using apple script.

I want to make a script in witch I can duplicate an fily, I had selected and duplicate this into another folder "Users:..:Library:Application Support:minecraft:bin:"

in this folder i have two folders and a few files. But if i run the programm error msg -1728 comes.

Here is teh script:

 

 

tell application "Finder"

          set warntext to "Sind Sie sicher, dass Sie diese Version installieren wollen?"

          set bin to "..:Application Support:minecraft:bin" -- my problem

          set a to display dialog "Willkommen im automatischen Minecraft-Versionen wechsel! Wenn Sie abbrechen wollen warten Sie einfach, das Programm wird automatisch enden." buttons {"Vollversion", "Beta", "Alpha"} with title "MC Versionenwechsel" giving up after 10

  --(auswahl von welcher "Episode" von Minecraft)

 

 

  --Alpha--

 

          if button returned of result = "Alpha" then

                    display dialog "Wählen Sie nun Ihre Version aus" buttons {"1", "2", "3"} with title "MC Versionenwechsel"

  --hier noch die Versionen einfügen und sie in den Ordner "..:versions:Alpha" einlegen

 

 

  --Beta--

 

          else if button returned of result = "Beta" then

                    set beta to display dialog "Wählen Sie nun Ihre Version aus" buttons {"Beta 1.0", "Beta 1.5_01", "Beta 1.8.1"} with title "MC Versionenwechsel"

                    --

                    if button returned of result = "Beta 1.0" then

                              display dialog warntext with title "MC Versionenwechsel"

                              set answer to count folders in folder bin --

                              if answer > 1 then delete folder "minecraft.jar" of folder bin

                              if answer < 2 then delete file "minecraft.jar" of folder bin

                              duplicate "..:MCVersion Changer:Contents:versions:Beta:1.0:minecraft.jar" to bin

                              --

                    else if button returned of result = "Beta 1.5_01" then

                              display dialog warntext with title "MC Versionenwechsel"

                              set answer to count folders in folder bin

                              if answer > 1 then delete folder "minecraft.jar" of folder bin

                              if answer < 2 then delete file "minecraft.jar" of folder bin

                              duplicate "..:MCVersion Changer:Contents:versions:Beta:1.5_01:minecraft.jar" to bin

                              --

                    else if button returned of result = "Beta 1.8.1" then

                              display dialog warntext with title "MC Versionenwechsel"

                              set answer to count folders in folder bin

                              if answer > 1 then delete folder "minecraft.jar" of folder bin

                              if answer < 2 then delete file "minecraft.jar" of folder bin

                              duplicate "..:MCVersion Changer:Contents:versions:Beta:1.8.1:minecraft.jar" to bin

  --(pro Button wird dann die .jar ersetzt (die "--" sind die Trennstriche zwischen den Versionen.))

                    end if

 

 

  --Vollversion--

 

          else if button returned of result = "Vollversion" then

                    display dialog "Wählen Sie nun Ihre Version aus" buttons {"1.0.0", "1.1", "1.2.5"} with title "MC Versionenwechsel"

                    --

                    if button returned of result = "1.0.0" then

                              display dialog warntext with title "MC Versionenwechsel"

                              set answer to count folders in folder bin

                              if answer > 1 then delete folder "minecraft.jar" of folder bin

                              if answer < 2 then delete file "minecraft.jar" of folder bin

                              duplicate "..:MCVersion Changer:Contents:versions:Beta:1.0.0:minecraft.jar" to bin

                              --

                    else if button returned of result = "1.1" then

                              display dialog warntext with title "MC Versionenwechsel"

                              set answer to count folders in folder bin

                              if answer > 1 then delete folder "minecraft.jar" of folder bin

                              if answer < 2 then delete file "minecraft.jar" of folder bin

                              duplicate "..:MCVersion Changer:Contents:versions:Beta:1.1:minecraft.jar" to bin

 

                              --

                    else if button returned of result = "1.2.5" then

                              display dialog warntext with title "MC Versionenwechsel"

                              set answer to count folders in folder bin

                              if answer > 1 then delete folder "minecraft.jar" of folder bin

                              if answer < 2 then delete file "minecraft.jar" of folder bin

                              duplicate "..:MCVersion Changer:Contents:versions:Beta:1.2.5:minecraft.jar" to bin

                    end if

 

          else

                    display dialog "Das Programm wird beendet."

 

          end if

end tell

 

 

error msg:

 


tell application "Finder"

          display dialog "Willkommen im automatischen Minecraft-Versionen wechsel! Wenn Sie abbrechen wollen warten Sie einfach, das Programm wird automatisch enden." buttons {"Vollversion", "Beta", "Alpha"} with title "MC Versionenwechsel" giving up after 10

  --> {button returned:"Vollversion", gave up:false}

          display dialog "Wählen Sie nun Ihre Version aus" buttons {"1.0.0", "1.1", "1.2.5"} with title "MC Versionenwechsel"

  --> {button returned:"1.0.0"}

          display dialog "Sind Sie sicher, dass Sie diese Version installieren wollen?" with title "MC Versionenwechsel"

  --> {button returned:"OK"}

          count every folder of folder "..:Application Support:minecraft:bin"

                    --> error number -1728 from folder "..:Application Support:minecraft:bin"

Ergebnis:

error "„Finder“ hat einen Fehler erhalten: „folder \"..:Application Support:minecraft:bin\"“ kann nicht gelesen werden." number -1728 from folder "..:Application Support:minecraft:bin"





Apple Script, Mac OS X (10.7.3)
  • 1. Re: Apple script error msg -1728
    Frank Caggiano Level 7 Level 7 (23,865 points)

    The double dot notstion won't work there.

     

    Where is the Application Support folder? You need to specify the path.

     

    BTW Applscript questions arte best asked in Mac OS X Technologies

  • 2. Re: Apple script error msg -1728
    Camelot Level 8 Level 8 (45,790 points)

              set bin to "..:Application Support:minecraft:bin" -- my problem


    That is not a valid path, so it's not surprising that it doesn't work.

     

    In your original message you stated:

     

    I had selected and duplicate this into another folder "Users:..:Library:Application Support:minecraft:bin:"

     

    So at the very least you are missing the 'Library' element in the path.

     

    In either case, you should avoid defining paths in this way. Instead, let AppleScript find the directory when the script runs. For example:

     

    set AppSupportPath to (path to application support from user domain) as text

    set bin to AppSupportPath & "Minecraft:bin"

     

    The first line will find the current user's Library/Application Support directory to which you append the specific application path you're looking for.

  • 3. Re: Apple script error msg -1728
    Manuel Federanko Level 1 Level 1 (0 points)

    Thank you for your help, I am a totaly beginner, and saw some tutorials an youtube where those pathes where written like i did . I have dafenitly a lot to learn. and sorry for my bad english, i am gearmen xD thanks a lot.