Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:20:14+00:00 2026-05-13T06:20:14+00:00

I have a Ruby script that I built in TextMate and can successfully run

  • 0

I have a Ruby script that I built in TextMate and can successfully run in TextMate.
I can also successfully run this script straight from the terminal.

The script has this chunk of code in it:

# Get the XML file
puts 'Opening the file'
open("messages.xml", "r") do |f|
   puts 'File is opened'

   theXML = Hpricot::XML(f)
   puts 'Trying to get the message_entity'
   message_entity = GetMessage(theXML)

   # Build the system command
   puts 'Getting the author and the message'
   theAuthor = message_entity.search(:author).text
   theMessage = message_entity.search(:messagetext).text     

   # Get the correct image for this author
   theAuthorImage = ''

   case theAuthor
      when 'James' : theAuthorImage = 'images/me32.png'
      when 'Zuzu' : theAuthorImage = 'images/Zuzu32.png'
   end

   puts "/usr/local/bin/growlnotify '" + theAuthor + " says' -m '" + theMessage + "' -n 'Laurens Notes' --image '" + theAuthorImage + "'"
   #system("/usr/local/bin/growlnotify '" + theAuthor + " says' -m '" + theMessage + "' -n 'Laurens Notes' --image '" + theAuthorImage + "'")
end
puts 'The End'

When the script is run by GeekTool, it never gets past puts 'File is opened'. It doesn’t even hit puts 'The End'. It gives no error at all.

The script is under a folder under the /System folder on my Mac, but I have changed the file permissions to allow “everyone” to have “read & write” access.
EDIT
I just copied the files to a folder directly under my user home folder, and it still has the issue in GeekTool but not in TextMate or straight through the Terminal.

END EDIT

2nd Edit

I think GeekTool may have an issue with paths to files maybe.

For example, I changed the program to just read the XML file straight from the Internet for now and it does that just fine, but there are some images that the program is using for the icons in growlnotify. When run through TextMate, these icons display perfectly. When run using GeekTool…nope. No custom icon at all.

It’s as if GeekTool just can’t handle the file paths correctly.
When I do puts __FILE__.to_s it gives me the correct filepath to my .rb file though.

** end 2nd edit**
What should I do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:20:15+00:00Added an answer on May 13, 2026 at 6:20 am

    Geektool runs all the commands from / so relative path names will not work when trying to run growlnotify.

    puts Dir.pwd  #outputs "/"
    

    You will need to pass the absolute paths of the images to growlnotify.

    The current path can be retrieved with

    File.dirname(__FILE__)
    

    So you would use

    theAuthorImage = File.dirname(__FILE__)
    
    case theAuthor
      when 'James' : theAuthorImage += '/images/me32.png'
      when 'Zuzu'  : theAuthorImage += '/images/Zuzu32.png'
    end
    
    cmd = "/usr/local/bin/growlnotify '#{theAuthor} says' -m '#{theMessage}' -n 'Laurens Notes' --image '#{theAuthorImage}'"
    puts cmd
    system cmd
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 440k
  • Answers 440k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer POV-Ray is in my opinion the best open source general… May 15, 2026 at 5:06 pm
  • Editorial Team
    Editorial Team added an answer You could sort by saturation (which is a good indicator… May 15, 2026 at 5:06 pm
  • Editorial Team
    Editorial Team added an answer Found the answer, there's nothing wrong with the gtk code.… May 15, 2026 at 5:06 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.