====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
script_customviewlog [2016/11/15 12:26] cdfa 1.0.6.1 |
script_customviewlog [2016/11/18 15:24] (current) cdfa |
||
---|---|---|---|
Line 3: | Line 3: | ||
* Author : cdfa | * Author : cdfa | ||
* Link : https://plus.google.com/100430440392224314007/posts/ht4aZS8LSWg | * Link : https://plus.google.com/100430440392224314007/posts/ht4aZS8LSWg | ||
- | * Version: 1.0.6.1 | + | * Version: 1.0.6.3 |
====== How to use the script ====== | ====== How to use the script ====== | ||
Line 57: | Line 57: | ||
1.0.6.1 | 1.0.6.1 | ||
* Fixed a bug with the script name | * Fixed a bug with the script name | ||
+ | |||
+ | 1.0.6.2 | ||
+ | * Fixed a few bugs related to unreachable logfile | ||
+ | |||
+ | 1.0.6.3 | ||
+ | * Fixed date | ||
====== Things to keep in mind ====== | ====== Things to keep in mind ====== | ||
Line 187: | Line 193: | ||
var date = new Date(); | var date = new Date(); | ||
- | var logText = "<font color=#add8e6>" + date.getDate() + "-" + date.getMonth() + 1 + | + | var logText = "<font color=#add8e6>" + date.getDate() + "-" + (date.getMonth() + 1) + |
"</font>" + " <font color=#ffff00>" + date.toTimeString().slice(0, 8) + | "</font>" + " <font color=#ffff00>" + date.toTimeString().slice(0, 8) + | ||
"</font>" + " <font color=#00ff00>" + logScript.currentScript.getName() + "</font>" + | "</font>" + " <font color=#00ff00>" + logScript.currentScript.getName() + "</font>" + | ||
Line 299: | Line 305: | ||
case "I_RESUMED": | case "I_RESUMED": | ||
// in resume | // in resume | ||
- | var tv = logScript.getTV() | + | var tv = logScript.getTV(); |
- | if(tv.getText().length() == 0 || new File(logScript.logFilePath).lastModified() > logScript.getScript().getTag("lastLoaded")) { | + | try { |
+ | var logFile = new File(logScript.logFilePath); | ||
+ | } catch(e) {} | ||
+ | |||
+ | if(logFile !== null && tv.getText().length() == 0 || logFile.lastModified() > logScript.getScript().getTag("lastLoaded")) { | ||
var savedLogText = read(logScript.logFilePath) | var savedLogText = read(logScript.logFilePath) | ||
Line 312: | Line 322: | ||
pw.print(""); | pw.print(""); | ||
pw.write(savedLogText); | pw.write(savedLogText); | ||
- | } catch(e) { | + | } catch(e) {} finally { |
- | alert("At line " + e.lineNumber + ": " + e); | + | if(pw) pw.close(); |
- | } finally { | + | |
- | pw.close(); | + | |
} | } | ||
logScript.getScript().setTag("lastLoaded", new Date().getTime()) | logScript.getScript().setTag("lastLoaded", new Date().getTime()) | ||
Line 338: | Line 346: | ||
} | } | ||
script.setTag("prevLogInd", null); | script.setTag("prevLogInd", null); | ||
- | } catch(e) { | + | } catch(e) {} finally { |
- | alert("At line " + e.lineNumber + ": " + e); | + | if(bfWriter) bfWriter.close(); |
- | } finally { | + | |
- | bfWriter.close(); | + | |
} | } | ||
break; | break; | ||
Line 390: | Line 396: | ||
alert("At line " + e.lineNumber + ": " + e); | alert("At line " + e.lineNumber + ": " + e); | ||
} finally { | } finally { | ||
- | bfWriter.close(); | + | if(bfWriter) bfWriter.close(); |
} | } | ||
} | } |