Posted By

gtcaz on 02/01/07


Tagged

ruby e Bundle


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

gbvb
vali29
webstic


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.