Today I first came across timers in QS here:
What I saw made me very jealous , so I decided to throw together a small AS that would do the same for me; only easier.
Unfortunately I'm still a beginner in AS and so I wanted to post it here for others; you can help me make it better and use it for yourself ==> everybody will be happy
Usage is "<message to display> <time to wait>"
example for <time to wait>: 10s; 2m, 3h or similiar
<message to display> can be more than one word
A big ThankYou to BravoAlpha for his help to encode an URL with python!
The Script is still very basic, but it works:
Code: Select all
-- Display Alert 0.2 for LB
tell application "Finder"
-- Hide Launchbar… doesn't seem to work?
open location "x-launchbar:hide"
set delayword to last word of input
-- Encode message for URL; strip delay time
do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(unicode(sys.argv, \"utf8\"))' " & quoted form of (text 1 thru ((length of input) - ((length of delayword) + 1)) of input)
set message to result
-- Determine seconds, minutes, hours or days
set timemultiplier to 1
if last character of delayword = "m" then set timemultiplier to 60
if last character of delayword = "h" then set timemultiplier to 60 * 60
if last character of delayword = "d" then set timemultiplier to 60 * 60 * 24
set delayvalue to text 1 thru ((length of delayword) - 1) of delayword
-- 'Do' the actual waiting, then display message
delay delayvalue * timemultiplier
open location "x-launchbar:large-type?string=" & message
Any comments and/or help would be very appreciated, especially if I overlooked a simpler way to accomplish this!
Also I'd like your opinion on whether LB should have a "run in…" or a "run at…" option like QS seems to have.