2010-03-24 3 views
0

대화 형 모드에서 비 대화식 모드로 프로그램이 변경되면서 창에서 모든 컨트롤을 사용하거나 사용하지 않도록 설정하려고합니다. 창문에 모든 내용을 제공하도록 요청하려면 어떻게해야합니까? AppleScript 스튜디오 - 모든 컨트롤을 창에서 얻는 방법

every control of window "mainWindow" 

내가 모든 인터페이스 빌더에서 메뉴 항목과 상호 작용에 대한 좋은 문서를 찾을 수 없어, 작동도 사실

contents of window "mainWindow" 

하지 않습니다. 팝업 및 버튼 등의 내용을 설정하는 방법과 같은 것들. 내가 컨트롤의 여러 가지 목록을 THT 프로그램에 상태에 따라 켜거나 하차했습니다

property onlineControls: {"maxLength", "speed", "accelerationSlider", "accelerationField", "showInfo"} --and so on, listing all the controls by name 

on enableControls(theList, enableState) 
    tell window "mainWindow" 
     repeat with theControl in theList 
      set the enabled of control theControl to enableState 
     end repeat 
    end tell 

enableControls(onlineControls, true) 

그러나 :

감사

나는 순간에 그것을 할 방법입니다. 그것은 최선의 방법으로 보이지 않는 하드 코딩되어야합니다.

답변

2
tell application "System Events" 
    tell process "Adium" 
     get entire contents of window 1 
    end tell 
end tell 

이 스크립트는 것 결과로 당신은 Adium 앞 창 모든 내용 : 창의 butons, 창의 도구 모음, 도구 모음의 단추 등.

+0

"전체 내용" 고마워. – stib

0

나는 창에 모든 컨트롤을 얻을 수있는 방법을 찾을 수 없어,하지만 여기에 팝업 버튼의 메뉴와 상호 작용의 예 :

tell menu of popup button "somePopupButton" of window "mainWindow" 
    delete every menu item 
    repeat with i in someItems 
     make new menu item at end of menu items ¬ 
      with properties {title:i, enabled:true} 
    end repeat 
end tell 
+0

감사합니다. 불행히도 팝업 버튼 (및 버튼, 슬라이더 및 텍스트 필드 등)을 비활성화하고 메뉴 항목을 비활성화하려고합니다. – stib

0

"BoB1990"과 같은 스크립트로 다시 가져올 수 있습니까? 주어진 정보는 윈도우의 전체 내용을 관찰 할 수있는 문자열로 얻거나 나열된 모든 항목을 수정하십시오.

tell application "System Events" to tell process "Adium" 

    set this_info to {} 

    try 

    display alert ((get entire contents of window (x as integer)))  

    on error errMsg set theText to errMsg 

    set this_info to do shell script " echo " & theText & " | sed 's#System Events got an error: Can’t make ##g;s# into type string.##g'" 

    end try 

    set info to {} 

    set info to do shell script " echo " & this_info 

    display alert (info) 

    end tell 
+0

은 "BoB1990"과 같은 스크립트로, 주어진 모든 정보를 관찰하거나 수정할 수있는 문자열로 창 전체 내용을 가져 오는 정보를 얻을 수 있습니다. – deek5

관련 문제