0

プログラムがインタラクティブモードから非インタラクティブモードに変わるときに、ウィンドウ内のすべてのコントロールを有効または無効にしようとしています。ウィンドウにすべてのコンテンツを提供するように依頼するにはどうすればよいですか?

every control of window "mainWindow"

動作しません、また動作しません

contents of window "mainWindow"

実際、InterfaceBuilderのメニュー項目を操作するための適切なドキュメントをまったく見つけることができませんでした。ポップアップやボタンの内容の設定方法など。

ありがとう

私が現時点でそれを行う方法は次のとおりです。

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)

プログラムの状態に応じてオンまたはオフになるコントロールのリストをいくつか作成しました。ただし、ハードコーディングする必要があり、最善の方法とは言えません。

4

3 に答える 3

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

このスクリプトは、結果としてAdiumのフロントウィンドウのすべてのコンテンツを提供します:ウィンドウのボタン、ウィンドウのツールバー、ツールバーのボタンなど。Enjoy=]

于 2010-05-11T01:10:55.443 に答える
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
于 2010-03-25T04:20:08.500 に答える
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
于 2016-11-07T06:53:40.300 に答える