It took me long enough, but I’m happy to report that the next version of my context sensing toolkit will include some new functionality provided via AppleScript.
First of all, you can query the system for current predictions and observations:
tell application "Pennyworth" value of prediction named "Location" end tell
might return something like Home
. Likewise,
tell application "Pennyworth" value of observation named "Desktop Observer (Running)" end tell
might return something like Safari
.
Secondly, if you use other apps that call AppleScripts in response to events, you can now instruct the system to log the observation using
tell application "Pennyworth" log "My Observation" from observer "My Custom Observer" with duration 10 end tell
This is equivalent to an internal observer logging observations. The “from observer” and “with duration” parameters are optional. The system will choose reasonable defaults if left empty.
This functionality has been requested from a few users, so I’m glad that it is now working. If you have any comments or questions, please post them in the comments below.
Is that duration in seconds?
Have you limited the number of seconds that can be specificed? I’m hoping not – I can think of some that would have VERY long timeouts (eg I’d like one that tells me if it’s light or dark outside, which could theoretically be months long if you lived above the artic circle but realistically would need about 18 hours at the lattitude I live at). And the longer the timeout the less push we have to put on the machine to calculate stuff 🙂
r
Comment by Ricky Buchanan — February 20, 2008 @ 10:28 pm