Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

Post new topic   Reply to topic Posted in: Widget Requests

IR Toggle Widget

Author Message
joshysquashy



Joined: 19 Nov 2005
Posts: 3

Posted: Wed Jul 23, 2008 - 6:10 am    Post subject: IR Toggle Widget Reply with quote

In our house we have two MacBooks, which both respond to Apple's remotes. I know remotes can be paired, but then you have to remember which remote is for which device.

I would like a dashboard widget that tells you if IR is enabled or disabled, and allows you to toggle it on/off. Perhaps a visual representation of the IR, and clicking it changes its status.

There is an applescript that can find out the status and toggle it on/off. It shouldn't be complicated, but I don't think I am up to the task.

Anyone feel like taking on this task?! I would be eternally grateful!

Here's the applescript code:

Code:
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
View user's profile Send private message Send e-mail Widgets
joshysquashy



Joined: 19 Nov 2005
Posts: 3

Posted: Thu Jul 24, 2008 - 5:36 am    Post subject: Reply with quote

If no one wants to make this, I understand.

Can someone steer me in the right direction so I can have a go!

I guess applescript doesn't work with widgets, so I need to write the code in javascript, correct?

I need one code to get the status, and 2 codes to either enable or disable it depending on the current status.

I guess it should check status at launch, and also every time dashboard is opened, in case a user disabled it in the sys prefs.

It will only need one button, as it toggles on/off. I'm thinking a visual representation of the bottom right corner of a macbook/ macbook pro.


So if anyone could either write the javascript I need, or tell me a bit of info on reading prefs and writing them, that would be very helpful!

Thanks
View user's profile Send private message Send e-mail Widgets
joshysquashy



Joined: 19 Nov 2005
Posts: 3

Posted: Thu Jul 24, 2008 - 6:33 am    Post subject: Reply with quote

I made some images of a possible interface, so you can see aesthetically what I am looking for:


View user's profile Send private message Send e-mail Widgets
Post new topic   Reply to topic

 
Powered by phpBB © 2001, 2002 phpBB Group