In System Preferences > Security > General, at the bottom s check box to disable remote control infrared receiver. I’d like to develop a widget that when clicked on will toggle whether or not the Apple Remote infrared receiver is enabled or disabled.
I Googled the topic and came across this script:
set currentValue to do shell script "defaults read /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled"
if currentValue is "0" then
set status to "disabled"
else
set status to "enabled"
end if
display dialog "Set remote control infrared. Right now it is " & status & "." buttons {"Enable", "Disable", "Cancel"} default button "Disable"
copy button returned of the result to button
if button = "Cancel" then
return
end if
-- only change it if it needs to be changed
-- currently disabled and button is enable
if currentValue is "0" and button is "Enable" then
do shell script "defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool yes" with administrator privileges
return
end if
-- currently enabled and button is disable
if currentValue is "1" and button is "Disable" then
do shell script "defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool no" with administrator privileges
return
end if
The script runs and checks/unchecks the box, but doesn’t actually enable/disable the remote control infrared receiver (tested it with iTunes). Can anyone tell me why this script doesn’t work? Also, is it possible to not have to enter your password? As I mentioned, I’m planning to make it into a widget that will run the script.
Thanks - slimjim5811