Jump to content

MuppetGate

Member
  • Content Count

    132
  • Joined

  • Last visited

  • Days Won

    4

Reputation Activity

  1. Like
    MuppetGate got a reaction from cands in Yet another date calculator   
    Okay, I’ve scored a bit of time to revisit the date app and fix a few bugs. Not everything has been looked at because I’ve got to head off again for a while, but what I have done is:

    –    Upgraded the workflow library
    –    Fixed a few of the scripts that referred to Alfred 2 instead of Alfred 3 (I guess this means Alfred 2 is no longer supported).
    –    A bit of a general code tidy up

    The big piece of work though, is the restoration of the exclude functionality, which should work properly, but with limitations. To prevent it blowing things up if the search combination doesn’t produce a valid match, I’ve limited the workflow to about 300 attempts to look for a match. After that, I’ll throw an error.

    So how does it work? Here’s a quick example.

    Say you’re a busy project bod and you have a piece of work that’s going to take three weeks. So you enter the data expression:

    dcalc today + 3w

    And that gives you a date three weeks into the future. But hang on a sec: no one works weekends, so how long will it take if there are no weekends included:

    dcalc today + 3w exclude weekends

    So now the date will be further into the future because weekends are not counted as part of the project. (Another way to look at it is if people worked weekends then the project could be brought in at an earlier date).

    You can exclude individual days:

    dcalc today + 3w x weekends 28.10.2018 

    This will exclude all weekends and also the 28th of October. Note that you can just use x or ex instead of exclude.
    We can exclude other days:

    dcalc today + 3w x Tuesdays Wednesdays Fridays

    We can also do ranges:

    dcalc today + 3w exclude Tuesdays 30.10.2018 to 05.11.2018 02.12.2018

    This beast will exclude Tuesdays, all days between the 30.10.2018 and 05.11.2018, and it will also exclude 02.12.2018
    We can also do:

    dcalc today + 3w exclude all except tuesdays

    Error checking is minimal, but this kind of stuff won’t work:

    dcalc today + 3w ex all except wednesdays wednesdays
    dcalc today + 3w x weekends weekdays
     
    Because every day has been excluded.
     
    The update can be found in the usual place:
     
    http://www.packal.org/workflow/date-calculator
     
    The usual disclaimers apply, so don't use this to schedule brain surgery.  Use a calendar.
     
  2. Thanks
    MuppetGate got a reaction from bivalvegruff in Yet another date calculator   
    Date Calculator
     
    Hello there!
    I needed a bit of motivation to learn Python and Alfred workflows, so I thought I’d kill two horses with one bullet, so to speak.
    Right, so this is a date calculator – kind of. It won’t tell you when you will the lottery, or how long you’ve got to hide your ‘arty videos’ before your wife gets home, but it will answer one or two very simple questions about dates.
     

    For example, if you enter
     
    dcalc 25.12.14 - 18.01.14
     
    then it will tell you the number of days between those dates. Note that the workflow parses the command as you enter it, so you’ll see invalid command, invalid expression and invalid formaterrors as you type. Once you’ve completed the command then you’ll be given the result.
    You could also try
     
    dcalc 25.12.14 - now
     
    for the number of days until Christmas. (Always seems so far away . . .)
    Maybe you don’t want it in days, but would rather it in weeks:
     
    dcalc 25.12.14 - now w
     
    or days and weeks
     
    dcalc 25.12.14 - now wd
     
    or years, months, weeks and days
     
    dcalc 25.12.14 - now ymwd
     
    or
     
    dcalc 25.12.14 - now long
     
    will do the same thing. Personally, I always use the long format because it’s more accurate.
    For those who like to look ahead, you can add days to a date
     
    dcalc now + 6d
     
    or weeks
     
    dcalc 18.12.14 + 9w
     
    or combine ‘em
     
    dcalc 18.12.12 + 5y 9d 3w - 2d + 1d 1w
     
    What does that mess do?
    Take the date 18.12.12  Add 5 years Add another 9 days Add another 3 weeks Then take off 2 days Add another 1 day And then add another 1 week If you want to know what week number you’re in, then try this:
     
    dcalc today wn
     
    Or for a specific date:
     
    dcalc 25.12.14 wn
     
    You can also use the today thing in other places too:
     
    dcalc today + 4d
     
    And we have another thing called time because the workflow can handle times too:
     
    dcalc time + 6h 8M
     
    will add 6 hours and 8 minutes to the current time. Note the capital ‘M’ to denote minutes. Odd, I know . . . sorry, but the workflow has to distinguish between this and a small ‘m’ (for months). I figured make this one a capital because it would see much less use. (It has for me.)
    If you just want the current time, then just enter
     
    dcalc time
     
    Here’s another time calculation
     
    dcalc 14:35 + 6h
     
    That’s the time 6 hours from now, and for real nerdiness:
     
    dcalc 21.06.14@14:20 - 23.01.12@09:21 long
     
    Probably not all that useful, but some of this other stuff might be. You know all about
     
    dcalc now
     
    For giving you the current time and date. While you can use 
     
    dcalc tomorrow
     
    for tomorrow’s date, and as you would expect
     
    dcalc tomorrow + 1d
     
    will give you the day after tomorrow.
     
    dcalc next tue
     
    will give you the date next Tuesday. Or for for Thursday you could enter
     
    dcalc next tue + 2d
    if you’re still a little too inebriated to realise that
     
    dcalc next thu
     
    will give you the same answer.
    That about covers it, I think. I haven’t done anything clever with locales, but you can pick a different date format with
     
    dcalcset date format
     
    And we also support both 12-hour and 24-hour time formats. 
     
    dcalcset time format
     
    I would recommend sticking with the 24-hour format; it's a lot easier to type because the AM/PM symbols have to be in upper case.
    You can also set the combined date and time format using:
     
    dcalcset date and time format
     
    If you’re ever puzzled by invalid command or invalid expression errors, then start with the settings; they might be set incorrectly.
    Oh, almost forgot.
     
    dcalc easter
     
    Is the date for next Easter Sunday, for no other reason that I can never remember it, and now there’s an easy way to find out how many days until Christmas:
     
    dcalc today - christmas
     
    And to celebrate finishing my new book, I decided to add:
    dcalc passover
     
    Alternative parser
    If surround a simple expression in double quotes, then something quite magical happens:
     
    dcalc "4 hours 8 minutes after 4pm"
     
    or
     
    dcalc "6 weeks and 4 days after next wednesday"
     
    or
     
    dcalc "1 day after tomorrow"
     
    Yup! A natural date language parser! 
    You can even combine it with the existing parser:
     
    dcalc "next friday" + 1d
     
    This is a little bit experimental (I might drop it later if it proves to be problematic), but I thought I'd throw it in for a bit of a fun.
     
     
    Credits
    A list of things that made my first attempt at Python programming possible:
    Dean Jackson for his more-than-slightly awesome Alfred Workflow framework(Jetbrains(HumanFriendly(Python-DateUtil(PyPEG(ParseDateTime(Programming Praxis(MIT(http://opensource.org/licenses/MIT) one will do. :-)The MIT License (MIT)
    Copyright © 2014 MuppetGate Media
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  3. Like
    MuppetGate got a reaction from Empyreal in I Sheet You Not: Plug Excel into Alfred   
    This has got to be the best workflow name ever
  4. Like
    MuppetGate got a reaction from iNinja in Yet another date calculator   
    Date Calculator
     
    Hello there!
    I needed a bit of motivation to learn Python and Alfred workflows, so I thought I’d kill two horses with one bullet, so to speak.
    Right, so this is a date calculator – kind of. It won’t tell you when you will the lottery, or how long you’ve got to hide your ‘arty videos’ before your wife gets home, but it will answer one or two very simple questions about dates.
     

    For example, if you enter
     
    dcalc 25.12.14 - 18.01.14
     
    then it will tell you the number of days between those dates. Note that the workflow parses the command as you enter it, so you’ll see invalid command, invalid expression and invalid formaterrors as you type. Once you’ve completed the command then you’ll be given the result.
    You could also try
     
    dcalc 25.12.14 - now
     
    for the number of days until Christmas. (Always seems so far away . . .)
    Maybe you don’t want it in days, but would rather it in weeks:
     
    dcalc 25.12.14 - now w
     
    or days and weeks
     
    dcalc 25.12.14 - now wd
     
    or years, months, weeks and days
     
    dcalc 25.12.14 - now ymwd
     
    or
     
    dcalc 25.12.14 - now long
     
    will do the same thing. Personally, I always use the long format because it’s more accurate.
    For those who like to look ahead, you can add days to a date
     
    dcalc now + 6d
     
    or weeks
     
    dcalc 18.12.14 + 9w
     
    or combine ‘em
     
    dcalc 18.12.12 + 5y 9d 3w - 2d + 1d 1w
     
    What does that mess do?
    Take the date 18.12.12  Add 5 years Add another 9 days Add another 3 weeks Then take off 2 days Add another 1 day And then add another 1 week If you want to know what week number you’re in, then try this:
     
    dcalc today wn
     
    Or for a specific date:
     
    dcalc 25.12.14 wn
     
    You can also use the today thing in other places too:
     
    dcalc today + 4d
     
    And we have another thing called time because the workflow can handle times too:
     
    dcalc time + 6h 8M
     
    will add 6 hours and 8 minutes to the current time. Note the capital ‘M’ to denote minutes. Odd, I know . . . sorry, but the workflow has to distinguish between this and a small ‘m’ (for months). I figured make this one a capital because it would see much less use. (It has for me.)
    If you just want the current time, then just enter
     
    dcalc time
     
    Here’s another time calculation
     
    dcalc 14:35 + 6h
     
    That’s the time 6 hours from now, and for real nerdiness:
     
    dcalc 21.06.14@14:20 - 23.01.12@09:21 long
     
    Probably not all that useful, but some of this other stuff might be. You know all about
     
    dcalc now
     
    For giving you the current time and date. While you can use 
     
    dcalc tomorrow
     
    for tomorrow’s date, and as you would expect
     
    dcalc tomorrow + 1d
     
    will give you the day after tomorrow.
     
    dcalc next tue
     
    will give you the date next Tuesday. Or for for Thursday you could enter
     
    dcalc next tue + 2d
    if you’re still a little too inebriated to realise that
     
    dcalc next thu
     
    will give you the same answer.
    That about covers it, I think. I haven’t done anything clever with locales, but you can pick a different date format with
     
    dcalcset date format
     
    And we also support both 12-hour and 24-hour time formats. 
     
    dcalcset time format
     
    I would recommend sticking with the 24-hour format; it's a lot easier to type because the AM/PM symbols have to be in upper case.
    You can also set the combined date and time format using:
     
    dcalcset date and time format
     
    If you’re ever puzzled by invalid command or invalid expression errors, then start with the settings; they might be set incorrectly.
    Oh, almost forgot.
     
    dcalc easter
     
    Is the date for next Easter Sunday, for no other reason that I can never remember it, and now there’s an easy way to find out how many days until Christmas:
     
    dcalc today - christmas
     
    And to celebrate finishing my new book, I decided to add:
    dcalc passover
     
    Alternative parser
    If surround a simple expression in double quotes, then something quite magical happens:
     
    dcalc "4 hours 8 minutes after 4pm"
     
    or
     
    dcalc "6 weeks and 4 days after next wednesday"
     
    or
     
    dcalc "1 day after tomorrow"
     
    Yup! A natural date language parser! 
    You can even combine it with the existing parser:
     
    dcalc "next friday" + 1d
     
    This is a little bit experimental (I might drop it later if it proves to be problematic), but I thought I'd throw it in for a bit of a fun.
     
     
    Credits
    A list of things that made my first attempt at Python programming possible:
    Dean Jackson for his more-than-slightly awesome Alfred Workflow framework(Jetbrains(HumanFriendly(Python-DateUtil(PyPEG(ParseDateTime(Programming Praxis(MIT(http://opensource.org/licenses/MIT) one will do. :-)The MIT License (MIT)
    Copyright © 2014 MuppetGate Media
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  5. Like
    MuppetGate reacted to deanishe in OneUpdater — Update workflows with a single node   
    Shawn (like Smargh) got a job—they were both students before—and doesn't have the time for Packal any more. I'm  pretty sure Packal is a zombie now, and v2 will probably never see the light of day.
     
    Would you be interested in working on a next-gen solution for updating workflows?
  6. Like
    MuppetGate got a reaction from deanishe in I Sheet You Not: Plug Excel into Alfred   
    This has got to be the best workflow name ever
  7. Like
    MuppetGate got a reaction from cands in Yet another date calculator   
    Hello, I've updated the workflow following a twitter request.
     
    You now have a new date format to struggle with (the wordy format) which looks like this:
     
    dd mmm yyyy
     
    So you can now use abbreviated (three characters only!) month names in expressions.
     
    dcalc today - 23 apr 2016
     
     
    http://www.packal.org/workflow/date-calculator
  8. Like
    MuppetGate got a reaction from deanishe in Visual Frontend to workflows   
    I think Alfred is meant to be more of a command-line interface: you enter a command, it does something, you're done.
    Complex GUIs are for long running interactions. I would be more inclined to write a completely separate application and then just call it with a standard Alfred search.
  9. Like
    MuppetGate got a reaction from cands in Yet another date calculator   
    Merry Christmas folks!
     
    And a new version of the date calculator.
     
    The only noticeable change is that I've added a help page, accessed from a website. Not ideal, and I'll roll it into the workflow once I've finished it completely.
     
    Accessed by entering 
     
    dcalchelp
     
    on the Alfred command line. The new version can be found in the usual place (Packal).
     
    Though, I'm not sure it'll see much use, the exclusion function now works with date addition calculations. It's a little bit weird, but if you do enter something like this:
     
    dcalc today + 60d
     
    then you'll get the date sixty days from now. But if you do this:
     
    dcalc today + 60d exclude weekends
     
    will push out the date further to take account of weekends. The idea is that if you want to know how long you have to complete a project, then you might want the +60d to take into account the fact that you don't work on weekends. 
     
    It's a bit of an experiment!
     
    http://www.packal.or...date-calculator
  10. Like
    MuppetGate got a reaction from alfredappuser in Yet another date calculator   
    A bit short on time, but I'll put it on the list. 
  11. Like
    MuppetGate got a reaction from xilopaint in Yet another date calculator   
    Yet another update!
     
    First off, I've added a few abbreviations that should make it a lot easier to get at the more common functions.
     
    dcalc *
    for today's date.
     
    dcalc <
    for yesterday
     
    dcalc >
    for tomorrow
     
    dcalc &
    for the current time
     
    dcalc #
    for the time and date
     
    And of course you can combine these with date and timespan functions, but they may be a little hard to read.
     
    dcalc > + 1d
     
    is the day after tomorrow.
     
    I've also added a few other functions.
     
    dcalc pancake day (guess what that is)
     
    dcalc lent (the start of Lent)
     
    dcalc mlk (Martin Luther King day)
  12. Like
    MuppetGate got a reaction from xilopaint in Yet another date calculator   
    G'morning folks.
     
    I've updated the workflow (again!) to tidy up a bit of the code and add a couple  of new small functions.
     
    First up, the requested expansion to the exclude functionality. As well as working with timespans, you can now use it on functions that return absolute dates.
     
    For example:
     
    dcalc today + 60d x weekends
     
    will give you a date 60 days from now that has been adjusted to discount any weekends that occur in the timespan.
     
    The second change is the expansion to the week_number function.
     
    You can already do this:
     
    dcalc today wn
     
    to find the current week. Great stuff, but then I ran into an odd one at college the other day. The lecturer said, "Final pieces need to be submitted by week 19."
    And someone else said, "What date is that?"
    And of course, no one knew.
     
    So
     
    dcalc wn 7
     
    will give the date for week 7 of the current year. It will use the current day of the week you're sitting on as the baseline. So if I enter the command on Monday, it will give me the date of Monday week 7. That's not especially useful, so it's probably better to supply the day of week as well:
     
    dcalc wn 7 sun
     
    So that will give you the date on Sunday week 7
     
    And of course, you might want to pick out a different year:
     
    dcalc wn 2016 7 sun
     
    will give the date on Sunday in the 7th week of 2016 (which is  the 21st of February apparently).
     
    That's it for now. The new version can be found here.
  13. Like
    MuppetGate got a reaction from xilopaint in Yet another date calculator   
    Okay, now I've had a think, I can definitely see why this is useful. I'll put it on the list. Not quite sure when I'll get to it though.
  14. Like
    MuppetGate got a reaction from xilopaint in Yet another date calculator   
    Date Calculator
     
    Hello there!
    I needed a bit of motivation to learn Python and Alfred workflows, so I thought I’d kill two horses with one bullet, so to speak.
    Right, so this is a date calculator – kind of. It won’t tell you when you will the lottery, or how long you’ve got to hide your ‘arty videos’ before your wife gets home, but it will answer one or two very simple questions about dates.
     

    For example, if you enter
     
    dcalc 25.12.14 - 18.01.14
     
    then it will tell you the number of days between those dates. Note that the workflow parses the command as you enter it, so you’ll see invalid command, invalid expression and invalid formaterrors as you type. Once you’ve completed the command then you’ll be given the result.
    You could also try
     
    dcalc 25.12.14 - now
     
    for the number of days until Christmas. (Always seems so far away . . .)
    Maybe you don’t want it in days, but would rather it in weeks:
     
    dcalc 25.12.14 - now w
     
    or days and weeks
     
    dcalc 25.12.14 - now wd
     
    or years, months, weeks and days
     
    dcalc 25.12.14 - now ymwd
     
    or
     
    dcalc 25.12.14 - now long
     
    will do the same thing. Personally, I always use the long format because it’s more accurate.
    For those who like to look ahead, you can add days to a date
     
    dcalc now + 6d
     
    or weeks
     
    dcalc 18.12.14 + 9w
     
    or combine ‘em
     
    dcalc 18.12.12 + 5y 9d 3w - 2d + 1d 1w
     
    What does that mess do?
    Take the date 18.12.12  Add 5 years Add another 9 days Add another 3 weeks Then take off 2 days Add another 1 day And then add another 1 week If you want to know what week number you’re in, then try this:
     
    dcalc today wn
     
    Or for a specific date:
     
    dcalc 25.12.14 wn
     
    You can also use the today thing in other places too:
     
    dcalc today + 4d
     
    And we have another thing called time because the workflow can handle times too:
     
    dcalc time + 6h 8M
     
    will add 6 hours and 8 minutes to the current time. Note the capital ‘M’ to denote minutes. Odd, I know . . . sorry, but the workflow has to distinguish between this and a small ‘m’ (for months). I figured make this one a capital because it would see much less use. (It has for me.)
    If you just want the current time, then just enter
     
    dcalc time
     
    Here’s another time calculation
     
    dcalc 14:35 + 6h
     
    That’s the time 6 hours from now, and for real nerdiness:
     
    dcalc 21.06.14@14:20 - 23.01.12@09:21 long
     
    Probably not all that useful, but some of this other stuff might be. You know all about
     
    dcalc now
     
    For giving you the current time and date. While you can use 
     
    dcalc tomorrow
     
    for tomorrow’s date, and as you would expect
     
    dcalc tomorrow + 1d
     
    will give you the day after tomorrow.
     
    dcalc next tue
     
    will give you the date next Tuesday. Or for for Thursday you could enter
     
    dcalc next tue + 2d
    if you’re still a little too inebriated to realise that
     
    dcalc next thu
     
    will give you the same answer.
    That about covers it, I think. I haven’t done anything clever with locales, but you can pick a different date format with
     
    dcalcset date format
     
    And we also support both 12-hour and 24-hour time formats. 
     
    dcalcset time format
     
    I would recommend sticking with the 24-hour format; it's a lot easier to type because the AM/PM symbols have to be in upper case.
    You can also set the combined date and time format using:
     
    dcalcset date and time format
     
    If you’re ever puzzled by invalid command or invalid expression errors, then start with the settings; they might be set incorrectly.
    Oh, almost forgot.
     
    dcalc easter
     
    Is the date for next Easter Sunday, for no other reason that I can never remember it, and now there’s an easy way to find out how many days until Christmas:
     
    dcalc today - christmas
     
    And to celebrate finishing my new book, I decided to add:
    dcalc passover
     
    Alternative parser
    If surround a simple expression in double quotes, then something quite magical happens:
     
    dcalc "4 hours 8 minutes after 4pm"
     
    or
     
    dcalc "6 weeks and 4 days after next wednesday"
     
    or
     
    dcalc "1 day after tomorrow"
     
    Yup! A natural date language parser! 
    You can even combine it with the existing parser:
     
    dcalc "next friday" + 1d
     
    This is a little bit experimental (I might drop it later if it proves to be problematic), but I thought I'd throw it in for a bit of a fun.
     
     
    Credits
    A list of things that made my first attempt at Python programming possible:
    Dean Jackson for his more-than-slightly awesome Alfred Workflow framework(Jetbrains(HumanFriendly(Python-DateUtil(PyPEG(ParseDateTime(Programming Praxis(MIT(http://opensource.org/licenses/MIT) one will do. :-)The MIT License (MIT)
    Copyright © 2014 MuppetGate Media
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  15. Like
    MuppetGate got a reaction from 40-02 in Yet another date calculator   
    Date Calculator
     
    Hello there!
    I needed a bit of motivation to learn Python and Alfred workflows, so I thought I’d kill two horses with one bullet, so to speak.
    Right, so this is a date calculator – kind of. It won’t tell you when you will the lottery, or how long you’ve got to hide your ‘arty videos’ before your wife gets home, but it will answer one or two very simple questions about dates.
     

    For example, if you enter
     
    dcalc 25.12.14 - 18.01.14
     
    then it will tell you the number of days between those dates. Note that the workflow parses the command as you enter it, so you’ll see invalid command, invalid expression and invalid formaterrors as you type. Once you’ve completed the command then you’ll be given the result.
    You could also try
     
    dcalc 25.12.14 - now
     
    for the number of days until Christmas. (Always seems so far away . . .)
    Maybe you don’t want it in days, but would rather it in weeks:
     
    dcalc 25.12.14 - now w
     
    or days and weeks
     
    dcalc 25.12.14 - now wd
     
    or years, months, weeks and days
     
    dcalc 25.12.14 - now ymwd
     
    or
     
    dcalc 25.12.14 - now long
     
    will do the same thing. Personally, I always use the long format because it’s more accurate.
    For those who like to look ahead, you can add days to a date
     
    dcalc now + 6d
     
    or weeks
     
    dcalc 18.12.14 + 9w
     
    or combine ‘em
     
    dcalc 18.12.12 + 5y 9d 3w - 2d + 1d 1w
     
    What does that mess do?
    Take the date 18.12.12  Add 5 years Add another 9 days Add another 3 weeks Then take off 2 days Add another 1 day And then add another 1 week If you want to know what week number you’re in, then try this:
     
    dcalc today wn
     
    Or for a specific date:
     
    dcalc 25.12.14 wn
     
    You can also use the today thing in other places too:
     
    dcalc today + 4d
     
    And we have another thing called time because the workflow can handle times too:
     
    dcalc time + 6h 8M
     
    will add 6 hours and 8 minutes to the current time. Note the capital ‘M’ to denote minutes. Odd, I know . . . sorry, but the workflow has to distinguish between this and a small ‘m’ (for months). I figured make this one a capital because it would see much less use. (It has for me.)
    If you just want the current time, then just enter
     
    dcalc time
     
    Here’s another time calculation
     
    dcalc 14:35 + 6h
     
    That’s the time 6 hours from now, and for real nerdiness:
     
    dcalc 21.06.14@14:20 - 23.01.12@09:21 long
     
    Probably not all that useful, but some of this other stuff might be. You know all about
     
    dcalc now
     
    For giving you the current time and date. While you can use 
     
    dcalc tomorrow
     
    for tomorrow’s date, and as you would expect
     
    dcalc tomorrow + 1d
     
    will give you the day after tomorrow.
     
    dcalc next tue
     
    will give you the date next Tuesday. Or for for Thursday you could enter
     
    dcalc next tue + 2d
    if you’re still a little too inebriated to realise that
     
    dcalc next thu
     
    will give you the same answer.
    That about covers it, I think. I haven’t done anything clever with locales, but you can pick a different date format with
     
    dcalcset date format
     
    And we also support both 12-hour and 24-hour time formats. 
     
    dcalcset time format
     
    I would recommend sticking with the 24-hour format; it's a lot easier to type because the AM/PM symbols have to be in upper case.
    You can also set the combined date and time format using:
     
    dcalcset date and time format
     
    If you’re ever puzzled by invalid command or invalid expression errors, then start with the settings; they might be set incorrectly.
    Oh, almost forgot.
     
    dcalc easter
     
    Is the date for next Easter Sunday, for no other reason that I can never remember it, and now there’s an easy way to find out how many days until Christmas:
     
    dcalc today - christmas
     
    And to celebrate finishing my new book, I decided to add:
    dcalc passover
     
    Alternative parser
    If surround a simple expression in double quotes, then something quite magical happens:
     
    dcalc "4 hours 8 minutes after 4pm"
     
    or
     
    dcalc "6 weeks and 4 days after next wednesday"
     
    or
     
    dcalc "1 day after tomorrow"
     
    Yup! A natural date language parser! 
    You can even combine it with the existing parser:
     
    dcalc "next friday" + 1d
     
    This is a little bit experimental (I might drop it later if it proves to be problematic), but I thought I'd throw it in for a bit of a fun.
     
     
    Credits
    A list of things that made my first attempt at Python programming possible:
    Dean Jackson for his more-than-slightly awesome Alfred Workflow framework(Jetbrains(HumanFriendly(Python-DateUtil(PyPEG(ParseDateTime(Programming Praxis(MIT(http://opensource.org/licenses/MIT) one will do. :-)The MIT License (MIT)
    Copyright © 2014 MuppetGate Media
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. Like
    MuppetGate reacted to MuppetGate in Yet another date calculator   
    That's very clever!
     
    I'll have a crack at it when I've checked some examples.
  17. Like
    MuppetGate got a reaction from DJay in Yet another date calculator   
    Date Calculator
     
    Hello there!
    I needed a bit of motivation to learn Python and Alfred workflows, so I thought I’d kill two horses with one bullet, so to speak.
    Right, so this is a date calculator – kind of. It won’t tell you when you will the lottery, or how long you’ve got to hide your ‘arty videos’ before your wife gets home, but it will answer one or two very simple questions about dates.
     

    For example, if you enter
     
    dcalc 25.12.14 - 18.01.14
     
    then it will tell you the number of days between those dates. Note that the workflow parses the command as you enter it, so you’ll see invalid command, invalid expression and invalid formaterrors as you type. Once you’ve completed the command then you’ll be given the result.
    You could also try
     
    dcalc 25.12.14 - now
     
    for the number of days until Christmas. (Always seems so far away . . .)
    Maybe you don’t want it in days, but would rather it in weeks:
     
    dcalc 25.12.14 - now w
     
    or days and weeks
     
    dcalc 25.12.14 - now wd
     
    or years, months, weeks and days
     
    dcalc 25.12.14 - now ymwd
     
    or
     
    dcalc 25.12.14 - now long
     
    will do the same thing. Personally, I always use the long format because it’s more accurate.
    For those who like to look ahead, you can add days to a date
     
    dcalc now + 6d
     
    or weeks
     
    dcalc 18.12.14 + 9w
     
    or combine ‘em
     
    dcalc 18.12.12 + 5y 9d 3w - 2d + 1d 1w
     
    What does that mess do?
    Take the date 18.12.12  Add 5 years Add another 9 days Add another 3 weeks Then take off 2 days Add another 1 day And then add another 1 week If you want to know what week number you’re in, then try this:
     
    dcalc today wn
     
    Or for a specific date:
     
    dcalc 25.12.14 wn
     
    You can also use the today thing in other places too:
     
    dcalc today + 4d
     
    And we have another thing called time because the workflow can handle times too:
     
    dcalc time + 6h 8M
     
    will add 6 hours and 8 minutes to the current time. Note the capital ‘M’ to denote minutes. Odd, I know . . . sorry, but the workflow has to distinguish between this and a small ‘m’ (for months). I figured make this one a capital because it would see much less use. (It has for me.)
    If you just want the current time, then just enter
     
    dcalc time
     
    Here’s another time calculation
     
    dcalc 14:35 + 6h
     
    That’s the time 6 hours from now, and for real nerdiness:
     
    dcalc 21.06.14@14:20 - 23.01.12@09:21 long
     
    Probably not all that useful, but some of this other stuff might be. You know all about
     
    dcalc now
     
    For giving you the current time and date. While you can use 
     
    dcalc tomorrow
     
    for tomorrow’s date, and as you would expect
     
    dcalc tomorrow + 1d
     
    will give you the day after tomorrow.
     
    dcalc next tue
     
    will give you the date next Tuesday. Or for for Thursday you could enter
     
    dcalc next tue + 2d
    if you’re still a little too inebriated to realise that
     
    dcalc next thu
     
    will give you the same answer.
    That about covers it, I think. I haven’t done anything clever with locales, but you can pick a different date format with
     
    dcalcset date format
     
    And we also support both 12-hour and 24-hour time formats. 
     
    dcalcset time format
     
    I would recommend sticking with the 24-hour format; it's a lot easier to type because the AM/PM symbols have to be in upper case.
    You can also set the combined date and time format using:
     
    dcalcset date and time format
     
    If you’re ever puzzled by invalid command or invalid expression errors, then start with the settings; they might be set incorrectly.
    Oh, almost forgot.
     
    dcalc easter
     
    Is the date for next Easter Sunday, for no other reason that I can never remember it, and now there’s an easy way to find out how many days until Christmas:
     
    dcalc today - christmas
     
    And to celebrate finishing my new book, I decided to add:
    dcalc passover
     
    Alternative parser
    If surround a simple expression in double quotes, then something quite magical happens:
     
    dcalc "4 hours 8 minutes after 4pm"
     
    or
     
    dcalc "6 weeks and 4 days after next wednesday"
     
    or
     
    dcalc "1 day after tomorrow"
     
    Yup! A natural date language parser! 
    You can even combine it with the existing parser:
     
    dcalc "next friday" + 1d
     
    This is a little bit experimental (I might drop it later if it proves to be problematic), but I thought I'd throw it in for a bit of a fun.
     
     
    Credits
    A list of things that made my first attempt at Python programming possible:
    Dean Jackson for his more-than-slightly awesome Alfred Workflow framework(Jetbrains(HumanFriendly(Python-DateUtil(PyPEG(ParseDateTime(Programming Praxis(MIT(http://opensource.org/licenses/MIT) one will do. :-)The MIT License (MIT)
    Copyright © 2014 MuppetGate Media
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. Like
    MuppetGate reacted to raguay.customct in Not so much a suggestion as a question: Swift?   
    Swift is a compiler. You can run thing interpreted, but it is designed as a compiler. Therefore, if you create a workflow using it (like I do go), it would run a compiled program. Nothing special for Alfred to support. You can look at my Alfred Time Keeper and Title Case Server workflows to see how to use go in an Alfred workflow. The same procedure would work for Swift.
     
    I am currently learning Swift to use it like this. Watch out for future workflows from me that make use of a swift compiled program.
     
    Those interested: The minimal hello world program in go compiles to 2.1Mb. The same type of program is only 32K in swift!!!!
  19. Like
    MuppetGate reacted to rice.shawn in Creating a HUD   
    Does anyone know a good way to make a HUD? In my WHW workflow, I created a way to display the results via a quicklook debugging command, but I want to make it much better. I've looked into the automator action "show website pop-up," which basically created a HUD via a webpage, but it's not so elegant because, in order to include it in a workflow, I'd have to create a sort of "firstrun" script that would update the plist for the automator "application" in order to make it work for each person.
     
    Basically, I'd like to be able to create something like this: (http://www.grandtotal.biz/CheatSheet/). Or, another way to do it would be to create a version of the Large Text notification that would be dismissible with an escape key but that would be able to display a html file or something along those lines.
     
    Any help? If I can figure out how to do this, then I'll probably abstract it and release it as a library for other workflow developers to use.
     
    Shawn
  20. Like
    MuppetGate got a reaction from leefur in The Minimalist   
    Excellent work. Thanks for sharing!
     

  21. Like
    MuppetGate got a reaction from Tyler Eich in Store images in Alfred's clipboard history, allow images in clipboard snippets   
    Another vote for images in the Alfred clipboard
  22. Like
    MuppetGate reacted to joseluisdgz in Workflow App Switching cmd+tab replacement   
    Hi everyone.
     
    First of all I already know running-apps workflow from Ted Wise http://tedwise.com/2013/03/04/alfred-2-workflows/
     
    But what I'm wondering is if it could be possible to implement in Alfred something like Contexts http://contextsformac.com
     
    This app looks very similar to Alfred and it would be incredible to implement that switching function in Alfred, specially points 2, 3 and 4 (not the sidebar function).
     
    What do you think?
     
  23. Like
    MuppetGate reacted to Tyler Eich in Store images in Alfred's clipboard history, allow images in clipboard snippets   
    It would be really cool if Alfred had an option for storing images in Clipboard History. Plain text is easy to search and light on resources, but limiting if you rely on images (e.g. graphic designer).
     
    When using snippets and/or workflow clipboard objects, {clipboard} should be able to inject images stored in the Clipboard.
     
    This would obviously increase Alfred's memory usage; if implemented, it should definitely be optional. Maybe even separate settings that set limits on how big a stored image can be (just like the current implementation for text clipping size).
     
    Cheers
  24. Like
    MuppetGate reacted to xtin in Debug Mode!   
    Right now, if Alfred has an Error in the XML it receives or cannot parse due to encoding problems, it will just not parse it.
     
    Could you please add a "show errors/debug" checkbox for workflows, so that these parsing errors are displayed as XML replies? It would make creating extensions and more importantly remote debugging strange problems a LOT easier!
     
    Also, a minor one: if you use python and do
    print u"some string containing üäöàéè", Alfred will simply ignore it, while the same as a non unicode string works. 
  25. Like
    MuppetGate reacted to mcskrzypczak in Drag and drop for File buffer   
    I do realize that. The point is that I can drag'n'drop only one element in the way you described. What I was mean is to drag all files selected (by using alt+down arrow) in file buffer into somewhere else.
×
×
  • Create New...