我写了两个applescripts,以便我的妻子可以轻松地启动mt-daapd并关闭它。它们在脚本编辑器应用程序中运行良好,但是当我将它们编译为独立应用程序时,这些应用程序会在我第一次测试它们时运行。然后他们让我难堪,因为我骄傲地向我的妻子炫耀他们。我看到“开放”动画,然后他们就坐在那里。我之前创建了其他独立应用程序,但这并未发生。如何诊断在启动时退出的已编译Applescript?
我试着将应用程序类型更改为一个包(同样的问题)。我甚至尝试通过gdb附加到可执行文件,以查看是否可以打破某些魔术来告诉我发生了什么。我查看了控制台的一些信息。没有什么是这些剧本笑了我的脸。
我该如何解决这个问题?
我已经包含下面的一个脚本;第二个几乎是一样的。我正在运行10.5.8。
property userpassword : ""
if userpassword is "" then
display dialog "Please enter your user password:" default answer "" with hidden answer
set userpassword to text returned of result
set the_password to "Undefined"
repeat until the_password is "Correct"
try
do shell script "/opt/local/sbin/mt-daapd -c /etc/mt-daapd.conf" password userpassword with administrator privileges
set the_password to "Correct"
on error
display dialog "Sorry, the password entered was not correct. Please try again:" default answer "" with hidden answer
set userpassword to text returned of result
end try
end repeat
if the_password is "Correct" then
display dialog "Your music is being shared!" buttons {"Done"} default button "Done"
end if
end if
在正规的AppleScript,所有的全局变量都保存与脚本。 – 2011-12-08 02:40:20