Displaying an alert box with TextMate's tm_dialog command


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.