2017-10-20 2 views
1

내가 실행하는 경우 :응용 프로그램 - 문자열 대 문자열?

tell application "Maps" 
    set miniaturized of windows to false 
end tell 

을 ...이 내가 실행할 때,

그러나 잘 작동 :

set applicationName to "Maps" 
tell application applicationName 
    set miniaturized of windows to false 
end tell 

... 내가 얻을 :

지도에 오류가있어 : 소형화 할 수 없다 | 모든 창을 유형 참조로 변환합니다.

tell application (applicationName as string) 
    ... 
end tell 

을 ...하지만이 같은 오류가 발생합니다 :

는 또한 시도했다.

저는 Apple Script를 처음 접했고 그 둘 사이의 미묘한 차이를 이해하지 못했습니다.

답변

1

인수가 컴파일 타임에 계산되므로 tell application의 인수는 리터럴 문자열 (상수)이어야합니다.

대안은 using terms from application 블록하지만 인수는이 시에라의 최신 버전도

set applicationName to "Maps" 
tell application applicationName 
    tell its windows 
     set miniaturized to false 
    end tell 
end tell 

enter image description here

이를 사용하여 나를 위해 작동

using terms from application "Maps" 

end using terms from 
0

도 리터럴 문자열이 필요 나를위한 작품

set applicationName to "Maps" 
tell application applicationName's windows to set miniaturized to false 

enter image description here

+0

저는 Sierra도 실행하고 있지만 (10.12.6), 이들 중 어느 것도 내 컴퓨터에서 작동하지 않습니다. 그들은 오류를 생성하지는 않지만 창을 복원하지도 않습니다. – Jeff