Jump to content

steviebraga

Member
  • Content Count

    3
  • Joined

  • Last visited

About steviebraga

  • Rank
    Newbie

Contact Methods

  • Twitter
    steviebraga
  1. Hi guys, I'm trying to create a simple alfred workflow (Keyword -> Run Script -> Post Notification) using ruby. If I run this scripts in the terminal, it runs just fine, but when I try to run them on Alfred, I get some errors: ruby start.rb {query} [ERROR: alfred.workflow.action.script] Code 1: -e:1:in `<main>': undefined local variable or method `start' for main:Object (NameError) I assumed that ruby wasn't in Alfred path so I tried /usr/bin/ruby start.rb {query} and got this error: [ERROR: alfred.workflow.action.script] Code 1: -e:1: unknown regexp option - b -e:1: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '(' /usr/bin/ruby start.rb asda If I use double quotes on the script name i get this errors: ruby "start.rb" {query} [ERROR: alfred.workflow.action.script] Code 1: -e:1: syntax error, unexpected tIDENTIFIER, expecting end-of-input and /usr/bin/ruby "start.rb" {query} [ERROR: alfred.workflow.action.script] Code 1: -e:1: unknown regexp option - b -e:1: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' /usr/bin/ruby "start.rb" asda ^ -e:1: syntax error, unexpected tIDENTIFIER, expecting end-of-input Can someone enlighten me why this is happening? Thanks!
  2. When I tried the regular require, I got this error: [ERROR: alfred.workflow.input.scriptfilter] Code 1: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- cpf (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from -e:1:in `<main>' But googling overnight, I found a solution: instead of using require, I used load and everything is working now! load "cpf.rb" Thanks for your time!
  3. Hi guys, I'm trying to create one workflow using a script filter with ruby. When i put everything in alfred script box it works fine, but i'd like to keep thing organized, so I tried to create 3 separate files, that are placed in workflow folder, and then use alfred script box just to call the methods defined in this files. Something like this: require_relative "file1" require_relative "file2" require_relative "file3" ... puts some_method(param) But when I do this, I get this exception: [ERROR: alfred.workflow.input.scriptfilter] Code 1: -e:1:in `require_relative': cannot infer basepath (LoadError) from -e:1:in `<main>' So, is it possible to do something like this. If yes, how? Thanks!
×
×
  • Create New...