Jump to content
Sign in to follow this  
vinh0604

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

Share this post


Link to post

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'

Share this post


Link to post

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 :)

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  
×
×
  • Create New...