dfay Posted July 29, 2018 Posted July 29, 2018 (edited) Dynamic snippets to insert the date corresponding to the upcoming day. d.nm - next Monday d.nt - next Tuesday d.nw - next Wednesday d.nr - next Thursday d.nf - next Friday d.ns - next Saturday So given today's date 2018-07-30, the snippets in sequence produce 2018-08-06 2018-07-31 2018-08-01 2018-08-02 2018-08-03 2018-08-04 d.m+ - first day of next month 2020-02-01 And dt.n to add the next business day in prose, e.g. Tuesday, June 4, 2019 Download v. 1.2 - added first day of next month - added external triggers for M of next week and 1st of next month - updated so snippets will paste in Alfred (using the trick here: https://www.alfredforum.com/topic/11765-snippet-triggers-triggered-in-alfred-dont-paste-to-alfred/?tab=comments#comment-61652 ) v. 1.3 2022-03-31 - updated to use Python 3 for compatibility with MacOS 12.3 Edited April 1, 2022 by dfay cands, flome and iGyver 1 2
dfay Posted June 3, 2019 Author Posted June 3, 2019 Updated to use Alfred 4 conditionals to add a snippet to produce the next business day in prose (almost as requested here):
dfay Posted January 31, 2020 Author Posted January 31, 2020 Updated to v.1.2 - added first day of next month - added external triggers for M of next week and 1st of next month - updated so snippets will paste in Alfred (using the trick here: https://www.alfredforum.com/topic/11765-snippet-triggers-triggered-in-alfred-dont-paste-to-alfred/?tab=comments#comment-61652 ) cands 1
sbc Posted April 20, 2020 Posted April 20, 2020 Can you provide an example of how to use this in a snippet? I've tried every possible permutation I can think of with no success. Thanks!
dfay Posted April 20, 2020 Author Posted April 20, 2020 It's a workflow, with snippet triggers, so you'd need the PowerPack & to install the .alfredworkflow file linked in the first post.
sbc Posted April 21, 2020 Posted April 21, 2020 Thanks. Yes, I have the powerpack and workflow installed. One thing I noticed just now is that the snippets in the workflow didn't import with the keywords set. Once I added a keyword I was able to get the snippet to work, e.g. here => 2020-04-27. Are the keywords not supposed to be imported along with the workflow, or is there a problem somewhere? That aside, what I'm really trying to do is use these snippet triggers within another snippet. OnceI realized this was probably the problem, I found your comment to a thread on nested snippets, which I read as saying I'll need to customize the workflow in order to get this to work. Is that still the case, as far as you know?
deanishe Posted April 21, 2020 Posted April 21, 2020 2 hours ago, sbc said: Are the keywords not supposed to be imported along with the workflow, or is there a problem somewhere? Alfred strips hotkeys and snippet triggers on import to prevent surprises. You have to set your own, but once you do, Alfred will remember them and keep your changes when you update a workflow. sbc 1
juuls Posted January 12, 2021 Posted January 12, 2021 @dfay can you please explain what to change in the workflow in order to get it working? Perhaps share some screenshots :) Every snippit in the workflow starts with :week.
dfay Posted January 12, 2021 Author Posted January 12, 2021 I'm not really sure what you're asking. Here's what my setup looks like: juuls 1
ComposMentis Posted May 29, 2021 Posted May 29, 2021 Hey @dfay I am just finding this workflow now - thank you! It's working great so far. I wanted to ask if there was any reason you didn't include a snippet for Sunday (i.e. next Sunday)? Quote d.nm - next Monday d.nt - next Tuesday d.nw - next Wednesday d.nr - next Thursday d.nf - next Friday d.ns - next Saturday I personally work on Sundays and would love this to be included as well. Can you guide me through how to add that, or perhaps include that in an update if it's not too difficult? I'm also curious if it is possible to duplicate them to include something like ;sunday in two weeks; or ;monday in two weeks; - that would be super handy. I'm curious if you have a guide or steps published somewhere to edit this workflow in any way? I've been looking for a way to enter dates dynamically like this for a while - thanks again!
erikhighlander Posted November 14, 2022 Posted November 14, 2022 hi @dfay, does this still work on Ventura? for some reason, I can't get it to run. It just returns the last thing on my clipboard. thanks!
dfay Posted November 15, 2022 Author Posted November 15, 2022 Yes, it’s working for me. What are you seeing in the debugging console?
erikhighlander Posted January 6, 2023 Posted January 6, 2023 sorry for the very late reply. it's still not working for me. [07:54:16.029] Date snippets[Snippet] Processing complete [07:54:16.034] Date snippets[Snippet] Passing output '' to Arg and Vars [07:54:16.035] Date snippets[Arg and Vars] Processing complete [07:54:16.036] Date snippets[Arg and Vars] Passing output '0' to Run Script [07:54:16.049] ERROR: Date snippets[Run Script] xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun [07:54:16.051] Date snippets[Run Script] Processing complete [07:54:16.051] Date snippets[Run Script] Passing output '' to Copy to Clipboard [07:54:16.052] Date snippets[Copy to Clipboard] Processing complete [07:54:16.053] Date snippets[Copy to Clipboard] Passing output '' to Dispatch Key Combo
erikhighlander Posted January 6, 2023 Posted January 6, 2023 i'm sure this is an easy fix for you, but it's not for me 😜 what is xcrun?
vitor Posted January 7, 2023 Posted January 7, 2023 @erikhighlander See another post for the fix. It was caused by the update.
Richard Wayman Posted August 9, 2023 Posted August 9, 2023 This workflow is just what I've been looking for, thanks. Is there a way to modify the date format of the output? At the moment it's in this format: 2023-08-15 With other Alfred snippets I can specify e.g. {date:dd.MM.yyyy} Is there a way to specify the date output format for this workflow? Thanks in advance 🙏🏻
Benjamski Posted August 14, 2023 Posted August 14, 2023 On 8/9/2023 at 12:33 AM, Richard Wayman said: This workflow is just what I've been looking for, thanks. Is there a way to modify the date format of the output? At the moment it's in this format: 2023-08-15 With other Alfred snippets I can specify e.g. {date:dd.MM.yyyy} Is there a way to specify the date output format for this workflow? Thanks in advance 🙏🏻 I would love to know this as well!
Benjamski Posted June 15 Posted June 15 The dropbox link here is dead and I can't seem to find this anywhere. Do you still have and use this? I had this on my last work computer and used it constantly, I lost it at some point in the transition to a new job and I'd love to get it back again.
Vero Posted June 15 Posted June 15 @Benjamski The link in @dfay's original post works fine, and should download the workflow to your Downloads folder - you then just need to double click the workflow file to install it. https://www.dropbox.com/s/amdtc2yzledbm1h/Date snippets.alfredworkflow?dl=1 You'll then need to configure your snippet keywords too
dfay Posted June 15 Author Posted June 15 The Dropbox link works for me too. Tha date format is set in the file dates.py #!/usr/bin/env python3 import sys import nextday query = int(sys.argv[1]) sys.stdout.write(nextday.nextWeekday(query).strftime('%Y-%m-%d')) Here are the options for use with strftime : https://docs.python.org/3/library/datetime.html#format-codes
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now