Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An AppleScript for timers using Quicksilver and Growl Apps
QuGrTimer is an AppleScript that combines the power of Quicksilver and Growl to make a wonderful timer application. Take the following code, paste it into Script Editor, and save it as an AppleScript to ~/Library » Application Support » Quicksilver » Actions:
using terms from application "Quicksilver"
  on process text time_
    set sleepTime to 0
    set theText to time_
    set defaults to AppleScript's text item delimiters
    set AppleScript's text item delimiters to " " -- use " " as delimiters
    set theWords to text items of theText
    set timesToRun to (number of theWords) / 2
    set n to 0 -- index
    -- parse time.
    repeat timesToRun times
      set n to n + 1
      set tempTime to item n of theWords as integer
      set n to n + 1
      set tempWord to item n of theWords
      
      if tempWord contains "h" then -- hours
        set sleepTime to sleepTime + tempTime * 3600
      else if tempWord contains "m" then -- minutes
        set sleepTime to sleepTime + tempTime * 60
      else -- seconds
        set sleepTime to sleepTime + tempTime
      end if
    end repeat
    
    set AppleScript's text item delimiters to defaults -- restore default delimiters
    
    delay sleepTime
    
    --begin growl
    tell application "GrowlHelperApp"
      register as application "QuGrTimer" all notifications {"Timer"} default notifications {"Timer"} icon of application "Quicksilver"
      notify with name "Timer" title "Time's up!" description "Your QuGrTimer has finished!" application name "QuGrTimer"
    end tell
  end process text
end using terms from
If the Actions folder doesn't exist, just create it. Relaunch Quicksilver (Command-Control-Q), and open text input mode (launch with hot key of your choice, and press period), then input the desired timer time using the following as acceptable examples:
10 hours 34 minutes 12 seconds 
10 h 34 m 12 s
3 h 5 seconds
3 s 24 minutes
5 h
13 seconds
18 s 4 h
Note that you don't need to enter all fields, and you can even enter them in reverse order. When the timer is done, a Growl notification will appear. You can configure the notification just like any other from the Growl System Preferences panel.

[robg adds: I haven't tested this one.]
    •    
  • Currently 1.43 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[6,537 views]  

An AppleScript for timers using Quicksilver and Growl | 4 comments | Create New Account
Click here to return to the 'An AppleScript for timers using Quicksilver and Growl' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript for timers using Quicksilver and Growl
Authored by: Peganthyrus on Sep 08, '09 07:40:34AM

You can do this entirely with Quicksilver's built-in functionality, though not as a Growl alert.

1. Invoke quicksilver, enter the string you want as an alert
2. Tab over to the second pane, select 'large text' if it's not already selected; hit <b>ctrl-return</b>
3. You will now have "Show 'alert string' as large type" as your noun, and "run" as your verb. Choose "run after delay..." as your verb (typing 'del' usually gets it for me).
4. Tab over to the third pane, type your delay: "5sec" "5min" "2h5sec" or whatever.



[ Reply to This | # ]
An AppleScript for timers using Quicksilver and Growl
Authored by: matters on Sep 08, '09 02:13:32PM

This is cool, and the kind of thing I like to see on here. I hope Quicksilver never dies. Google's QSB isn't quite as good yet. Not even close actually.



[ Reply to This | # ]
An AppleScript for timers using Quicksilver and Growl
Authored by: IntlOrange on Sep 15, '09 10:08:48AM

The only problem with this AppleScript is that is causes QuickSilver to hang until the timer is complete. So, if you set your timer for "10 minutes", you will not be able to invoke QuickSilver to do anything else until 10 minutes are up.

Using QuickSilver's built-in "run after delay" function is less elegant, as it requires a few extra steps, but it runs the timer in the background, so QS is still available, and its command parsing of time increments is better as well. (QS accepts "10 minutes" or "10m", while the AppleScript chokes on "10m" and needs spaces between numbers and units, as in "10 m 20 s".)



[ Reply to This | # ]
An AppleScript for timers using Quicksilver and Growl
Authored by: tedw on Sep 15, '09 01:07:06PM
you can stop QuickSilver hanging with a unix trick, I think. replace the last bit of the tell block (starting with delay sleepTime) with the following code:
    tell application "GrowlHelperApp" to register as application "QuGrTimer" all notifications {"Timer"} default notifications {"Timer"} icon of application "Quicksilver"

	set theScriptText to "delay " & sleepTime & "
    
	tell application \"GrowlHelperApp\"
		notify with name \"Timer\" title \"Time's up!\" description \"Your QuGrTimer has finished!\" application name \"QuGrTimer\"
   	end tell"

	set cmd to "echo " & quoted form of theScriptText & " | osascript -"
	ignoring application responses
		do shell script cmd
	end ignoring
Basically, this puts the timing delay loop into a text string, and runs the text string as an applescript via unix without waiting for it to complete. This should set the timer running in the background as an independent process, and free up quicksilver to get back to it's normal business. I haven't actually tested it (don't have growl OR quicksilver installed), but it should work.

[ Reply to This | # ]