아내가 mt-daapd를 실행하고 쉽게 종료 할 수 있도록 두 개의 applescript를 작성했습니다. 스크립트 편집기 앱에서는 제대로 작동하지만 독립형 앱으로 컴파일하면 테스트 한 첫 번째 앱에서 작동합니다. 그런 다음 나는 자랑스럽게 내 아내에게 보여줄 때 나를 부끄럽게 만듭니다. 나는 "열린"애니메이션을보고 그들은 단지 거기에 앉아 있습니다. 이전에 다른 독립형 앱을 만들었지 만 이런 일은 일어나지 않았습니다.시작시 종료되는 컴파일 된 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
일반 애플 스크립트에서, 모든 글로벌 변수는 스크립트로 저장됩니다. –