Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Apple Script error number -1728

Hello guys i have a little problem with my script i hope you can help me


script:

tell application "Finder"

display dialog "Bitte wählen Sie den Ordner, in welchem sich ihre minecraft_server.jar befindet."


set serverfolder to quoted form of POSIX path of (container of (choose file))

tell application "Terminal"

set cd to "cd" & " " & serverfolder

set mehrram to "java -Xmx2048M -Xms2048M -jar minecraft_server.jar"


do scriptcd

delay 0.25


do scriptmehrraminwindow 1

end tell

end tell


I think its the 3 line also:

setserverfoldertoquoted formofPOSIX pathof (containerof (choose file))

whats wrong with this line?


here is error code:

error "„Finder“ hat einen Fehler erhalten: „POSIX path of folder \"BTW Server 1.3.2\" of folder \"Server\" of folder \"Minecraft\" of folder \"Documents\" of folder \"manuelfederanko\" of folder \"Users\" of startup disk“ kann nicht gelesen werden." number -1728 from POSIX path of folder "BTW Server 1.3.2" of folder "Server" of folder "Minecraft" of folder "Documents" of folder "manuelfederanko" of folder "Users" of startup disk


Thanks for helping me

Apple Script-OTHER, Mac OS X (10.7.3)

Posted on Aug 30, 2012 2:19 AM

Question marked as Best reply

Posted on Aug 30, 2012 8:55 AM

Here:


set serverfolder to quoted form of POSIX path of ((container of (choose file)) as alias)


(69303)

6 replies

Aug 30, 2012 8:45 PM in response to Community User

This script is a bit confused


1. You don't really need the Finder tell block at all. the only thing the finder does is get you the folder of the file you select, but you could just as easily use the choose folder command and get the folder directly.


2. I don't think there's a need for you to script terminal. unless you need to interact with the java program, you should just run this in the background using do shell script. otherwise you're just giving yourself headaches.


if you don't need to interact with the java, you should use something like this:


display dialog "Bitte wählen Sie den Ordner, in welchem sich ihre minecraft_server.jar befindet."


set serverfolder to quoted form of POSIX path of (choose folder)

set cmd to "cd " & serverfolder & "; java -Xmx2048M -Xms2048M -jar minecraft_server.jar &"

do shell scriptcmd

If you do need to interact in terminal then keep the terminal tell block that you're currently using and just get rid of the Finder tell block.


**edited: removed the 'container of' line before the choose folder command

Apple Script error number -1728

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