2024-01-01 11:46:53 +00:00
|
|
|
/**
|
|
|
|
* Load a frame, optionally with a new ANSI/BIN and load it into the msgbase.
|
|
|
|
*/
|
|
|
|
|
2023-12-27 11:39:26 +00:00
|
|
|
load('ansitex/load/funcs.js');
|
2024-01-01 11:46:53 +00:00
|
|
|
// Our page handler
|
2023-12-27 11:39:26 +00:00
|
|
|
load('ansitex/load/page.js');
|
|
|
|
|
|
|
|
/* parse command arguments */
|
2024-01-01 11:46:53 +00:00
|
|
|
if (argv.length !== 3) {
|
|
|
|
writeln('! ERROR: Need 3 arguments only');
|
2023-12-27 11:39:26 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2024-01-01 11:46:53 +00:00
|
|
|
var frame = argv.shift();
|
|
|
|
var index = argv.shift();
|
2023-12-27 11:39:26 +00:00
|
|
|
var file = argv.shift();
|
|
|
|
|
|
|
|
var ext = file_getext(file).substr(1).toLowerCase();
|
|
|
|
|
|
|
|
// Type of frame to load
|
|
|
|
switch (ext) {
|
|
|
|
case 'tex':
|
2024-01-01 11:46:53 +00:00
|
|
|
case 'ans':
|
2023-12-27 11:39:26 +00:00
|
|
|
require('ansitex/load/session/ansitex.js','SESSION_ANSITEX');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'vtx':
|
2024-01-01 11:46:53 +00:00
|
|
|
case 'bin':
|
2023-12-27 11:39:26 +00:00
|
|
|
require('ansitex/load/session/viewdata.js','SESSION_VIEWDATA');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2024-01-01 11:46:53 +00:00
|
|
|
var page = new Page();
|
2024-01-02 11:41:50 +00:00
|
|
|
if (page.get(new PageObject(frame,index))) {
|
|
|
|
page.import(file,ext);
|
|
|
|
page.save();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
throw new Error('Page '+frame+index+' doesnt exist?');
|
|
|
|
}
|