文件的打开和保存
By
admin
at 2017-12-10 • 0人收藏 • 1669人看过
import fsys.dlg; //打开 mainForm.button.oncommand = function(id,event){ //mainForm.msgbox( mainForm.button.text ); var path = fsys.dlg.open("所有文件|*.*|",,,mainForm.hwnd);//获取路径 //console.log(path) if(path){ filecontent = string.fromto(string.load(path),0,65001);//防止乱码 mainForm.edit.text = filecontent; } } //保存 mainForm.button3.oncommand = function(id,event){ //mainForm.msgbox( mainForm.button3.text ); var path = fsys.dlg.save("*.txt|*.txt|");//获取路径 var ret = string.save(path,retcontent);//保存 if(ret){ mainForm.msgbox("保存成功!") }else { mainForm.msgbox("保存失败!") } }
登录后方可回帖