BrianGilbert_ Posted August 25, 2013 Share Posted August 25, 2013 is it bossible to copy any of these to the clipboard 'uid' => $value['hookname'], 'arg' => $value['hookname'], <- {query} 'title' => $value['hook'], <- ideally I want to copy this 'subtitle' => $value['value'], Link to comment
jdfwarrior Posted August 25, 2013 Share Posted August 25, 2013 is it bossible to copy any of these to the clipboard 'uid' => $value['hookname'], 'arg' => $value['hookname'], <- {query} 'title' => $value['hook'], <- ideally I want to copy this 'subtitle' => $value['value'], Unsure of the application here.. could you help me understand a little better what it is that you need to do? Link to comment
BrianGilbert_ Posted August 25, 2013 Author Share Posted August 25, 2013 (edited) Hi David This is for the Drupal workflow I've written, {query} is required for opening a URL, but I'd like to copy the full function including it's expected variables to the clipboard. an example: aggregator_admin_remove_feed_submit <-- 'arg' / {query} required for the opened url to work properly -https://api.drupal.org/api/drupal/7/search/{query} -https://api.drupal.org/api/drupal/7/search/aggregator_admin_remove_feed_submit aggregator_admin_remove_feed_submit($form, &$form_state) <-- 'title' is what I want to copy to the to clipboard Just in case it helps here is a lrger section of the code $results = array();foreach( $matches as $hook => $sugg ) { if (!empty($sugg)) { $value = $sugg; } else { $value = ""; } $item = array( 'uid' => $value['hookname'], 'arg' => $value['hook'], 'title' => $value['hook'], 'subtitle' => $value['value'], 'icon' => 'icon.png', ); array_push( $results, $item );}if ( count( $results ) > 0 ): echo $utils->toxml( $results );else: echo '<?xml version="1.0"?><items><item uid="suggest '. $text . '" arg="none"><title>No match</title><subtitle>Try changing your search query.</subtitle><icon>error.png</icon></item></items>';endif; Edited August 25, 2013 by BrianGilbert_ Link to comment
jdfwarrior Posted August 25, 2013 Share Posted August 25, 2013 Hi David This is for the Drupal workflow I've written, {query} is required for opening a URL, but I'd like to copy the full function including it's expected variables to the clipboard. an example: aggregator_admin_remove_feed_submit <-- 'arg' / {query} required for the opened url to work properly -https://api.drupal.org/api/drupal/7/search/{query} -https://api.drupal.org/api/drupal/7/search/aggregator_admin_remove_feed_submit aggregator_admin_remove_feed_submit($form, &$form_state) <-- 'title' is what I want to copy to the to clipboard Just in case it helps here is a lrger section of the code $results = array(); foreach( $matches as $hook => $sugg ) { if (!empty($sugg)) { $value = $sugg; } else { $value = ""; } $item = array( 'uid' => $value['hookname'], 'arg' => $value['hook'], 'title' => $value['hook'], 'subtitle' => $value['value'], 'icon' => 'icon.png', ); array_push( $results, $item ); } if ( count( $results ) > 0 ): echo $utils->toxml( $results ); else: echo '<?xml version="1.0"?><items><item uid="suggest '. $text . '" arg="none"><title>No match</title><subtitle>Try changing your search query.</subtitle><icon>error.png</icon></item></items>'; endif; So... this is hitting an API or parsing a page it looks like to grab the data about the function and showing it as feedback results in Alfred. You want to keep the url in case you want to open the page or quick look it, but also want the function syntax.. Is that correct? If so, what about... when you request the function info about the function (where you get the syntax, title, etc back), could you just save a json string of the output you get back? Then, you could set up multiple outputs for that script filter using modifier keys. Using say... cmd+enter would read the search string, and then find index in the json string (that you saved to file maybe?) and then send the appropriate stuff to the clipboard? Does make sense? Link to comment
BrianGilbert_ Posted August 28, 2013 Author Share Posted August 28, 2013 (edited) In this case it's safe to assume that users will always want to copy it to the clipboard, which is why I don't want to add a modifier key. I just seems that copy to clipboard is quite limited, or if it is possible to copy more than {query}, {time}, {date} and {clipboard} there is no indication of what else available? Edited August 28, 2013 by BrianGilbert_ Link to comment
BrianGilbert_ Posted August 28, 2013 Author Share Posted August 28, 2013 I ended up doing this with a script action instead of open url followed by clipboard 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