如何在Safari中轻松启用和禁用Java

时间:2013-02-23 17:04:08

标签: macos safari applescript automator

我的妻子需要启用Java才能将她的考勤卡输入ADP(grrrr),但永远不会记住如何使用“首选项”窗格进行操作。有没有我可以用来做这个的脚本?

1 个答案:

答案 0 :(得分:0)

我发现两个脚本在合并时让我为她创建两个Automator服务:the core applescript然后如何检测if the checkbox is already on or off

on run {input, parameters} -- use for both Automator services except for false/true below
    tell application "System Events"
        tell process "Safari"
            click menu item "Preferences…" of menu "Safari" of menu bar item "Safari" of menu bar 1
            click button "Security" of tool bar 1 of window 1

            set theCheckbox to checkbox "Enable Java" of group 1 of group 1 of window "Security"
            tell theCheckbox
                set checkboxStatus to value of theCheckbox as boolean
                if checkboxStatus is false then click theCheckbox
                -- false for the 'Enable' script, true for the 'Disable' one
            end tell
            click button 1 of window "Security"
        end tell
    end tell
    return input
end run