|
不要判我灌水及商业吹:
举例说明,快手编程:
1、调用外部程序:
mainForm.button.oncommand = function(id,event){
process.execute("~\MYuan02.exe","");
}
就搞定同目录下 exe文件的打开。
2、想追加 log 日志文本,比如时间,提取log记录行的时间,
mainForm.button2.oncommand = function(id,event){
var file01 = io.file("~\test.TXT","a+");
//移动文件指针到尾部
file01.seek("end");
var str01 = file01.readback();
var tm = time();
//读取最后一行
console.log(str01);
console.print("END");
file01.seek("set");
console.print(file01.read("%s"));
console.print("SET");
//向前读取到文件头部第二个字节
//console.log( file.readback(-2) )
// console.pause();
//返回格式化的时间字符串
var str02 = tostring(tm);
console.log(str02);
var str03 = tm.format("%Y年%m月%d日 %H时%M分%S秒");
console.log(str03);
//console.pause();
file01.seek("end");
file01.write('\n',str02);
file01.write('\n',"随便写入一行");
file01.close();
var time_n = tonumber(tm);
console.log(time_n);
var tm02 = time(str02);
console.log("tm02=",tm02);
console.pause();
console.close();
}
还是相对简单的
|
|