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

dbug13 on 06/03/08


Tagged

textmate ruby


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

zegenvs


Displaying an alert box with TextMate's tm_dialog command


Published in: Ruby 


  1. SUPPORT = ENV['TM_SUPPORT_PATH']
  2. DIALOG = ENV['DIALOG']
  3.  
  4. require SUPPORT + '/lib/escape'
  5. require SUPPORT + '/lib/osx/plist'
  6.  
  7. title = "My Alert"
  8. message = "This is my alert Box"
  9. buttons = ['OK', 'Close']
  10.  
  11. params = {
  12. 'alertStyle' => 'informational',
  13. 'messageTitle' => title,
  14. 'informativeText' => message,
  15. 'buttonTitles' => buttons
  16. }
  17.  
  18. opts = params.to_plist
  19.  
  20. puts `#{e_sh(DIALOG)} -ep #{e_sh(opts)}`

Report this snippet 

You need to login to post a comment.