2014-12-04 3 views
0

UI 색인을 가져오고 싶습니다. 나는 다음과 같은 것을 좋아했지만 할 수 없었다. 어떤 방법이 있습니까?UI 색인을 얻는 방법?

소스 :

tell application "System Events" 
    tell process "System Preferences" 
     index of button 9 of scroll area 1 of window 1 
    end tell 
end tell 

결과 :

error 

예상되는 결과 :

9 
+0

어떤 응용 프로그램을 타겟팅합니까? – adayzdone

+0

@adayzdone : "시스템 환경 설정". 하지만 내 질문에 대답하기 위해 응용 프로그램을 지정할 필요가 없다고 생각합니다. –

답변

2

는 AS 시스템 이브 nts UI Elements Suite에는 UI 요소에 대한 ID 또는 색인과 같은 속성이 포함되어 있지 않습니다. 전화

id 9의 버튼이 아니라 9 번째 버튼만을 대상으로합니다.

tell application "System Preferences" to activate 

tell application "System Events" 
    tell process "System Preferences" 
     repeat with ix from 1 to count (buttons of scroll area 1 of window 1) 
      if name of button ix of scroll area 1 of window 1 = "Monitors" then 
       return ix 
      end if 
     end repeat 
    end tell 
end tell 

결과는 다음 9입니다 : 당신은 또한 내가 9가 반복 루프와 모든 버튼을 산책하는 것입니다 반환 뭔가 생각할 수

ninth button of scroll area 1 of window 1 

유일한 방법을 쓸 수 있습니다.

인사말, Michael/Hamburg

관련 문제