Ruby/Windows Platform/Dialog

Материал из Wiki.crossplatform.ru

(Различия между версиями)
Перейти к: навигация, поиск
м (1 версия: Импорт выборки материалов по Ruby)
 

Текущая версия на 17:59, 13 сентября 2010

Open file dialog

require "win32ole"
cd = WIN32OLE.new("MSComDlg.rumonDialog")
cd.filter = "All Files(*.*)|*.*" +"|Ruby Files(*.rb)|*.rb"
cd.filterIndex = 2
cd.maxFileSize = 128    # Set MaxFileSize
cd.showOpen()
file = cd.fileName      # Retrieve file, path
if not file or file==""
   puts "No filename entered."
else
   puts "The user selected: #{file}\n"
end