MAXScript调用DOTNET的OpenFileDialog

MAXScript中可以通过System.Windows.Forms.OpenFileDialog来获取文件的全路径

--创建OpenFileDialog
theDialog=dotNetObject "System.Windows.Forms.OpenFileDialog"
--设置对话框的标题
theDialog.title="请选择文件"
--设置可以多选
theDialog.Multiselect = true
--过滤文件的类型
theDialog.Filter="Max文件(*.max)|*.max|所有文件(*.*)|*.*" 
--设置默认的文件过滤下拉列表是"所有文件"
theDialog.FilterIndex = 2 --显示对话框 将选中结果赋值给变量result result = theDialog.showDialog() --关闭对话框后 将result转换成字符串 result.ToString() --当按下OK 返回true result.Equals result.OK --当按下Cancel 返回true result.Equals result.Cancel --文件名最后以数组的方式返回 theFilenames = theDialog.fileNames

 

posted @ 2014-09-29 15:01  amixc  阅读(1222)  评论(0)    收藏  举报