Jump to content

Help: Ruby Workflow does not return feedback


Recommended Posts

Hello, I've just started to write Alfred workflow in Ruby with Zhaohai's workflow https://github.com/zhaocai/alfred-workflow

My workflow is pretty simple, it converts the inputted units using the gem 'ruby-units'

 

When I test the script in the terminal, it returns valid output for Alfred:

>> /usr/bin/ruby main.rb 10 cm in m
<items><item arg='copy=0.1' uid='' valid='yes'><title>0.1</title><subtitle>Copy to clipboard.</subtitle><icon>icon.png</icon></item></items>

However, when running in Alfred, it only shows the fallback results (Google, Wiki, etc.)

 

Here is the gist contain ruby scripts and info.plist files of my workflow: https://gist.github.com/vinh0604/8725898

 

I'm pretty new to Alfred workflow so maybe I missed something to make my workflow works. Please help me if you have any idea about it :)

 

Thank you in advance.

Edited by vinh0604
Link to comment

Hello, I've just started to write Alfred workflow in Ruby with Zhaohai's workflow https://github.com/zhaocai/alfred-workflow

My workflow is pretty simple, it converts the inputted units using the gem 'ruby-units'

 

When I test the script in the terminal, it returns valid output for Alfred:

>> /usr/bin/ruby main.rb 10 cm in m
<items><item arg='copy=0.1' uid='' valid='yes'><title>0.1</title><subtitle>Copy to clipboard.</subtitle><icon>icon.png</icon></item></items>

However, when running in Alfred, it only shows the fallback results (Google, Wiki, etc.)

 

Here is the gist contain ruby scripts and info.plist files of my workflow: https://gist.github.com/vinh0604/8725898

 

I'm pretty new to Alfred workflow so maybe I missed something to make my workflow works. Please help me if you have any idea about it :)

 

Thank you in advance.

 

Are you trying this workflow using a Script Filter input or a keyword attached to a Run Script? To return feedback to Alfred, you must use a Script Filter item and return valid xml back. Testing the code you have above, it appears to work for me. You can test it out yourself by creating a script filter, leaving the language as bash, and using this code

cat << EOB
<items><item arg='copy=0.1' uid='' valid='yes'><title>0.1</title><subtitle>Copy to clipboard.</subtitle><icon>icon.png</icon></item></items>
EOB

That's the code you provided above printed out using 'cat'

Link to comment

Thank for your reply, David. Finally I figured out what wrong with my code, I must change the require bundler line from

 

require 'bundler/setup'

to

 

require './bundle/bundler/setup'

 

Everything works ok now :)

By the way, here is my first Alfred workflow: http://www.alfredforum.com/topic/3825-alfred-workflow-for-units-and-currencies-converter/

 

I hope I can make something more useful in the future :)

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...