The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Timer Script - useful for 2 Minute Timer (uses Growl and TimeBoxed) (http://forums.omnigroup.com/showthread.php?t=16267)

Cottser 2010-05-22 10:58 AM

Timer Script - useful for 2 Minute Timer (uses Growl and TimeBoxed)
 
2 Attachment(s)
I've created a basic timer script, which uses [URL="http://growl.info/"]Growl[/URL] and [URL="http://www.macmation.com/TimeBoxed"]TimeBoxed[/URL].

The script is useful as a two-minute timer, but it will also use the time estimate value if you've entered one in OmniFocus. When run, the script pops up a sticky Growl bubble with the name of the selected action, and starts a timer countdown in TimeBoxed. This helps me stick to the 2 minute rule and stay focused on the task at hand.

I can't take much credit for this – all I've done is combine two scripts – but I wanted to share it in case anyone else might find it useful.

This is basically a combination (with modifications) of curt.clifton's [URL="http://forums.omnigroup.com/showpost.php?p=61416&postcount=18"]"What Are You Doing?" script[/URL], and Lutin's [URL="http://forums.omnigroup.com/showthread.php?t=11859"]"TimeBoxed / OmniFocus" script[/URL].

I didn't spend too much time hunting down an icon, the one I'm using is from here: [URL="http://kylesteed.com/2009/new-clock-icon/"]http://kylesteed.com/2009/new-clock-icon/[/URL]

The script will look for an estimated time in the selected action, and if there is an estimated time, it will use that value for the timer rather than the default 2 minutes. You can also change the default timer of 2 minutes to something else by editing the value near the top of the script.

Even if you have multiple items selected, the script will only look at the first item. One thing at a time! :)


I would recommend putting this in your Toolbar and/or setting up a keyboard shortcut for it.

I also recommend changing where the sticky Growl notifications show up on-screen to differentiate them from other Growl notifications. You can do this after running the script once, from Growl's preference pane.

To change the location of the notifications, open the Growl preference pane, then click Applications. Choose OmniFocus Stickies. Then select a custom starting position. I've selected the bottom left.

While you're there, you may also want to click over to the Notifications tab and set Stay On Screen to Always just to be sure.


Please post here if you run into any problems. You will need [URL="http://growl.info/"]Growl[/URL] and [URL="http://www.macmation.com/TimeBoxed"]TimeBoxed[/URL] installed for the script to work.

curt.clifton 2010-05-22 01:20 PM

Very nice. Thanks for sharing!

johnrover 2010-11-01 02:07 PM

Thanks. This is awesome.

I've been using it for a week and it really helps things.

Today, and issue cropped up and I'm hoping those with Applescript knowledge can help me out. (I don't know where to begin troubleshooting.)

Now, for some reason, when I try to use the script from the OF toolbar, I get the following error kicked over from Applescript: "File TimeBoxed wasn’t found." However, when I use the script via the AS menu: I get no error; the timer starts; but the timer is not set to the time estimate value, instead it remains whatever it was set at previously (manually).

The growl notification seems to work via either method.

Any advice?

RobTrew 2010-11-01 03:00 PM

I am using this lightly edited version from the toolbar without any problem. Worth a try ?

[CODE]-- Light Edit by RT Nov 1 2010
(*
OmniFocus Timer Script

Version 0.1, by Scott Reeves

The script displays a sticky Growl notification with the selected action from OmniFocus,
and starts a timer in TimeBoxed, by default 2 minutes. If you've entered a time estimate,
that value will be used for the timer length.

Useful as a 2 minute timer, as well as a timer for tasks where you've entered a time estimate.

Scroll down a bit to change the default timer setting to something other than 2 minutes.

Credits:
Curt Clifton's "What Are You Doing?" script: http://forums.omnigroup.com/showpost.php?p=61416&postcount=18
Guillaume Cerquant's "TimeBoxed / OmniFocus" script: http://forums.omnigroup.com/showthread.php?t=11859

Icon from http://kylesteed.com/2009/new-clock-icon/

Version 0.1: Original release
*)

-- Original credits from Curt's script retained
(*
What Are You Doing?

This script uses Growl to display a sticky note about what you are supposed to be focusing on.

version 0.1, by Curt Clifton

Copyright © 2007-2008, Curtis Clifton

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

version 0.1: Original release
*)

-- Default timer setting if no time estimate is provided (default 2 minutes)
property defaultTimeInMinutes : 2

(*
The following properties are used for script notification via Growl.
*)
property growlAppName : "OmniFocus Stickies"
property notification : "Stick it"
property defaultNotifications : {notification}
property allNotifications : defaultNotifications
property iconLoaningApplication : "OmniFocus.app"

tell application "OmniFocus"
tell front document
tell document window 1
set taskNote to ""

try
set lstValue to (value of selected trees of content)
set oTask to first item of lstValue
on error
display alert "Please select an item to work on first." as warning
return
end try

-- start out with the default value
set taskMinutes to defaultTimeInMinutes

tell oTask
-- update to estimated time if it's set
if estimated minutes > 0 then
set taskMinutes to estimated minutes
end if

