forked from ff6347/debugging-ae-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
debug_writer.jsx
49 lines (44 loc) · 1.45 KB
/
debug_writer.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// functions for debugging
/**
* This function is
* @deprecated use Debugger.jsx
*/
function Debugger(){
this.filename ="debuginfo";
this.filepath = "~/Desktop/"+ this.filename +".txt";
this.debugstrings = [];
this.write_infos = function (){
// get the textfile
var write_file = File(this.filepath);
if(!write_file.exists){
// if the file does not exist create one
write_file = new File(this.filepath);
}else{
// if it exsists ask the user if it should be overwritten
var res = confirm ("The file already exists. Should I overwrite it", true, "titleWINonly");
// if the user hits no stop the script
if(res != true){
return;
};
};
var out;// our output
// we know already that the file exist
// but to be shure
if( write_file!='' ){
//Open the file for writing.
out = write_file.open( 'w', undefined, undefined );
write_file.encoding = "UTF-8";
write_file.lineFeed = "Unix"; //convert to UNIX lineFeed
// txtFile.lineFeed = "Windows";
// txtFile.lineFeed = "Macintosh";
};
// got an output?
if( out != false ){
// loop the list and write each item to the file
write_file.writeln(this.debugstrings.join('\n'));
// allways close files!
write_file.close();
write_file.execute();
}
}
}