Apple Script error -10000

Hi, I'm again now i have an other big problem with my script. everything of it works, until the last line I get error msg -10000

here is my script:


tell application "Finder"

set userd to (user domain) as text

set AppSupportPath to (path toapplication supportfromuser domain) as text

set bin to AppSupportPath & "minecraft:bin"

set frage to display dialog "Wollen Sie die Version von Minecraft wechseln?" buttons {"Ja", "Nein"}

if button returned of frage = "Ja" then

if folder "_back" of folder bin exists then

if file "minecraft.jar" of folder bin exists then

duplicate file "minecraft.jar" of folder bin to folder "_back" of folder bin

end if

else


makenewfolderatbinwith properties {name:"_back"}

end if

if file "minecraft.jar" of folder bin exists then

delete file "minecraft.jar" of folder "bin" of folder "minecraft" of folder AppSupportPath

else if folder "minecraft.jar" of folder bin exists then

delete folder "minecraft.jar" of folder "bin" of folder "minecraft" of folder AppSupportPath

end if

set mcversion to choose from list {"Beta 1.1_02", "Beta 1.4_01", "Beta 1.5_01", "Beta 1.9.6", "Vollversion 1.2.5"}

set lol to result

if lol = "Beta 1.1_02" then set lol to folder "versions:Beta:1.1_02" of userd

if lol = "Beta 1.4_01" then set lol to folder "versions:Beta:1.4_01" of userd

if lol = "Beta 1.5_01" then set lol to folder "versions:Beta:1.5_01" of userd

if lol = "Beta 1.9.6" then set lol to folder "versions:Beta:1.9.6" of userd

if lol = "Vollversion 1.2.5" then set lol to folder "versions:Vollversion:1.2.5"

duplicate file "minecraft.jar" of folder lol to folder bin

end if

end tell



error msg:


tell application "Finder"


path toapplication supportfromuser domain

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

display dialog "Wollen Sie die Version von Minecraft wechseln?" buttons {"Ja", "Nein"}


--> {button returned:"Ja"}

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


--> true

exists file "minecraft.jar" of folder "Macintosh HD:Users:manuelfederanko:Library:Application Support:minecraft:bin"


--> false

exists file "minecraft.jar" of folder "Macintosh HD:Users:manuelfederanko:Library:Application Support:minecraft:bin"


--> false

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


--> true

delete folder "minecraft.jar" of folder "bin" of folder "minecraft" of folder "Macintosh HD:Users:manuelfederanko:Library:Application Support:"

--> folder "minecraft 20.21.46.jar" of item ".Trash" of folder "manuelfederanko" of folder "Users" of startup disk

--> error number 0

choose from list {"Beta 1.1_02", "Beta 1.4_01", "Beta 1.5_01", "Beta 1.9.6", "Vollversion 1.2.5"}

--> {"Beta 1.5_01"}

copy file "minecraft.jar" of folder {"Beta 1.5_01"} to folder "Macintosh HD:Users:manuelfederanko:Library:Application Support:minecraft:bin"

--> error number -10000 from folder {"Beta 1.5_01"}

Ergebnis:

error "„Finder“ hat einen Fehler erhalten: Fehler in der AppleEvent-Routine." number -10000 from folder {"Beta 1.5_01"}

Apple Script-OTHER, Mac OS X (10.7.3)

Posted on May 23, 2012 11:32 AM

5 replies

May 23, 2012 12:35 PM in response to Community User

Looking at the error and the event producing it shows that you are using a list instead of text for the folder name.


The result from the choose from list dialog is a list, even if there is only one item, so none of your if statements or folder assignments will work the list. Coercing the result to text should do the trick - you should also check for a false result, which is what will be returned if the Cancel button is pressed.

May 24, 2012 6:19 AM in response to red_menace

please can you give me an example or something like that. I don't know what you mean.

do you mean it like so:



tell application "Finder"

set userd to (user domain) as text

set AppSupportPath to (path toapplication supportfromuser domain) as text

set bin to AppSupportPath & "minecraft:bin"

set frage to display dialog "Wollen Sie die Version von Minecraft wechseln?" buttons {"Nein", "Ja"} default button 2

if button returned of frage = "Ja" then

if folder "_back" of folder bin exists then

if file "minecraft.jar" of folder bin exists then

duplicate file "minecraft.jar" of folder bin to folder "_back" of folder bin

end if

else


makenewfolderatbinwith properties {name:"_back"}

if file "minecraft.jar" of folder bin exists then

delete file "minecraft.jar" of folder "bin" of folder "minecraft" of folder AppSupportPath

else if folder "minecraft.jar" of folder bin exists then

delete folder "minecraft.jar" of folder "bin" of folder "minecraft" of folder AppSupportPath

end if

end if

set mcversion to choose from list {"Beta 1.1_02", "Beta 1.4_01", "Beta 1.5_01", "Beta 1.9.6", "Vollversion 1.2.5"}

set lol to text --instead of "result" --

if lol = "Beta 1.1_02" then set lol to folder "versions:Beta:1.1_02" of userd

if lol = "Beta 1.4_01" then set lol to folder "versions:Beta:1.4_01" of userd

if lol = "Beta 1.5_01" then set lol to folder "versions:Beta:1.5_01" of userd

if lol = "Beta 1.9.6" then set lol to folder "versions:Beta:1.9.6" of userd

if lol = "Vollversion 1.2.5" then set lol to folder "versions:Vollversion:1.2.5"

duplicate file "minecraft.jar" of folder lol to folder bin

end if

end tell

May 24, 2012 7:20 AM in response to Community User

You would set the result of the dialog to text, something like:


setloltoresultastext


There are a few other pieces missing from your script, such as what to do if the Application Support folders haven't been created. Also, "user domain" is a parameter of the path to command, which returns the path to various predefined folders - which folder are you wanting to use for the source (folder lol) of the duplicate command?

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 -10000

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