Apple Script error -10006

Hello guys, I have an big Problem with my Programm in Apple script...

Everything of it works until a simple "duplicate" command. Then I will get error 10006 here is the script:

ps: I use "x" for folder name where I get "minecraft.jar"



tell application "Finder"



--Ermitteln des Ordner "Versionen" welcher sich im Ordner "Resources befindet"--

set i to (path to me) as string

set ii to (container of item i) as text

set theFolder to (container of folder ii) as text

set Versionen to folder "Versionen" of folder "Resources" of folder "Contents" of file i



--Application Support definieren--

set AppSupp to (path toapplication supportfromuser domain) as text



--Einleitende Worte für das Programm--

display dialog "Willkommen im automatischen Versionen-Wechsel Programm für Minecraft. Bitte wählen Sie aus der folgenden Liste die Version, wechle Sie installiert haben wollen. -Ich weise darauf hin, dass die benützung auf eigene Gefahr ist."



--Auswahl der Version--

set liste to choose from list {"Vollversion 1.2.5", "Vollversion 1.2.3", "Vollversion 1.1", "Vollversion 1.0.0", "Beta 1.9 Pre 6", "Beta 1.8.1", "Beta 1.8", "Beta 1.7.3", "Beta 1.6.6", "Beta 1.5_01", "Beta 1.4_01", "Beta 1.3_01", "Beta 1.2_02", "Beta 1.1_02", "Beta 1.0"}


if liste is {"Vollversion 1.2.5"} then set x to "v_1.2.5"

if liste is {"Vollversion 1.2.3"} then set x to "v_1.2.3"

if liste is {"Vollversion 1.1"} then set x to "v_1.1"

if liste is {"Vollversion 1.0.0"} then set x to "v_1.0.0"

if liste is {"Beta 1.9 Pre 6"} then set x to "b_1.9 Pre 6"

if liste is {"Beta 1.8.1"} then set x to "b_1.8.1"

if liste is {"Beta 1.8"} then set x to "b_1.8"

if liste is {"Beta 1.7.3"} then set x to "b_1.7.3"

if liste is {"Beta 1.6.6"} then set x to "b_1.6.6"

if liste is {"Beta 1.5_01"} then set x to "b_1.5_01"

if liste is {"Beta 1.4_01"} then set x to "b_1.4_01"

if liste is {"Beta 1.3_01"} then set x to "b_1.3_01"

if liste is {"Beta 1.2_02"} then set x to "b_1.2_02"

if liste is {"Beta 1.1_02"} then set x to "b_1.1_02"

if liste is {"Beta 1.0"} then set x to "b_1.0"



--Ist Minecraft schon Installiert? Wenn Ja dann löschen--

if folder "minecraft" of folder AppSupp exists then

delete folder "minecraft" of folder AppSupp

end if



--MinecraftVorlage entpacken--

open file "minecraft.zip" of Versionen



--Pause--


delay 1



--Finder Fenster schließen--


closeFinder window 1



--Vorbereiten der MinecraftVorlage--

duplicate file "mincraft.jar" of folder x of Versionen to folder "bin" of folder "minecraft" of Versionen.

Could anyone say me what's wrong with this line?



--Installieren--

duplicate folder "minecraft" of Versionen to AppSupp



--Pause--


delay 1



--Temporäre Dateien löschen--

delete folder "minecraft" of Verionen



--Alles Richtig?--

if folder "minecraft" of folder AppSupp exists then

display dialog "Die Installation von Minecraft wurde erfolgreich abgeschlossen!" with title "MC-Installer"

else

display dialog "Es ist leider ein unerwartetes Problem bei der Installation vorgelaufen." with title "MC-Installer"

end if


end tell



Error msg:


tell current application


path tocurrent application

--> alias "Macintosh HD:Users:manuelfederanko:Desktop:VersioChanger.app:"

end tell

tell application "Finder"

get container of item "Macintosh HD:Users:manuelfederanko:Desktop:VersioChanger.app:"

--> "Macintosh HD:Users:manuelfederanko:Desktop:"

get container of folder "Macintosh HD:Users:manuelfederanko:Desktop:"

--> "Macintosh HD:Users:manuelfederanko:"

