pauljacobson Posted June 30, 2018 Share Posted June 30, 2018 I'm trying to work out how to complete a second step in a new workflow that will streamline a workflow I use several times a day. I create Markdown notes throughout my day. I have a pretty basic workflow that runs a terminal command that, in turn, creates a file and opens it in my text editor. I then invoke a snippet that populates the note with predefined text, and multiple clipboard items that I save before I invoke the workflow. In other words: Save multiple bits of information to my Alfred clipboard in a predetermined sequence Run a terminal command through a simple workflow that creates the Markdown file, and opens it in my text editor When the file opens in my editor, I manually run a snippet that populates the file, including the clipboard items using {clipboard:0}, {clipboard:1}, etc syntax. The terminal command looks something like this: touch ~/path/to/directory/$(date +%Y-%m-%d)_Feedback_{query}_Interactions.md & open ~/path/to/directory/$(date +%Y-%m-%d)_Feedback_{query}_Interactions.md -a Atom The {query} is something I add when I trigger the workflow. The snippet contains predefined text with placeholders for my clipboard items. I'd like to combine all of that from into a single workflow. What I can't work out is how to include the 3rd step in the workflow so I can run it all as a single step. I don't suppose anyone has any suggestions? Link to comment
deanishe Posted June 30, 2018 Share Posted June 30, 2018 A couple of things: If you have a question about a workflow, please upload the workflow somewhere and post a link to it. It saves a lot of time and avoids confusion. Secondly, can you explain what you're trying to achieve, not how you're trying to achieve it? This also saves time and avoids confusion. You're trying to create a new file with some specific content. Why does the content have to come from the clipboard history? Link to comment
pauljacobson Posted June 30, 2018 Author Share Posted June 30, 2018 Thanks for getting back to me. Quote If you have a question about a workflow, please upload the workflow somewhere and post a link to it. It saves a lot of time and avoids confusion. The workflow is basically a trigger that runs a command like the one I pasted into my post. Like I said, it's really simple. Quote Secondly, can you explain what you're trying to achieve, not how you're trying to achieve it? As I mentioned in my post, I want to have a single workflow that performs all three steps. The step I can't work out is how to automatically populate my newly created document with my predefined text, replacing placeholders in the text with clipboard items. Quote Why does the content have to come from the clipboard history? The reason for this is that each note contains variables from another source that I combine into my note. Think of each note as an email to a customer that contains predefined responses, customised with customer-specific information (a little like a mail-merge except each note contains around 4 different pieces of information). Link to comment
Tsunami Posted June 30, 2018 Share Posted June 30, 2018 (edited) You can use an Arg and Vars utility and set Argument to: {date:yyyy-MM-dd}_Feedback_{query}_Interactions.md Then connect it to a Write Text File output and use {query} for the filename. Then connect that to an Open File action. Something like this: https://puu.sh/AOuLY/88201bbcc4.alfredworkflow Edited June 30, 2018 by Tsunami Link to comment
deanishe Posted June 30, 2018 Share Posted June 30, 2018 50 minutes ago, pauljacobson said: Like I said, it's really simple. That's not the entire point. We can't magically write workflows in our heads. We normally need to run some code. So you're expecting us to recreate your workflow for ourselves, simply in order to help you. It's not particularly reasonable to waste other people's time like that. So please, upload the workflow. 48 minutes ago, pauljacobson said: As I mentioned in my post, I want to have a single workflow that performs all three steps. 48 minutes ago, pauljacobson said: contains variables from another source that I combine into my note You didn't answer the question. You're describing your proposed solution, not the problem you're actually trying to solve. I appreciate the variables are coming from somewhere else. That doesn't mean they have to come via the clipboard history. CJK 1 Link to comment
vitor Posted June 30, 2018 Share Posted June 30, 2018 I’m quoting @deanishe, but my points are for @pauljacobson. 4 hours ago, deanishe said: 5 hours ago, pauljacobson said: Like I said, it's really simple. That's not the entire point. We can't magically write workflows in our heads. We normally need to run some code. So you're expecting us to recreate your workflow for ourselves, simply in order to help you. I’ll also add that it is not the domain of the asker to decide what is simple or not. For all we know, your workflow has an error in construction that you’re not seeing. Example: it has already happened that after an asker uploaded their Workflow, it was discovered it had an invisible character that was causing the bug. That’s an impossible bug to fix unless we have access to the actual Workflow as you made it. 4 hours ago, deanishe said: You're describing your proposed solution, not the problem you're actually trying to solve. This is important because for all we know you may be trying a convoluted solution when a simpler one is available. Trying for the harder solution wastes everyone’s time and makes your Workflow worse. CJK and deanishe 2 Link to comment
deanishe Posted July 1, 2018 Share Posted July 1, 2018 Moving this to Workflow Help & Questions. Link to comment
pauljacobson Posted July 3, 2018 Author Share Posted July 3, 2018 Ok, I've uploaded the workflow (I edited the paths, but retained the placeholders I'm using). You can grab it here. The problem I'm trying to solve is the following: 1. I use this workflow to create a file. 2. I then use a Alfred snippet to populate the file with predefined text. 3. This predefined text incorporates clipboard placeholders that are replaced with bits of text in my clipboard history. There are too many steps. I want to extend my current workflow to add step 2 to the process. So the workflow creates the file, and automatically populates it with the predefined text. Does this make sense? Link to comment
deanishe Posted July 3, 2018 Share Posted July 3, 2018 (edited) First off, a Terminal Command doesn't seem appropriate. There's no reason (that I see) that needs to be run in an interactive shell, so you should be using a Run Script Action instead. There are issues with the code, as well. & after a command means "run previous command in the background". You want && which means "run next command if the last one succeeded": 1 hour ago, pauljacobson said: Does this make sense? Not in any actionable way, I'm afraid. You're still describing your solution, not the actual problem you're trying to solve. Don't tell us the steps, tell us the result you want to achieve: "I want to create a file called XYZ in folder ABC containing data 123 and 456 which are from MNO" You're hung up on this "I want to automate expanding a snippet into a file". But (Alfred's) snippets just do not work that way. So please, tell us the desired result of step 2 so we can recommend a sane alternative way to achieve the same result. Edited July 3, 2018 by deanishe Link to comment
Tsunami Posted July 3, 2018 Share Posted July 3, 2018 @pauljacobson did you see my previous post? I believe the workflow I uploaded does what you want, without a snippet or even a shell command. I agree that depending on what you're copying to the clipboard (is it just a few words or entire walls of text?), it may be better to use something else to store the variables that are in the text. Link to comment
pauljacobson Posted July 4, 2018 Author Share Posted July 4, 2018 20 hours ago, Tsunami said: did you see my previous post? I believe the workflow I uploaded does what you want, without a snippet or even a shell command. Hi there @Tsunami Apologies, I didn't notice the workflow. I'll try that out, thank you. The clipboard items vary. They include single words, as well as blocks of text. Thanks for your suggestions everyone. It looks like Alfred may not be able to do what I'd like to do (if Tsunami's workflow doesn't do what I hope it will do). I appreciate your input. Link to comment
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