We Recommend

Beginning Ruby: From Novice to Professional Beginning Ruby: From Novice to Professional
Beginning Ruby is a thoroughly contemporary guide for every type of reader wanting to learn Ruby, from novice programmers to web developers to Ruby newcomers. It starts by explaining the principles behind object-oriented programming and within a few chapters builds toward creating a genuine Ruby application.


Posted By

gtcaz on 02/01/07


Tagged

ruby e Bundle


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

gbvb
vali29


Preview in IE


Published in: Ruby 


  1. #!/usr/bin/env ruby -w
  2. require 'win32ole'
  3. require 'timeout'
  4. require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes.rb"
  5.  
  6. filename = ENV['TM_FILEPATH'].delete '\\'
  7. url = "file:///" + %x[cygpath -m "#{filename}"].chomp.capitalize
  8.  
  9. begin
  10. Timeout::timeout(5) {
  11. ie = WIN32OLE.new('InternetExplorer.Application')
  12. ie.Navigate("#{url}")
  13. sleep('.2'.to_f) while ie.ReadyState != 4
  14. ie.Visible = 'true'
  15. }
  16. rescue Timeout::Error
  17. puts "Unable connect to #{url} in a reasonable time"
  18. TextMate.exit_show_tool_tip
  19. end
  20.  

Report this snippet 

You need to login to post a comment.