2014-10-17 3 views
3

최근에 최근 컴퓨터에서 실행중인 일부 내 AppleScript에서 버그를 발견했습니다. 버그는 applescript가 묻는 질문에서 나온 것이고 두 가지 대답을 얻으려고합니다. 텍스트 답변과 반환되는 버튼입니다. 목록은 여기에 내가 모두 답변을 저장할 수있는 유일한 방법이지만, 같은AppleScript 변경 : 목록이 동일하지 않은 결과 복사

display dialog "This is a question" default answer "the text answer" buttons {"button 1", "button2", "button 3"} 
copy the result as list to {"the_text", "the_button"} 

은 "결과를 복사 문제입니다 : 기본적으로,이 스크립트의 종류는 10.7에서 은 AppleScript로는 결과이를 반환 order : 텍스트가 반환되고 버튼이 반환되고 10.9에서 applescript는 반대 순서로 첫 번째 버튼, 텍스트를 반환합니다. ?는 10.9으로 10.7에서 작동하도록

답변

2

시도 :

set {text returned:the_text, button returned:the_button} to display dialog "This is a question" default answer "the text answer" buttons {"button 1", "button2", "button 3"} 
,536,

EDIT

결과를 목록으로 강제 변환하면 더 이상 반환 된 단추와 텍스트가 반환 한 속성을 식별 할 수 없습니다. 이와

display dialog "This is a question" default answer "the text answer" buttons {"button 1", "button2", "button 3"} 

:

이 비교

다음
display dialog "This is a question" default answer "the text answer" buttons {"button 1", "button2", "button 3"} 
return the result as list 
+0

:) –

0

는 adayzone의 대답은 약간 다른 버전입니다. 파이썬의 튜플을 푸는 것과 비슷합니다.

한 라이너 다음 result 매개 변수를 사용하여

set {the_text, the_button} to {text returned, button returned} of (display dialog "This is a question" default answer "the text answer" buttons {"button 1", "button2", "button 3"}) 

:

display dialog "This is a question" default answer "the text answer" buttons {"button 1", "button2", "button 3"} 
set {the_text, the_button} to {text returned, button returned} of the result 
그것은 잘 작동하지만, 나에게 쓰는 자연의 소리를하지 않는 솔기
관련 문제