使用TextMate&ŧ039;的tmŧdialog命令创建用户定义的菜单

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用TextMate&ŧ039;的tmŧdialog命令创建用户定义的菜单相关的知识,希望对你有一定的参考价值。

  1. SUPPORT = ENV['TM_SUPPORT_PATH'] # Retrieves the path of textmates ruby modules
  2. DIALOG = ENV['DIALOG'] # retrieves the tm_dialog command
  3.  
  4. require SUPPORT + '/lib/escape'
  5. require SUPPORT + '/lib/osx/plist'
  6.  
  7. # Set up your menu items
  8. # Create an array of associative arrays that will hold your menu items
  9. #
  10. # NOTE: the key names of the associative array are:
  11. # title: The menu Title
  12. # path: The value that is associated to the selected item
  13. #
  14. # When you select a menu item tm_dialog retuns both the title and path
  15. # of the selected menu item
  16.  
  17. items = []
  18. items << {
  19. "title" => "Macs",
  20. "path" => "Rule"
  21. }
  22.  
  23. items << {
  24. "title" => "Windows",
  25. "path" => "Stinks"
  26. }
  27.  
  28. # Create a container associative array to hold your menu items
  29. #
  30. # transform an associative array into a plist (Property List, which is just an XML file). to_plist appears
  31. # to be an extention that textmate loads up automatically
  32. plist = {'menuItems' => items}.to_plist
  33.  
  34. # Run the tm_dialog command and load the result as a parsed property list.
  35. # NOTE: e_sh is provided by the escape module.
  36. res = OSX::PropertyList::load(`#{e_sh(DIALOG)} -up #{e_sh(plist)}`)
  37.  
  38. # simply display the returned path of the selected menu item
  39. puts res['selectedMenuItem']['path']

以上是关于使用TextMate&ŧ039;的tmŧdialog命令创建用户定义的菜单的主要内容,如果未能解决你的问题,请参考以下文章

检索给定年份的所有&ŧ039;星期一&ŧ039;的。

检查是否安装了Apache&ŧ039;的modŧu rewrite。

使用两个表的并集获取Count&ŧ039;s

使用loadClip加载图像/Swf&ŧ039;s

枚举SSID&ŧ039;s

Widgetize页眉,页脚和其他一切使用论文&ŧ039;挂钩