get folder "Versionen" of folder "Resources" of folder "Contents" of file "Macintosh HD:Users:manuelfederanko:Desktop:VersioChanger.app:"

--> folder "Versionen" of folder "Resources" of folder "Contents" of application file "VersioChanger.app" of folder "Desktop" of folder "manuelfederanko" of folder "Users" of startup disk


path toapplication supportfromuser domain

--> alias "Macintosh HD:Users:manuelfederanko:Library:Application Support:"

display dialog "Willkommen im automatischen Versionen-Wechsel Programm für Minecraft. Bitte wählen Sie aus der folgenden Liste die Version, wechle Sie installiert haben wollen. -Ich weise darauf hin, dass die benützung auf eigene Gefahr ist."


--> {button returned:"OK"}

choose from list {"Vollversion 1.2.5", "Vollversion 1.2.3", "Vollversion 1.1", "Vollversion 1.0.0", "Beta 1.9 Pre 6", "Beta 1.8.1", "Beta 1.8", "Beta 1.7.3", "Beta 1.6.6", "Beta 1.5_01", "Beta 1.4_01", "Beta 1.3_01", "Beta 1.2_02", "Beta 1.1_02", "Beta 1.0"}

--> {"Beta 1.8.1"}

exists folder "minecraft" of folder "Macintosh HD:Users:manuelfederanko:Library:Application Support:"


--> false

open file "minecraft.zip" of folder "Versionen" of folder "Resources" of folder "Contents" of application file "VersioChanger.app" of folder "Desktop" of folder "manuelfederanko" of folder "Users" of startup disk


closeFinder window 1

--> {}

copy file "mincraft.jar" of folder "b_1.8.1" of folder "Versionen" of folder "Resources" of folder "Contents" of application file "VersioChanger.app" of folder "Desktop" of folder "manuelfederanko" of folder "Users" of startup disk to folder "bin" of folder "minecraft" of folder "Versionen" of folder "Resources" of folder "Contents" of application file "VersioChanger.app" of folder "Desktop" of folder "manuelfederanko" of folder "Users" of startup disk

--> error number -1728 from file "mincraft.jar" of folder "b_1.8.1" of folder "Versionen" of folder "Resources" of folder "Contents" of application file "VersioChanger.app" of folder "Desktop" of folder "manuelfederanko" of folder "Users" of startup disk

Ergebnis:

error "„Finder“ hat einen Fehler erhalten: „folder \"bin\" of folder \"minecraft\" of folder \"Versionen\" of folder \"Resources\" of folder \"Contents\" of application file \"VersioChanger.app\" of folder \"Desktop\" of folder \"manuelfederanko\" of folder \"Users\" of startup disk“ kann nicht als „file \"mincraft.jar\" of folder \"b_1.8.1\" of folder \"Versionen\" of folder \"Resources\" of folder \"Contents\" of application file \"VersioChanger.app\" of folder \"Desktop\" of folder \"manuelfederanko\" of folder \"Users\" of startup disk“ gesetzt werden." number -10006 from folder "bin" of folder "minecraft" of folder "Versionen" of folder "Resources" of folder "Contents" of application file "VersioChanger.app" of folder "Desktop" of folder "manuelfederanko" of folder "Users" of startup disk

Apple Script-OTHER, Mac OS X (10.7.3)

Posted on Jul 24, 2012 10:39 AM

4 replies

Jul 24, 2012 11:03 AM in response to Community User

without seeing the actual folder contents it's hard to be specific, but here are some general thoughts:

  1. use the path to resources command (StandardAdditions osax) instead of path to me. It's easier and more robust.
  2. is mincraft.jar a typo? I'd expect minecraft.jar. If it's looking for the wrong file that's no good.
  3. Is there already a file by that name in the destination folder? If so, you have to tell duplicate explicitly to overwrite it: duplicate <...> to <...> replacing true.

Jul 24, 2012 2:46 PM in response to Community User

path to resource is straightforward. the command:


path to resource "filename.xxx"


will return an alias to /path/to/your app/Contents/Resources/filename.xxx, automatically accounting for placement of the app file in the file system. use the in directory parameter if you want to specify a subfolder of the resources folder. The only tricky thing about it is that when you run the script from the script editor it may think the currently running app is the script editor, not your app, and swo return a path to script editor's resource folder.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Apple Script error -10006

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.