Alarm or Reminders (As in Quicksilver)

Sharing and discussing custom actions for LaunchBar
JC
Posts: 17
Joined: Tue Apr 08, 2008 12:57 pm

Alarm or Reminders (As in Quicksilver)

Post by JC » Tue Apr 08, 2008 12:59 pm

I love the fact that I can put a full screen reminder in quicksilver. I type in the text, next pane type: run at time * or run in * min, and then I get a the message much in the same way you get a calculator answer on LB. Anyway to do this on LB? Is there a script or something that would do the same thing?

Thanks!


(I'm LOVING Launchbar)

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Tue Apr 08, 2008 5:56 pm

There's no built-in script to do this, but it'd be easy to write your own using AppleScript. You could, for example, do something simple like this:

Code: Select all

-- This simple script uses LaunchBar to generate a reminder after a given number of minutes. It takes input from LaunchBar in the format "<min>-<message>", where <min> is the number of minutes to delay and <msg> is the notification to be displayed when the timer expires. The two values are separated with a single hyphen character. Example: "5-order pizza". Written by Dennis Rande, 2008-04-08.

on handle_string(input)
   if input is not "" then
      open location "x-launchbar:hide"
      set AppleScript's text item delimiters to "-"
      set interval to first text item of input
      set msg to last text item of input
      set AppleScript's text item delimiters to ""
      delay (interval * 60)
      open location ("x-launchbar:large-type?string=" & msg)
   end if
end handle_string


It doesn't offer all the functionality of your example, but it's a start. Personally, I prefer to create iCal events for things that need reminders at a specific time.

Hope this helps,
Dennis

JC
Posts: 17
Joined: Tue Apr 08, 2008 12:57 pm

Post by JC » Tue Apr 08, 2008 7:39 pm

That's great Dennis! Thanks!

So, do I put this in the script editor, save it, and then pull it up in launchbar? (I'd do it now, but I'm on a PC at work :( )

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Tue Apr 08, 2008 7:51 pm

Yes, you find it in LaunchBar, hit space and type away.

That's basically the same Applescript that I posted here a few months ago, although mine can do seconds, minutes, hours and days :P :wink:

Really, I found my script to be quite unusable and I would imagine it's the same with Dennis' since it's basically the same code. Dennis, please don't see this as an affront, I just think that there has to be a better way that allows LaunchBar to be used while a message is waiting. The "x-launchbar:hide" call solves the problem of LaunchBar being visible while waiting, but not that of using LaunchBar.

regards,
Ludwig

JC
Posts: 17
Joined: Tue Apr 08, 2008 12:57 pm

Post by JC » Tue Apr 08, 2008 10:08 pm

Excellent! Thanks!

I have no idea on how to write a script.

How would I use the above script and add the capability to put in a time...

for example: 4:00pm-Order Pizza

Thanks! You brilliant coders!

----
EDIT:

I just found out what you meant -- I can't use launch bar while I'm waiting for the reminder. Oh man, that doesn't work right. Anyway to fix this?

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Tue Apr 08, 2008 11:56 pm

ludwigschubert wrote:That's basically the same Applescript that I posted here a few months ago, although mine can do seconds, minutes, hours and days


Ah, very nice. I missed that one. Yours is really much more sophisticated. I just threw mine together in a couple minutes. :)

ludwigschubert wrote:Really, I found my script to be quite unusable and I would imagine it's the same with Dennis' since it's basically the same code. Dennis, please don't see this as an affront, I just think that there has to be a better way that allows LaunchBar to be used while a message is waiting. The "x-launchbar:hide" call solves the problem of LaunchBar being visible while waiting, but not that of using LaunchBar.


Yea, the script locking up LaunchBar is a problem. A simple workaround is to use Shift-Return to launch the script in the background, but that's hard to remember to do all the time.

-Dennis

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Tue Apr 08, 2008 11:56 pm

JC wrote:I just found out what you meant -- I can't use launch bar while I'm waiting for the reminder. Oh man, that doesn't work right. Anyway to fix this?


That's what has rendered it unusable for me.
I don't know enough about all the Apple frameworks just yet, but maybe I'll write such a program in the foreseeable future as an exercise (I'm still learning)

For now I'd recommend Quicksilver as it does the job and can be run along with LaunchBar.

JC
Posts: 17
Joined: Tue Apr 08, 2008 12:57 pm

Post by JC » Wed Apr 09, 2008 4:06 am

Dennis wrote:Yea, the script locking up LaunchBar is a problem. A simple workaround is to use Shift-Return to launch the script in the background, but that's hard to remember to do all the time.


Shift-Return works great for the time being! Thanks for that tip!

Jonathan

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Wed Apr 09, 2008 8:21 am

Dennis – how cool! Shift return… I'll have to memorize that.

That's what's so cool about a forum… there are always genius guys like Dennis who know a workaround for almost any problem! Thanks!

JC
Posts: 17
Joined: Tue Apr 08, 2008 12:57 pm

Post by JC » Wed Apr 09, 2008 1:01 pm

ludwigschubert wrote: That's what's so cool about a forum… there are always genius guys like Dennis who know a workaround for almost any problem! Thanks!


I agree. Cheers Dennis! I wonder how you figured that one out.

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Wed Apr 09, 2008 5:53 pm

JC wrote:I wonder how you figured that one out.


Thank you, Ludwig and Jonathan. :P I wish I could take the credit, but really it's in the LaunchBar manual:

Running scripts in background

By default, LaunchBar runs AppleScripts in foreground, i.e. you cannot perform any further action in LaunchBar until the script has finished executing.

You can optionally run specific scripts in background by opening them with Shift-Return.


You can also find the "Run in Background" command in LaunchBar's contextual menu whenever a script is on the bar. Either click the little gear icon on the bar or hit Control-right arrow to see the list of options. There's lots of handy stuff in there.

Cheers,
Dennis

JC
Posts: 17
Joined: Tue Apr 08, 2008 12:57 pm

Post by JC » Wed Apr 09, 2008 10:53 pm

Well it's great! Thanks!

Is there anyway to add the option of time with ludwigschubert's script? Where I can say "get the pizza 4:30pm" ?

This would perfect the entire script.

Cheers!

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Wed Apr 09, 2008 11:10 pm

No, unfortunately our scripts only support a duration, not a time.

Someday someone should write an app that does all this. It wouldn't even be too hard, I'm just a little stressed at the moment (final exams).
Maybe there are some devs around here?
Or could we just make this a feature of LaunchBar?
(hint: that question is for you, norbert :D )

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Thu Apr 10, 2008 12:05 am

How about an AppleScript that just queues a job with the Unix at utility? The at utility (/usr/bin/at) can take a huge variety of input formats, including specific dates, times, and time offsets. That way we wouldn't have to invent our own format parsing - just use what the at command already offers. And you could have multiple, simultaneous jobs waiting because at can queue them up. Do "man at" in Terminal for more info.

I'd be interested in tinkering with this myself, but unfortunately, I don't have time right now. Maybe in the future if no one else picks it up.

majormauser2
Posts: 5
Joined: Thu Sep 17, 2009 2:43 am

Re: Alarm or Reminders (As in Quicksilver)

Post by majormauser2 » Sat Sep 19, 2009 7:06 pm

Any Way for it to play a sound like "BING" or use Speech?

Post Reply