views:

100

answers:

2

Hi StackOverflowers!

So I'm a coder, I do PHP, JavaScript, and Objective-C. I'm currently working on a website prettymuch full-time and, being 16, don't really have an 'office' except a desk in my bedroom... So I'm spending quite a long time in my room coding this website and I have a bit of a problem.

My bedroom is at the back of our house, with the windows facing West, so in the afternoon the sun shines in the windows heating up the room. Right now as I type this, it's 28.5 degrees C, but it does get as hot as 32 which is seriously too uncomfortable to work in.

Being the sort of geek I am, I was wondering whether it would be possible - or, feasible - to get a USB thermometer or the like, which is Mac-compatible, and then use AppleScript to detect when the temperature gets to a certain level. If, for example, it gets to 23 degrees, I would like a Growl notification to appear saying "Open the small window", at 25 degrees "Open both large windows", and at 28 degrees "Open all windows and the door", for example...

I think this'd be pretty neat, even if I am the only person who'd ever use it! So, is this sort of thing possible, and where would I get a USB thermometer (if they even exist...) from? eBay? I also realise, this question isn't directly related to programming, but, I didn't really know where else to ask it... so, a programmey-question would be is it possible to fetch data from USB devices via AppleScript? - there, that'll do.

Cheers!

Jack

P.S. For all you hardcore Arizonians or Texans or whatever, I live in the UK, and temperatures like 30 degrees make us pass out ;)

+1  A: 

Cheers Matee, There are plenty of them rickey 'ol USB thermometers up on the Amazon and eBay and whatnot, and also Google Shopping for around $15 American (Thats right around 22 of your pounds, for those of you across the pond, coincidentally, that's 1.2x twice the weight of the original XBox). Anyway, as far as the code, I'd wager you're in a bit of a sticky wicket, 'ol top. So far as the eye can wander, AppleScript doesn't support much hardware integration, it's more of a macro thing, aye? Don't go thinking I'm all talk and no trousers, though, if'n I'm not no barrack-room lawyer, I've been doin' it for donkey's years. The mothercompany (God save the King) might implement it in the next release, but i'd wager they'd throw us a canary in a coal mine first. Whose to say, I'm just a man in a clapham omnibus, either way, drafting this comment has been right royal. You brits take care over there ;)

-See you anon

SeniorShizzle
USD15 == GBP22 !!! Holy cow, the economy is in the, err, doldrums.
High Performance Mark
+2  A: 

You won't be able to directly monitor a usb device using applescript. Even if you could access the usb outputs directly you wouldn't know how to convert the signals into a temperature. However, if the device is mac compatible it will come with software for the thermometer... and you will be able to monitor that software using applescript. A quick google search turned up this and it says the software is apple-scriptable. http://practsol.com/thummac.htm

regulus6633