set taskTitle to name
set taskNote to note
end tell

if taskMinutes > 0 then
my notify("What are you doing?", taskTitle, notification)
my startTimer(taskMinutes * 60)
end if

end tell
end tell
end tell

(*
Uses Growl to display a notification message.
theTitle – a string giving the notification title
theDescription – a string describing the notification event
theNotificationKind – a string giving the notification kind (must be an element of allNotifications)
*)
on notify(theTitle, theDescription, theNotificationKind)
tell application "GrowlHelperApp"
register as application growlAppName all notifications allNotifications default notifications defaultNotifications icon of application iconLoaningApplication
notify with name theNotificationKind title theTitle application name growlAppName description theDescription with sticky
end tell
end notify

on startTimer(numberOfSeconds)
tell application id "com.macmation.timeboxed"
activate
set timer duration to numberOfSeconds
reset
end tell
end startTimer
[/CODE]

johnrover 2010-11-01 03:18 PM

I haven't run a diff on it and I have no idea what you've done, but it works! So glad I asked. Thank you so much!

Cottser 2010-11-02 05:50 AM

Thanks, Rob. It looks like the [CODE]tell application id "com.macmation.timeboxed"[/CODE] may be part of what's working better in your script. You also have a far less hacky version of getting the first selected item in the tree. Kudos!

atreinke 2010-11-02 02:17 PM

Now, if there was only some way to get this to work on an iPad..........

dbyler 2010-12-13 11:04 AM

And the requisite modification to work with Minuteur...
 
I like how Minuteur displays an actual countdown in the menu bar. Here's a modification of Rob's last post to work with Minuteur.

[CODE]-- Switched to Minuetur by DNB Dec 13 2010

-- Light Edit by RT Nov 1 2010
(*
OmniFocus Timer Script

Version 0.1, by Scott Reeves

The script displays a sticky Growl notification with the selected action from OmniFocus,
and starts a timer in TimeBoxed, by default 2 minutes. If you've entered a time estimate,
that value will be used for the timer length.

Useful as a 2 minute timer, as well as a timer for tasks where you've entered a time estimate.

Scroll down a bit to change the default timer setting to something other than 2 minutes.

Credits:
Curt Clifton's "What Are You Doing?" sc ript: http://forums.omnigroup.com/showpost.php?p=61416&postcount=18
Guillaume Cerquant's "TimeBoxed / OmniFocus" script: http://forums.omnigroup.com/showthread.php?t=11859

Icon from http://kylesteed.com/2009/new-clock-icon/

Version 0.1: Original release
*)

-- Original credits from Curt's script retained
(*
What Are You Doing?

This script uses Growl to display a sticky note about what you are supposed to be focusing on.

version 0.1, by Curt Clifton

Copyright © 2007-2008, Curtis Clifton

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

version 0.1: Original release
*)

-- Default timer setting if no time estimate is provided (default 2 minutes)
property defaultTimeInMinutes : 2

(*
The following properties are used for script notification via Growl.
*)
property growlAppName : "OmniFocus Stickies"
property notification : "Stick it"
property defaultNotifications : {notification}
property allNotifications : defaultNotifications
property iconLoaningApplication : "OmniFocus.app"

tell application "OmniFocus"
tell front document
tell document window 1
set taskNote to ""

try
set lstValue to (value of selected trees of content)
set oTask to first item of lstValue
on error
display alert "Please select an item to work on first." as warning
return
end try

-- start out with the default value
set taskMinutes to defaultTimeInMinutes

tell oTask
-- update to estimated time if it's set
if estimated minutes > 0 then
if estimated minutes > 720 then
set taskMinutes to 720 --max Minuteur time: 12 hrs
else
set taskMinutes to estimated minutes
end if
end if

set taskTitle to name
set taskNote to note
end tell

if taskMinutes > 0 then
my notify("What are you doing?", taskTitle, notification)
set strHMS to my MinuteurString(taskMinutes)
tell application "Minuteur"
activate
StartCountdown strHMS
end tell
end if
end tell
end tell
end tell

(*
Uses Growl to display a notification message.
theTitle – a string giving the notification title
theDescription – a string describing the notification event
theNotificationKind – a string giving the notification kind (must be an element of allNotifications)
*)
on notify(theTitle, theDescription, theNotificationKind)
tell application "GrowlHelperApp"
register as application growlAppName all notifications allNotifications default notifications defaultNotifications icon of application iconLoaningApplication
notify with name theNotificationKind title theTitle application name growlAppName description theDescription with sticky
end tell
end notify

on MinuteurString(lngMinutes)
set strHoursLeft to (lngMinutes div 60) as string
if length of strHoursLeft < 2 then
set strHoursLeft to "0" & strHoursLeft
end if

set strAdditionalMins to (lngMinutes mod 60) as string
if length of strAdditionalMins < 2 then
set strAdditionalMins to "0" & strAdditionalMins
end if

return strHoursLeft & strAdditionalMins & "00"
end MinuteurString
[/CODE]


All times are GMT -8. The time now is 07:46 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.