首先,tw默认关闭错误探测和,总是默认提示"error captured"(大概是这个意思),这对于调试脚本很困难,所以我建议写脚本的时候在最前面加上
window.onerror=reportError;
function reportError(msg,url,line) {
var str = "You have found an error as below: \n\n";
str += "Err: " + msg + " on line: " + line +"\n\n";
//str += "url:" +url;
alert(str); return true; }
这样以后有什么错误就会弹出。
可能是开发组懒惰(莫打!),有几个external函数跟mt兼容(应该说一模一样),这样对我们写本地文档很有方便,下面我列出来这几个函数:
var security_id=%max_security_id 这个是安全id,授权执行的凭据。
var str= external.readFile(security_id,"plugin_name", "plugin.ini");读plugin_name插件的plugin.ini文档到一个字符串中。相应也有writeFile函数
var doc= external.get_tab(security_id,0); 获得第0个窗口(就是最先打开的浏览器窗口)
external.m2_writeIni(security_id,"plugin_name","plugin.ini","setting","x","faint"); 写配置到plugin_name插件plugin.ini文件的setting栏的x值处,就是x=faint