Jump to content

jhnielson

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Days Won

    1

jhnielson last won the day on November 21 2015

jhnielson had the most liked content!

About jhnielson

  • Rank
    Newbie
  • Birthday September 28

Profile Information

  • Location
    Salt Lake City, UT
  • Interests
    Home Automation
    Most Things Outdoors: Camping, Fishing, Skiing, Diving

Recent Profile Visitors

376 profile views
  1. Great workflow. Is there anyway to change the directory it uses for the .gauth file? I would like to save it in the workflow folder so that it would stay synced across my computers. Thanks!
  2. I love this - but it stopped working on El Capitan - I always get the "Oops could not determine your browser". My default browser is Safari.
  3. I have a script that searches an online file system. Currently, when I find the file I want and hit enter it just runs a script to open the URL of the document in the browser. However, I would like to now update it to give me a selection of actions I can take (e.g. copy url, open document, download document). I can't figure out how to create the secondary menu. I know that I could just create multiple scripts and assign them different modifier keys, but I would like to be able to visualize the list (not just have to remember the keys). Is there a way to create second menu?
  4. So i think I have discovered something relevant that may have something to do with the issue. I simply copied the XML output from Terminal and pasted it directly into the script filter in Aflred: <?xml version="1.0" encoding="UTF-8"?> <items> <item uid="suggest {query}" arg="https://system.com/ui/?tk=ABSCDEFG#doc/894"> <title>v001015 Test</title> <subtitle>"https://system.com/ui/?tk=ABSCDEFG#doc/894"</subtitle> <icon>binder.png</icon> </item> </items> and it still didn't provide any results (which I would assume it would automatically). Then in comparing my file to the example xmlformat in Alfred, I noticed that the first line contained: "cat << EOB" in the first line and "EOB" in the last line. When i pasted the XML below... BAM! I got the filter result. cat << EOB <?xml version="1.0" encoding="UTF-8"?> <items> <item uid="suggest {query}" arg="https://system.com/ui/?tk=ABSCDEFG#doc/894"> <title>v001015 Test</title> <subtitle>"https://system.com/ui/?tk=ABSCDEFG#doc/894"</subtitle> <icon>binder.png</icon> </item> </items> EOB so I created a very basic script that will just print out a xml block Item = Struct.new( :arg, :title, :subtitle, :icon) def xmlPackage(items) resultXML = Builder::XmlMarkup.new(:target => $output,:indent => 2) resultXML.instruct! resultXML.items do items.each do |item| resultXML.item(:uid=>"suggest {query}",:arg=>item.arg) { resultXML.title item.title resultXML.subtitle item.subtitle resultXML.icon item.icon #resultXML.valid item.valid } end end end items = [] items << Item.new("TEST","TITLE_TEST","Subtitle_TEST","test.png") puts "cat << EOB\n" + xmlPackage(items) + "EOB" But that still won't give me any results. It just goes to the fallback results. It still seems like Alfred is not executing the script
  5. Thanks for all the help David. I emailed you the workflow and appreciate any insights you can provide
  6. Thanks for the info David. A couple of things. I am calling the ruby script from in the workflow folder. Based on your comment i believe that is setup correctly. Correct?! Also, here is a sample of the XML responses I get from terminal (I think it looks correct). <items> <item uid="suggest {query}" arg="https://sytem.com/1426"> <title>Workbook</title> <subtitle>1426</subtitle> <icon>excel.png</icon> </item> <item uid="suggest {query}" arg="https://sytem.com/1067"> <title>Working Template</title> <subtitle>1067</subtitle> <icon>word.png</icon> </item> <item uid="suggest {query}" arg="https://system.com/321"> <title>Questionnaire</title> <subtitle>321</subtitle> <icon>word.png</icon> </item> </items> This is what the script in the "Script Filter" step is running
  7. I have a Ruby script that I have developed that searches through an internal system we use through it's API. When I run the script in the terminal by calling: ruby search.rb "TEST" it runs just fine and I get the list of results I would expect, in the XML format to be passed to Alfred. However when I call the script from Alfred: ruby search.rb "{query}" I type the keyword "S" and it shows the proper placeholder Title (so I know the keyword worked). However, as soon as I start to type the query text it just goes to the default search items (e.g. Search Google for....). It never shows the "Please Wait Subtext...." Has anyone encountered this issue or am I missing something critical? Any help would be greatly appreciated. Also as an aside I'm not sure I understand the purpose of the two steps in the sample "Script Filter To Notification" workflow. What is the "Script Filter" step doing different form the "Run Script" step? Thanks in advance for any help... Here's a picture of my workflow: I have pasted as much of the script below as I can (it has some proprietary info in it so I can't share the full script), but I don't think i have omitted any critical information. If there are any specific questions about certain parts of the missing scripts, I'll share what I can. $logger = Yell.new "Alfred Logger", :level => :error $search = ARGV[0].to_s.gsub("\\","") ....... $logger.info "#{$search} was passed in as search paramater" def xmlPackage(items) resultXML = Builder::XmlMarkup.new(:target => $output,:indent => 2) resultXML.instruct! resultXML.items do items.each do |item| resultXML.item(:uid=>"suggest {query}",:arg=>item.arg) { resultXML.title item.title resultXML.subtitle item.subtitle resultXML.icon item.icon resultXML.valid item.valid } end end end Login = Struct.new( :url, :user, :password) sessions = ...login paramateres...... items = [] newSessions = [] sessions.each_with_index do |session,index| $logger.info "checking session to #{session.url}: #{$sessions[index]}" $url = "https://#{session.url}/api" qUrl = $url + "&search=#{$search}&returnlimits=20" results = JSON.parse(RestClient.get qUrl,:authorization=>$sessions[index],:content_type => :json, :accept => :json) if results["responseStatus"].eql? "FAILURE" ....address common failure cause.... end $logger.info "Creating XML for session #{session.url} #{$session}" results["documents"].each_with_index do |result,index| icon = getIcon(result["document"]["format__v"].to_s) arg = ....... title = ....Title.... subtitle = arg.to_s $logger.info "Found item: #{title}" items << Item.new(arg,title,subtitle,icon,"yes") end $logger.info "XML created for session #{session.url}" newSessions << $session end ...cycles through multiple sessions.... puts xmlPackage(items)
×
×
  • Create New...