Jump to content

lehcar3

Member
  • Posts

    11
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    lehcar3 got a reaction from macrospect in Write Text File to folder selected from list   
    @deanisheThank you so much for taking the time to write that. It worked perfectly, and I know I will get further use out of it in future workflows. 
     
    I am posting my final workflow here for anyone interested in importing one snippet to Alfred. 
     
    Background
    I often use this method (Github link) which works to BULK-import snippets into Alfred using a csv. But oftentimes, I'm going about my day and I find that there's a single snippet I'd like to save. It always feels unnecessarily cumbersome to have to open alfred and navigate to the Snippets area and click around to add a single snippet.
     
    This workflow
    This workflow allows you to invoke Alfred and create a single new snippet directly from the Alfred entry window.
     
    Entry:
    There are two methods:
    A ) You can enter a comma delimited string for snippet,name,value all at once.
    B ) You are prompted step by step for snippet, name, and value.
     
    Folder selection:
    It prompts you to choose which preexisting snippets folder you want to save it in (it's possible you may need to change the snippets directory in the Script Filter). This uses the lovely script written by @deanishe above.
     
    Snippet creation:
    It creates a json file within the appropriate folder. A random identifier is required within the file itself and as part of the filename, so you'll see some random variable cleanup happening in the workflow.
     
    Reveal:
    For fun and validation, it reveals to you the snippet file in Finder (delete this step if not needed).
     
    Using the snippet:
    I found through testing that the snippet is not immediately available for use after it's created. It appeared eventually, but after I checked immediately and it wasn't able to be called in the snippets window, I checked again and it was there like ~10 minutes later. My guess is that Alfred loads its snippets on startup, or periodically, or by manual interaction with the snippets preferences (idk). So, the last step in this workflow restarts Alfred in case you want to use it immediately. If this step is found to be annoying, or if you don't think you will need the snippet immediately (it's probably on your clipboard :)) this step can be removed. 
    The script used here is from:
     
    Download this workflow:
    https://drive.google.com/file/d/1Oe1XXViYe2fHWTgQqRvjT7KeUEAEwzBf/view?usp=sharing
     
    Disclaimer:
    This workflow is not perfect and could definitely be streamlined (e.g., the random variable cleanup might not be necessary, maybe there's something less aggressive than restarting Alfred). Also sorry if I didn't follow layout best practices for long workflows, I couldn't find what they are and tried to make it as neat as I could.
  2. Like
    lehcar3 got a reaction from joshuadwagner in Write Text File to folder selected from list   
    @deanisheThank you so much for taking the time to write that. It worked perfectly, and I know I will get further use out of it in future workflows. 
     
    I am posting my final workflow here for anyone interested in importing one snippet to Alfred. 
     
    Background
    I often use this method (Github link) which works to BULK-import snippets into Alfred using a csv. But oftentimes, I'm going about my day and I find that there's a single snippet I'd like to save. It always feels unnecessarily cumbersome to have to open alfred and navigate to the Snippets area and click around to add a single snippet.
     
    This workflow
    This workflow allows you to invoke Alfred and create a single new snippet directly from the Alfred entry window.
     
    Entry:
    There are two methods:
    A ) You can enter a comma delimited string for snippet,name,value all at once.
    B ) You are prompted step by step for snippet, name, and value.
     
    Folder selection:
    It prompts you to choose which preexisting snippets folder you want to save it in (it's possible you may need to change the snippets directory in the Script Filter). This uses the lovely script written by @deanishe above.
     
    Snippet creation:
    It creates a json file within the appropriate folder. A random identifier is required within the file itself and as part of the filename, so you'll see some random variable cleanup happening in the workflow.
     
    Reveal:
    For fun and validation, it reveals to you the snippet file in Finder (delete this step if not needed).
     
    Using the snippet:
    I found through testing that the snippet is not immediately available for use after it's created. It appeared eventually, but after I checked immediately and it wasn't able to be called in the snippets window, I checked again and it was there like ~10 minutes later. My guess is that Alfred loads its snippets on startup, or periodically, or by manual interaction with the snippets preferences (idk). So, the last step in this workflow restarts Alfred in case you want to use it immediately. If this step is found to be annoying, or if you don't think you will need the snippet immediately (it's probably on your clipboard :)) this step can be removed. 
    The script used here is from:
     
    Download this workflow:
    https://drive.google.com/file/d/1Oe1XXViYe2fHWTgQqRvjT7KeUEAEwzBf/view?usp=sharing
     
    Disclaimer:
    This workflow is not perfect and could definitely be streamlined (e.g., the random variable cleanup might not be necessary, maybe there's something less aggressive than restarting Alfred). Also sorry if I didn't follow layout best practices for long workflows, I couldn't find what they are and tried to make it as neat as I could.
×
×
  • Create New...