nlippman Posted May 3, 2013 Share Posted May 3, 2013 I'm not sure how to title my question, so hopefully you are reading this (!). I'll just describe what I am trying to accomplish and hopefully someone can help me out. I use Taskpaper for my todos, synced via Dropbox, so all of my Taskpaper files are stored in ~/Dropbox/Taskpaper. I want to create a workflow to rapidly add a task to the Inbox project of a selected file, so the syntax would be something like: tp <filename> <text of item to enter> [@tag @tag] Easy enough so far. However, what I was hoping to do is, when the "tp" command is first entered, present a listing of all of the taskpaper files in that folder so that I can see the list and decide which one to type for the task entry. Also easy enough. But (and here's my question, finally): what I would also like to be able to do is to select once of those files, either with the arrow keys and hitting enter, with a mouse click, or with a command-number keypress, and have the name of that file then entered in the Alfred command box, and then I can continue typing the rest of the entry. I don't see anyway to make that happen. I think I could do this by chaining workflows via osascript as has been detailed in one of the pinned postings, but that's not completely ideal, especially with the flashing of the Alfred dialog box, so it isn't elegant. Is there a way to accomplish this? Thanks! Link to comment
Tyler Eich Posted May 3, 2013 Share Posted May 3, 2013 I'm not sure how to title my question, so hopefully you are reading this (!). I'll just describe what I am trying to accomplish and hopefully someone can help me out. I use Taskpaper for my todos, synced via Dropbox, so all of my Taskpaper files are stored in ~/Dropbox/Taskpaper. I want to create a workflow to rapidly add a task to the Inbox project of a selected file, so the syntax would be something like: tp <filename> <text of item to enter> [@tag @tag] Easy enough so far. However, what I was hoping to do is, when the "tp" command is first entered, present a listing of all of the taskpaper files in that folder so that I can see the list and decide which one to type for the task entry. Also easy enough. But (and here's my question, finally): what I would also like to be able to do is to select once of those files, either with the arrow keys and hitting enter, with a mouse click, or with a command-number keypress, and have the name of that file then entered in the Alfred command box, and then I can continue typing the rest of the entry. I don't see anyway to make that happen. I think I could do this by chaining workflows via osascript as has been detailed in one of the pinned postings, but that's not completely ideal, especially with the flashing of the Alfred dialog box, so it isn't elegant. Is there a way to accomplish this? Thanks! You may like the 'autocomplete' attribute; on pressing enter or tab, it keeps the keyword and enters the item's 'autocomplete' value. Just make sure you set the 'valid' attribute to 'no'. Link to comment
nlippman Posted May 3, 2013 Author Share Posted May 3, 2013 Ah...thank you, I will have a look into that! Link to comment
nlippman Posted May 3, 2013 Author Share Posted May 3, 2013 OK, so that works in terms of being able to pop up the "menu" of available Taskpaper files, and I can then select one of them via keyboard, command-key combination, etc. I discovered that for the autocomplete, you need to put spaces around the text as whatever the autocomplete value is, it is added to the Alfred buffer, so if you want spaces before and after, you need to do them manually. Now, the problem is that once I have selected one of the items, OR if I type the filename by hand, I need a way of getting the menu of choices to be deactivated. Otherwise, you cannot send anything to Alfred. Each time I hit enter, it just adds the topmost item from the selection choices to the buffer. There must be some way of telling Alfred that after you have made one selection you then deactivate the selection menu, but I don't see how to do that. Any ideas? Link to comment
Tyler Eich Posted May 3, 2013 Share Posted May 3, 2013 OK, so that works in terms of being able to pop up the "menu" of available Taskpaper files, and I can then select one of them via keyboard, command-key combination, etc. I discovered that for the autocomplete, you need to put spaces around the text as whatever the autocomplete value is, it is added to the Alfred buffer, so if you want spaces before and after, you need to do them manually. Now, the problem is that once I have selected one of the items, OR if I type the filename by hand, I need a way of getting the menu of choices to be deactivated. Otherwise, you cannot send anything to Alfred. Each time I hit enter, it just adds the topmost item from the selection choices to the buffer. There must be some way of telling Alfred that after you have made one selection you then deactivate the selection menu, but I don't see how to do that. Any ideas? I would use a delimiter; the demo workflow (downloadable from pinned post) includes a right triangle character in the autocomplete value. If you have a rough idea of how to read PHP, I would recommend downloading that workflow and investigating the source code. David Ferguson will likely be better at explaining the concept to you; I would ask him if you need further assistance Link to comment
jdfwarrior Posted May 4, 2013 Share Posted May 4, 2013 OK, so that works in terms of being able to pop up the "menu" of available Taskpaper files, and I can then select one of them via keyboard, command-key combination, etc. I discovered that for the autocomplete, you need to put spaces around the text as whatever the autocomplete value is, it is added to the Alfred buffer, so if you want spaces before and after, you need to do them manually. Now, the problem is that once I have selected one of the items, OR if I type the filename by hand, I need a way of getting the menu of choices to be deactivated. Otherwise, you cannot send anything to Alfred. Each time I hit enter, it just adds the topmost item from the selection choices to the buffer. There must be some way of telling Alfred that after you have made one selection you then deactivate the selection menu, but I don't see how to do that. Any ideas? I would use a delimiter; the demo workflow (downloadable from pinned post) includes a right triangle character in the autocomplete value. If you have a rough idea of how to read PHP, I would recommend downloading that workflow and investigating the source code. David Ferguson will likely be better at explaining the concept to you; I would ask him if you need further assistance Once again, Tyler is spot on. I swear, the guy can read my mind Using a delimiter would probably be the best option since it wouldn't cause the flashing that your described by popping the box back up. It also makes it easy to count the number of parameters you have, use autocomplete, etc. It would simply be that, you count the number of delimiters and say, ok, based on this number they are at "this" step and I should make the script generate "this" output. Then you would adjust that for each step, dependent on how many delimiters were there. As Tyler suggested, check out the post I did on this. It should show you how to accomplish it. 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