1

システム環境設定/共有/を正常に開くディクテーションコマンド「共有を有効にする」を使用してアクティブ化するスクリプトを作成しました。これにより、既に有効になっているか無効になっているかにかかわらず、チェックボックスが自動的にクリックされます。

共有を有効にするコマンドと共有を無効にするコマンドの 2 つのディクテーション コマンドが必要です。「共有を有効にする」と言うとスクリプトが実行され、共有チェックボックスが既に選択されている場合は、そのチェックボックスが実際に選択解除される場合は、そのチェックボックスをクリックする代わりにシステム設定を終了するという条件を追加するにはどうすればよいですか?

activate application "System Preferences"
delay 1
tell application "System Events"
    tell process "System Preferences"
        click button "Sharing" of scroll area 1 of window "System Preferences"
    end tell
end tell
activate application "System Preferences"
delay 1
tell application "System Events"
    tell process "System Preferences"
        click checkbox 1 of row 2 of table 1 of scroll area 1 of group 1 of window "Sharing"
    end tell
end tell
tell application "System Preferences"
quit
end tell
4

2 に答える 2

0

ここで、私はあなたのためにそれを修正しました。

activate application "System Preferences"
delay 1
tell application "System Events"
    tell process "System Preferences"
        click button "Sharing" of scroll area 1 of window "System Preferences"
    end tell
end tell
activate application "System Preferences"
delay 1
tell application "System Events"
    tell process "System Preferences"


        set theCheckbox to checkbox 1 of row 2 of table 1 of scroll area 1 of group 1 of window "Sharing"
        tell theCheckbox
            if false then click theCheckbox
        end tell


    end tell
end tell
tell application "System Preferences"
    quit
end tell
于 2016-09-18T09:41:26.357 に答える