Ruby 打开 Windows 的文件对话框

2015-08-12 0 278
Ruby 打开 Windows 的文件对话框
require "win32ole"

cd = WIN32OLE.new("MSComDlg.CommonDialog")

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

遇见资源网 ruby Ruby 打开 Windows 的文件对话框 http://www.ox520.com/16425.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务