Jump to content

Generating Feedback in Workflows


Recommended Posts

Is it possible to have an action that requires a modifier key to be optional?

 

For example when holding "alt" and finding a valid search result I will offer the chance to delete the result.

But if no search results are found I return the root search folder, but I don't really want the user to be able to accidentally delete the root folder.

 

I can simply make my action script check if it is the root and not perform the delete but the user will still see the change of text when holding the modifier key, which will be confusing.

Link to comment
Request: add a "url" attribute.  Alfred could then interpret that URL as saying "when this item is selected in the list, open this url".  This would be great for any sort of "search" workflow (google, wikipedia, documentation, etc).

 

You can set the argument of the item to a url and then pass that to a Open URL module.

In case of a search you just have to send the query you want to search and the use a Open URL module or a Default Web Search module...

Link to comment
Request: add a "url" attribute.  Alfred could then interpret that URL as saying "when this item is selected in the list, open this url".  This would be great for any sort of "search" workflow (google, wikipedia, documentation, etc).

 

To build on what Jonas suggested, the "open" shell command also understands URLs and, if I'm not mistaken, even different URL handlers. (I think that's the right name—"magnet://" or "tweetbot://" or whatever.)

Link to comment
  • 3 weeks later...

Hey, I'm being helpful ! That was unexpected  :D

 

If I may, I use [timestamp + n] where n is the # of the item and timestamp is the timestamp at the beginning of the script. That way, I'm sure that even with a low precision timestamp (seconds) and a high generation of items, i won't have twice the same ID (both within a query and across several calls).

 

 

Cheers ;)

 

Python have module uuid for generating unique identifiers, ruby has similar function in SecureRandom.

Link to comment
  • 3 weeks later...

I agree it would be really cool to set icons from external URLs. Could be possible? I'm making a workflow to search films on Filmaffinity and would be great to show thumbs of the films posters without saving temps :)

This has been added as a note as something for us to look at in the future but no it can't be done right now. Right now, downloading temps is the way to go

Link to comment

I am very intrigued by this feature but I still don't really get how it works. Is there a more detailed description somewhere? Can someone post a simple example for such a workflow using a python script (just with an arbitrary XML such as the one at the beginning of this thread)?

Link to comment

I am very intrigued by this feature but I still don't really get how it works. Is there a more detailed description somewhere? Can someone post a simple example for such a workflow using a python script (just with an arbitrary XML such as the one at the beginning of this thread)?

 

I'm not sure what exactly it is that you are asking for. Essentially, if you create a workflow that has a Script Filter item, then in the script area, if you make it return/echo back an XML string that matches the format of the first post then that will generate results in the Alfred interface. Similar to searching in Alfred and getting results in the list.. you can make results appear in the list with this XML format.

Link to comment

I'm not sure what exactly it is that you are asking for. Essentially, if you create a workflow that has a Script Filter item, then in the script area, if you make it return/echo back an XML string that matches the format of the first post then that will generate results in the Alfred interface. Similar to searching in Alfred and getting results in the list.. you can make results appear in the list with this XML format.

 

Thanks, that is already helpful. I though the returned values comes from the different scripting languages.

Link to comment

Im currently trying my first workflow. The first crucial step seems to be to make sure the returning xml format is right (looking at the workflow.php). What is the best way to verify the curl command return the correct xml? 

 

EDIT: Would the best approach be to upload workflows.php and a search.php to a website for easier debugging of xml file? 

Edited by Simzdk
Link to comment

Hey guys,

 

I've seen a lot of people using python or php for their script filters. However, I am an Applescript programmer and don't know how to use script filters using Applescript :( I know, I obviously select the "usr/bin/osascript" from the language combo and type the code there, but is it even possible to generate feedback from an applescript?

 

I have even tried making a simple script filter (e.g., set the clipboard to "{query}"), but it seems that the argument is not passed to the script in cause since the clipboard doesn't change (yes, escaping is set to double quotes and arguments are on)..

 

What am I doing wrong? or are Applescript filters not properly supported yet? :(

Link to comment

No if you are making a script filter (and selecting osascript) there is no need to wrap and the query remains {query}. Take a look at my Adium workflow. It's pure applescript. You'll see how to generate feedback.

 

That's it! You just answered all my questions! :D

 

P.S. if you're familiar with Alfred's Workflows class written in PHP by David Ferguson, I'm already starting to write the equivalent AppleScript script object class to make it easier for AS lovers to generate feedback much easier and write/read settings more easily and with less code :D (and I love that I can mimic object-orientation with AS to achieve this!); when it'll be ready, I'll put it on github and share it with all my fellow AppleScript comrades :D

Link to comment

Quick question: is there anyway to bypass Alfred's result learning system? Basically I want to show the results in a specific order based on the argument provided, but I can't seem to be able because Alfred prioritizes the most used results :(

 

Why would I need this? Here's an example: my iTunes Ratings workflow shows 5 feedback results (star 1,2,3,4 and 5), so if the user types "rate 3" I want to show him the results as "3,1,2,4,5" (so I want to prioritize results myself based on the typed argument)

Link to comment

You can do that by finding a way to have a unique UID every time. For example what I like to do is to get a timestamp before echoing the results and then increment that number for each result. 

 

Wow, great idea! But won't that be overkill for Alfred's internal dictionaries since it will have to learn a new term every single time a key is pressed?

Link to comment

I face the same problem and don't feel it's right to use randomly generated stuff for the arg parameter. It would be great if Alfred supports some way to order the items. Leaving the UID empty should just leave them in the same order they were created...

Link to comment

Yes Greg, I totally agree, that's exactly how it should work: leaving the UID empty will show the results in ~our~ chosen order.

 

Guys, we'll take a look at this and see if there is a way we can optimize this in the future. For now, you would need to find a way to set the results apart from the others so that they keep their correct order. It can be done with a timer, uuid, etc.

Link to comment

Question about uid and feedback items order: "Give your results a unique identifier and Alfred will learn which ones you use the most and prioritize them by moving them up in the result list.

 

I tried to give unique uid for feedback each items. However, after I activated some of the items many times, Alfred does not "prioritize them by moving them up in the result list".

Link to comment

Question about uid and feedback items order: "Give your results a unique identifier and Alfred will learn which ones you use the most and prioritize them by moving them up in the result list.

 

I tried to give unique uid for feedback each items. However, after I activated some of the items many times, Alfred does not "prioritize them by moving them up in the result list".

 

Are you generating a new unique id each time or are they the same each time you run it?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...